You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!$this->quoteRecreate->recreate($this->quote, $this->response)) {
521
537
$this->logger->addError('Could not recreate the quote.');
@@ -534,7 +550,7 @@ protected function handleFailed($statusCode)
534
550
$this->helper->getStatusCode('BUCKAROO_MAGENTO2_ORDER_FAILED') => 'Unfortunately an error occurred while processing your payment. Please try again. If this error persists, please choose a different payment method.',
535
551
$this->helper->getStatusCode('BUCKAROO_MAGENTO2_STATUSCODE_FAILED') => 'Unfortunately an error occurred while processing your payment. Please try again. If this error persists, please choose a different payment method.',
536
552
$this->helper->getStatusCode('BUCKAROO_MAGENTO2_STATUSCODE_REJECTED') => 'Unfortunately an error occurred while processing your payment. Please try again. If this error persists, please choose a different payment method.',
537
-
$this->helper->getStatusCode('BUCKAROO_MAGENTO2_STATUSCODE_CANCELLED_BY_USER') => 'According to our system, you have canceled the payment. If this is not the case, please contact us.'
553
+
$this->helper->getStatusCode('BUCKAROO_MAGENTO2_STATUSCODE_CANCELLED_BY_USER') => 'Payment cancelled. You can try again using the same or a different payment method.',
538
554
];
539
555
540
556
$this->addErrorMessage(__($statusCodeAddErrorMessage[$statusCode] ?? 'An error occurred while processing your payment.'));
@@ -544,12 +560,45 @@ protected function handleFailed($statusCode)
544
560
return$this->redirectFailure();
545
561
}
546
562
547
-
// Cancel the order and log an error if it fails
548
-
if (!$this->cancelOrder($statusCode, $statusCodeAddErrorMessage[$statusCode])) {
549
-
$this->logger->addError('Could not cancel the order.');
563
+
// For browser back button, check configuration
564
+
if ($isBrowserBack && !$shouldCancelOnBrowserBack) {
565
+
$this->logger->addDebug(sprintf(
566
+
'%s - Browser Back Button Detected - Order left in pending state (config: cancel_on_browser_back = disabled). Quote recreated for retry. Order: %s',
567
+
__METHOD__,
568
+
$this->order->getIncrementId()
569
+
));
570
+
571
+
// Add a status history comment to track this
572
+
$this->order->addCommentToStatusHistory(
573
+
__('Customer returned using browser back button. Order left pending for push notification.'),
574
+
false,
575
+
false
576
+
);
577
+
$this->order->save();
578
+
579
+
} else {
580
+
// For actual failures OR if config says to cancel on browser back, cancel the order as before
581
+
if ($isBrowserBack) {
582
+
$this->logger->addDebug(sprintf(
583
+
'%s - Browser Back Button Detected - Order will be canceled (config: cancel_on_browser_back = enabled). Order: %s',
584
+
__METHOD__,
585
+
$this->order->getIncrementId()
586
+
));
587
+
}
588
+
589
+
if (!$this->cancelOrder($statusCode, $statusCodeAddErrorMessage[$statusCode])) {
590
+
$this->logger->addError('Could not cancel the order.');
0 commit comments