Skip to content

Commit

Permalink
Fixing an issue with new payment status after paypal payment performi…
Browse files Browse the repository at this point in the history
…ng and redirecting back to paypal.
  • Loading branch information
tumbochka committed Dec 16, 2015
1 parent ff957a4 commit da13bb8
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Action/PaymentDetailsStatusAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
18 changes: 18 additions & 0 deletions Tests/Action/PaymentDetailsStatusActionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit da13bb8

Please sign in to comment.