Skip to content

Commit

Permalink
Merge pull request #33 from satispay/dev
Browse files Browse the repository at this point in the history
Improved order management with PENDING and CANCELLED payments
  • Loading branch information
keeara authored Mar 25, 2024
2 parents d3bdc4c + 6223b2a commit 92a672b
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Controller/Redirect/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,25 @@ public function execute()
return;
}
if ($satispayPayment->status == 'PENDING') {
$this->messageManager->addWarningMessage(__('Payment is pending.'));

$satispayCancel = \SatispayGBusiness\Payment::update($paymentId, [
'action' => 'CANCEL',
]);


if ($satispayCancel->status === 'CANCELED') {
$order->registerCancellation(__('Payment has been cancelled.'));
$this->orderRepository->save($order);
$this->checkoutSession->restoreQuote();
} else {
$this->messageManager->addWarningMessage(__('Payment is pending.'));
}

$this->_redirect('checkout/cart');

return;
}

$order->registerCancellation(__('Payment has been cancelled.'));
$this->orderRepository->save($order);
$this->checkoutSession->restoreQuote();
Expand Down

0 comments on commit 92a672b

Please sign in to comment.