Пример #1
0
 public function test_accountPv()
 {
     /** === Test Data === */
     $custId = 21;
     $orderId = 34;
     $operId = 1024;
     $pvTotal = 300;
     $accIdCust = 101;
     $accIdRepres = 202;
     /** === Setup Mocks === */
     // $sale = $this->_repoSale->getById($saleId);
     $this->mRepoSale->shouldReceive('getById')->once()->with($orderId)->andReturn(new Sale([Sale::ATTR_TOTAL => $pvTotal]));
     // $customerId = $this->_repoMod->getSaleOrderCustomerId($saleId);
     $this->mRepoMod->shouldReceive('getSaleOrderCustomerId')->once()->with($orderId)->andReturn($custId);
     // $respGetAccCust = $this->_callAccount->get($reqGetAccCust);
     $mRespGetAccCust = new \Praxigento\Accounting\Service\Account\Response\Get();
     $mRespGetAccCust->setData([Account::ATTR_ID => $accIdCust]);
     $this->mCallAccount->shouldReceive('get')->once()->andReturn($mRespGetAccCust);
     // $respGetAccRepres = $this->_callAccount->getRepresentative($reqGetAccRepres);
     $mRespGetAccRepres = new \Praxigento\Accounting\Service\Account\Response\GetRepresentative();
     $mRespGetAccRepres->setData([Account::ATTR_ID => $accIdRepres]);
     $this->mCallAccount->shouldReceive('getRepresentative')->once()->andReturn($mRespGetAccRepres);
     // $respAddOper = $this->_callOperation->add($reqAddOper);
     $mRespAddOper = new \Praxigento\Accounting\Service\Operation\Response\Add();
     $this->mCallOperation->shouldReceive('add')->once()->andReturn($mRespAddOper);
     // $operId = $respAddOper->getOperationId();
     $mRespAddOper->setOperationId($operId);
     /** === Call and asserts  === */
     $req = new Request\AccountPv();
     $req->setSaleOrderId($orderId);
     $res = $this->obj->accountPv($req);
     $this->assertTrue($res->isSucceed());
     $operId = $res->getOperationId();
     $this->assertEquals($operId, $operId);
 }
Пример #2
0
 private function _accountPv()
 {
     $req = new SaleAccountPvRequest();
     $req->setCustomerId($this->customerId);
     $req->setSaleOrderId($this->orderId);
     $resp = $this->_callSale->accountPv($req);
     $this->operationId = $resp->getOperationId();
     $this->assertTrue($resp->isSucceed());
     $this->_logger->debug("PV for order #{$this->orderId} is accounted as for paid sale order as operation #{$this->operationId}.");
 }