Skip to content

Commit

Permalink
add sleep for when it comes back to capture to handle slow notify fro…
Browse files Browse the repository at this point in the history
…m payone
  • Loading branch information
smaier committed May 10, 2019
1 parent ff44892 commit 020d3c1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions Action/AbstractPurchaseAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Payum\Core\Exception\RequestNotSupportedException;
use Payum\Core\GatewayAwareInterface;
use Payum\Core\GatewayAwareTrait;
use Payum\Core\Reply\HttpRedirect;
use Payum\Core\Request\Authorize;
use Payum\Core\Request\Capture;
use Payum\Core\Request\Generic;
Expand Down Expand Up @@ -56,16 +57,25 @@ public final function execute($request)
return;
}

if ($model['param']) {
sleep(5);

throw new HttpRedirect($request->getToken()->getAfterUrl());
}

$model['completed_status'] = $this->getCompletedStatus();

// there might be a more beautiful way
$afterUrl = $request->getToken()->getAfterUrl();
if(strpos($afterUrl,'?')>0){
if(strpos($afterUrl,'?=')>0){
$seperatorChar = '&';
} else {
$seperatorChar = '?';
}

$model['redirect'] = [
'success' => $afterUrl,
'error' => $afterUrl . $seperatorChar .'canceled=1',
'success' => $request->getToken()->getTargetUrl(),
'error' => $afterUrl. $seperatorChar .'canceled=1',
'back' => $afterUrl . $seperatorChar .'canceled=1',
];

Expand Down

0 comments on commit 020d3c1

Please sign in to comment.