From da13bb8af1f4873435da011b2731e45643a5580b Mon Sep 17 00:00:00 2001 From: tumbochka Date: Wed, 16 Dec 2015 16:47:27 +0200 Subject: [PATCH] Fixing an issue with new payment status after paypal payment performing and redirecting back to paypal. --- Action/PaymentDetailsStatusAction.php | 7 +++++++ .../Action/PaymentDetailsStatusActionTest.php | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/Action/PaymentDetailsStatusAction.php b/Action/PaymentDetailsStatusAction.php index c770320..f517b00 100644 --- a/Action/PaymentDetailsStatusAction.php +++ b/Action/PaymentDetailsStatusAction.php @@ -36,6 +36,13 @@ public function execute($request) } } + if ( + false == $model['PAYERID'] && + Api::CHECKOUTSTATUS_PAYMENT_ACTION_NOT_INITIATED == $model['CHECKOUTSTATUS'] + ) { + $request->markPending(); + } + if (isset($model['CANCELLED'])) { $request->markCanceled(); diff --git a/Tests/Action/PaymentDetailsStatusActionTest.php b/Tests/Action/PaymentDetailsStatusActionTest.php index dd1a097..bad2365 100644 --- a/Tests/Action/PaymentDetailsStatusActionTest.php +++ b/Tests/Action/PaymentDetailsStatusActionTest.php @@ -221,6 +221,24 @@ public function shouldMarkPendingIfCheckoutStatusInProgress() $this->assertTrue($request->isPending()); } + /** + * @test + */ + public function shouldMarkPendingIfPayerIdNotSetAndCheckoutStatusNotInitiated() + { + $action = new PaymentDetailsStatusAction(); + + $request = new GetHumanStatus(array( + 'PAYMENTREQUEST_0_AMT' => 12, + 'PAYERID' => null, + 'CHECKOUTSTATUS' => Api::CHECKOUTSTATUS_PAYMENT_ACTION_NOT_INITIATED, + )); + + $action->execute($request); + + $this->assertTrue($request->isPending()); + } + /** * @test */