public function test_addToWalletActive()
 {
     $asCustId = 'cid';
     $asValue = 'val';
     $asRef = 'ref';
     $obm = \Magento\Framework\App\ObjectManager::getInstance();
     /** @var  $dba \Praxigento\Core\Lib\Context\IDbAdapter */
     $dba = $obm->get(\Praxigento\Core\Lib\Context\IDbAdapter::class);
     $conn = $dba->getDefaultConnection();
     $conn->beginTransaction();
     try {
         /** @var  $call \Praxigento\Wallet\Service\IOperation */
         $call = $obm->get(\Praxigento\Wallet\Service\IOperation::class);
         $req = new Request\AddToWalletActive();
         $req->setOperationTypeId(1);
         $req->setTransData([[$asCustId => 1, $asValue => 23, $asRef => 3], [$asCustId => 2, $asValue => 32, $asRef => 2]]);
         $req->setAsAmount($asValue);
         $req->setAsCustomerId($asCustId);
         $req->setAsRef($asRef);
         $response = $call->addToWalletActive($req);
         $this->assertTrue($response->isSucceed());
     } finally {
         $conn->rollback();
     }
 }
 public function test_addToWalletActive()
 {
     /** === Test Data === */
     $dateApplied = '2016-02-24 10:12:23';
     $datePerformed = '2016-02-25 12:10:23';
     $operTypeCode = 'code';
     $asAmount = 'amount';
     $asCustId = 'custId';
     $asRef = 'ref';
     $assetTypeId = 2;
     $custIdRepres = 10;
     $operId = 16;
     $trans = [[$asCustId => $custIdRepres, $asAmount => -32.23, $asRef => 45], [$asCustId => 41, $asAmount => 32.23, $asRef => 54]];
     /** === Setup Mocks === */
     // $assetTypeId = $this->_repoMod->getTypeAssetIdByCode(Config::CODE_TYPE_ASSET_WALLET_ACTIVE);
     $this->mRepoMod->shouldReceive('getTypeAssetIdByCode')->andReturn($assetTypeId);
     // function _getAccountRepresentativeId($assetTypeId)
     // $respAccRepres = $this->_callAccount->getRepresentative($reqAccRepres);
     $mResp = new GetRepresentativeResponse();
     $this->mCallAccount->shouldReceive('getRepresentative')->andReturn($mResp);
     $mResp->setData(Account::ATTR_CUST_ID, $custIdRepres);
     // $respGetAccount = $this->_callAccount->get($reqGetAccount);
     $mResGet = new AccountGetResponse();
     $this->mCallAccount->shouldReceive('get')->andReturn($mResGet);
     // $accId = $respGetAccount->getData(Account::ATTR_ID);
     $mResGet->setData(Account::ATTR_ID, 54);
     // $respOperAdd = $this->_callOper->add($reqOperAdd);
     $mRespAdd = new OperationAddResponse();
     $this->mCallOper->shouldReceive('add')->andReturn($mRespAdd);
     // $operId = $respOperAdd->getOperationId();
     $mRespAdd->setOperationId($operId);
     /** === Call and asserts  === */
     $req = new Request\AddToWalletActive();
     $req->setDateApplied($dateApplied);
     $req->setDatePerformed($datePerformed);
     $req->setOperationTypeCode($operTypeCode);
     $req->setTransData($trans);
     $req->setAsAmount($asAmount);
     $req->setAsCustomerId($asCustId);
     $req->setAsRef($asRef);
     $resp = $this->obj->addToWalletActive($req);
     $this->assertTrue($resp->isSucceed());
     $this->assertEquals($operId, $resp->getOperationId());
 }