@@ -668,6 +668,9 @@ protected function redirectFailure()
668
668
{
669
669
$ store = $ this ->order ->getStore ();
670
670
$ this ->logger ->addDebug ('start redirectFailure ' );
671
+ if ($ this ->hasPostData ('add_service_action_from_magento ' , 'payfastcheckout ' )) {
672
+ return $ this ->handleProcessedResponse ('checkout/cart ' );
673
+ }
671
674
if ($ this ->accountConfig ->getFailureRedirectToCheckout ($ store )) {
672
675
$ this ->logger ->addDebug ('getFailureRedirectToCheckout ' );
673
676
if (!$ this ->customerSession ->isLoggedIn () && ($ this ->order ->getCustomerId () > 0 )) {
@@ -676,7 +679,6 @@ protected function redirectFailure()
676
679
try {
677
680
$ customer = $ this ->customerRepository ->getById ($ this ->order ->getCustomerId ());
678
681
$ this ->customerSession ->setCustomerDataAsLoggedIn ($ customer );
679
-
680
682
if (!$ this ->checkoutSession ->getLastRealOrderId () && $ this ->order ->getIncrementId ()) {
681
683
$ this ->checkoutSession ->setLastRealOrderId ($ this ->order ->getIncrementId ());
682
684
$ this ->logger ->addDebug (__METHOD__ . '|setLastRealOrderId| ' );
@@ -693,15 +695,7 @@ protected function redirectFailure()
693
695
$ this ->logger ->addDebug ('ready for redirect ' );
694
696
return $ this ->handleProcessedResponse ('checkout ' , ['_fragment ' => 'payment ' , '_query ' => ['bk_e ' => 1 ]]);
695
697
}
696
-
697
- /**
698
- * @noinspection PhpUndefinedMethodInspection
699
- */
700
- if ($ this ->hasPostData ('add_service_action_from_magento ' , 'payfastcheckout ' )) {
701
- $ url = 'checkout/cart ' ;
702
- } else {
703
- $ url = $ this ->accountConfig ->getFailureRedirect ($ store );
704
- }
698
+ $ url = $ this ->accountConfig ->getFailureRedirect ($ store );
705
699
return $ this ->handleProcessedResponse ($ url );
706
700
}
707
701
0 commit comments