From d705c25522c18d58704f85aad8ef0fce6ac6a44a Mon Sep 17 00:00:00 2001 From: mglaman Date: Mon, 17 Apr 2017 16:19:05 -0500 Subject: [PATCH] Issue #2870040 by mglaman: Remove payment method from order if there is a decline exception --- .../payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php b/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php index b9d3bc0098..9fee06a599 100644 --- a/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php +++ b/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php @@ -118,6 +118,8 @@ public function buildPaneForm(array $pane_form, FormStateInterface $form_state, catch (DeclineException $e) { $message = $this->t('We encountered an error processing your payment method. Please verify your details and try again.'); drupal_set_message($message, 'error'); + $this->order->get('payment_gateway')->setValue(NULL); + $this->order->get('payment_method')->setValue(NULL); $this->redirectToPreviousStep(); } catch (PaymentGatewayException $e) {