Example #1
0
 /**
  * @test
  */
 public function shouldCorrectlyConvertPayoutToDetails()
 {
     $gatewayMock = $this->getMock(GatewayInterface::class);
     $gatewayMock->expects($this->once())->method('execute')->with($this->isInstanceOf(GetCurrency::class))->willReturnCallback(function (GetCurrency $request) {
         $request->name = 'US Dollar';
         $request->alpha3 = 'USD';
         $request->numeric = 123;
         $request->exp = 2;
         $request->country = 'US';
     });
     $payoutModel = new Payout();
     $payoutModel->setRecipientId('theRecipientId');
     $payoutModel->setCurrencyCode('USD');
     $payoutModel->setTotalAmount(123);
     $payoutModel->setDescription('the description');
     $action = new ConvertPayoutAction();
     $action->setGateway($gatewayMock);
     $action->execute($convert = new Convert($payoutModel, 'array'));
     $details = $convert->getResult();
     $this->assertNotEmpty($details);
     $this->assertEquals(['CURRENCYCODE' => 'USD', 'L_AMT0' => 1.23, 'L_NOTE0' => 'the description', 'RECEIVERTYPE' => 'UserID', 'L_RECEIVERID0' => 'theRecipientId'], $details);
 }
Example #2
0
 /**
  * @test
  */
 public function shouldAllowGetRecipientIdPreviouslySet()
 {
     $payout = new Payout();
     $payout->setRecipientId('theVal');
     $this->assertEquals('theVal', $payout->getRecipientId());
 }