/** * @test */ public function shouldNotOverwriteAlreadySetExtraDetails() { $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->setRecipientEmail('theRecipientEmail'); $payoutModel->setCurrencyCode('USD'); $payoutModel->setTotalAmount(123); $payoutModel->setDescription('the description'); $payoutModel->setDetails(['foo' => 'fooVal']); $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' => 'EmailAddress', 'L_EMAIL0' => 'theRecipientEmail', 'foo' => 'fooVal'], $details); }
/** * @test */ public function shouldAllowGetRecipientEmailPreviouslySet() { $payout = new Payout(); $payout->setRecipientEmail('theVal'); $this->assertEquals('theVal', $payout->getRecipientEmail()); }