Skip to content

Commit d705c25

Browse files
mglamanmglaman
mglaman
authored andcommitted
Issue #2870040 by mglaman: Remove payment method from order if there is a decline exception
1 parent 5ebb309 commit d705c25

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ public function buildPaneForm(array $pane_form, FormStateInterface $form_state,
118118
catch (DeclineException $e) {
119119
$message = $this->t('We encountered an error processing your payment method. Please verify your details and try again.');
120120
drupal_set_message($message, 'error');
121+
$this->order->get('payment_gateway')->setValue(NULL);
122+
$this->order->get('payment_method')->setValue(NULL);
121123
$this->redirectToPreviousStep();
122124
}
123125
catch (PaymentGatewayException $e) {

0 commit comments

Comments
 (0)