File tree Expand file tree Collapse file tree 3 files changed +23
-1
lines changed
Controller/Express/AbstractExpress Expand file tree Collapse file tree 3 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,9 @@ protected function _processPaypalApiError($exception)
141
141
case ApiProcessableException::API_DO_EXPRESS_CHECKOUT_FAIL :
142
142
$ this ->_redirectSameToken ();
143
143
break ;
144
+ case ApiProcessableException::API_ADDRESS_MATCH_FAIL :
145
+ $ this ->_redirectToOrderReviewPageAndShowError ($ exception ->getUserMessage ());
146
+ break ;
144
147
case ApiProcessableException::API_UNABLE_TRANSACTION_COMPLETE :
145
148
if ($ this ->_config ->getPaymentAction () == \Magento \Payment \Model \Method \AbstractMethod::ACTION_ORDER ) {
146
149
$ paypalTransactionData = $ this ->_getCheckoutSession ()->getPaypalTransactionData ();
@@ -182,6 +185,18 @@ protected function _redirectToCartAndShowError($errorMessage)
182
185
$ this ->_redirect ('checkout/cart ' );
183
186
}
184
187
188
+ /**
189
+ * Redirect customer to the paypal order review page and show error message
190
+ *
191
+ * @param string $errorMessage
192
+ * @return void
193
+ */
194
+ protected function _redirectToOrderReviewPageAndShowError ($ errorMessage )
195
+ {
196
+ $ this ->messageManager ->addErrorMessage ($ errorMessage );
197
+ $ this ->_redirect ('*/*/review ' );
198
+ }
199
+
185
200
/**
186
201
* Return true if agreements validation required
187
202
*
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ class ProcessableException extends LocalizedException
25
25
const API_COUNTRY_FILTER_DECLINE = 10537 ;
26
26
const API_MAXIMUM_AMOUNT_FILTER_DECLINE = 10538 ;
27
27
const API_OTHER_FILTER_DECLINE = 10539 ;
28
+ const API_ADDRESS_MATCH_FAIL = 10736 ;
28
29
/**#@-*/
29
30
30
31
/**
@@ -61,8 +62,13 @@ public function getUserMessage()
61
62
'I \'m sorry - but we are not able to complete your transaction. Please contact us so we can assist you. '
62
63
);
63
64
break ;
65
+ case self ::API_ADDRESS_MATCH_FAIL :
66
+ $ message = __ (
67
+ 'A match of the Shipping Address City, State, and Postal Code failed. '
68
+ );
69
+ break ;
64
70
default :
65
- $ message = __ ($ this -> getMessage () );
71
+ $ message = __ (' We can \' t place the order. ' );
66
72
break ;
67
73
}
68
74
return $ message ;
Original file line number Diff line number Diff line change @@ -266,6 +266,7 @@ protected function _setApiProcessableErrors()
266
266
ApiProcessableException::API_COUNTRY_FILTER_DECLINE ,
267
267
ApiProcessableException::API_MAXIMUM_AMOUNT_FILTER_DECLINE ,
268
268
ApiProcessableException::API_OTHER_FILTER_DECLINE ,
269
+ ApiProcessableException::API_ADDRESS_MATCH_FAIL ,
269
270
]
270
271
);
271
272
}
You can’t perform that action at this time.
0 commit comments