diff -Nuar a/vendor/magento/module-paypal/Controller/Express/AbstractExpress/PlaceOrder.php b/vendor/magento/module-paypal/Controller/Express/AbstractExpress/PlaceOrder.php index 055af4162d5..23348765888 100644 --- a/vendor/magento/module-paypal/Controller/Express/AbstractExpress/PlaceOrder.php +++ b/vendor/magento/module-paypal/Controller/Express/AbstractExpress/PlaceOrder.php @@ -173,6 +173,7 @@ class PlaceOrder extends \Magento\Paypal\Controller\Express\AbstractExpress $this->_redirectSameToken(); break; case ApiProcessableException::API_ADDRESS_MATCH_FAIL: + case ApiProcessableException::API_TRANSACTION_HAS_BEEN_COMPLETED: $this->redirectToOrderReviewPageAndShowError($exception->getUserMessage()); break; case ApiProcessableException::API_UNABLE_TRANSACTION_COMPLETE: diff -Nuar a/vendor/magento/module-paypal/Model/Api/Nvp.php b/vendor/magento/module-paypal/Model/Api/Nvp.php index 2d45bf488b6..0ddb135d1a1 100644 --- a/vendor/magento/module-paypal/Model/Api/Nvp.php +++ b/vendor/magento/module-paypal/Model/Api/Nvp.php @@ -1285,16 +1285,7 @@ class Nvp extends \Magento\Paypal\Model\Api\AbstractApi isset($response['VERSION']) ? $response['VERSION'] : '' ); $this->_logger->critical($exceptionLogMessage); - - /** - * The response code 10415 'Transaction has already been completed for this token' - * must not fails place order. The old Paypal interface does not lock 'Send' button - * it may result to re-send data. - */ - if (in_array((string)ProcessableException::API_TRANSACTION_HAS_BEEN_COMPLETED, $this->_callErrors)) { - return; - } - + $exceptionPhrase = __('PayPal gateway has rejected request. %1', $errorMessages); /** @var \Magento\Framework\Exception\LocalizedException $exception */ diff -Nuar a/vendor/magento/module-paypal/Model/Api/ProcessableException.php b/vendor/magento/module-paypal/Model/Api/ProcessableException.php index 40ee6d98c43..12a11ff4424 100644 --- a/vendor/magento/module-paypal/Model/Api/ProcessableException.php +++ b/vendor/magento/module-paypal/Model/Api/ProcessableException.php @@ -67,6 +67,12 @@ class ProcessableException extends LocalizedException . ' Please contact us so we can assist you.' ); break; + case self::API_TRANSACTION_HAS_BEEN_COMPLETED: + $message = __( + 'A successful payment transaction has already been completed.' + . ' Please, check if the order has been placed.' + ); + break; case self::API_ADDRESS_MATCH_FAIL: $message = __( 'A match of the Shipping Address City, State, and Postal Code failed.' diff -Nuar a/vendor/magento/module-paypal/Model/Express.php b/vendor/magento/module-paypal/Model/Express.php index 946c0fd4c66..39b1c6f7e3c 100644 --- a/vendor/magento/module-paypal/Model/Express.php +++ b/vendor/magento/module-paypal/Model/Express.php @@ -276,6 +276,7 @@ class Express extends \Magento\Payment\Model\Method\AbstractMethod ApiProcessableException::API_MAXIMUM_AMOUNT_FILTER_DECLINE, ApiProcessableException::API_OTHER_FILTER_DECLINE, ApiProcessableException::API_ADDRESS_MATCH_FAIL, + ApiProcessableException::API_TRANSACTION_HAS_BEEN_COMPLETED, self::$authorizationExpiredCode ] );