Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #2870040 by mglaman: Remove payment method from order if there … #719

Open
wants to merge 3 commits into
base: 8.x-2.x
Choose a base branch
from

Conversation

mglaman
Copy link
Contributor

@mglaman mglaman commented Apr 17, 2017

…is a decline exception

@bojanz bojanz force-pushed the 8.x-2.x branch 5 times, most recently from 1028fc1 to 005e904 Compare April 21, 2017 19:23
@mglaman mglaman force-pushed the 2870040-decline-order-payment-method branch from 69a6f15 to a0d6592 Compare April 23, 2017 09:18
@mglaman
Copy link
Contributor Author

mglaman commented Apr 23, 2017

The test failures have to do with orders which have have payment gateway reference but no payment method.

@mglaman mglaman force-pushed the 2870040-decline-order-payment-method branch from a0d6592 to d705c25 Compare April 23, 2017 09:37
@@ -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);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bojanz If we do not remove this.. then the chain of logic here fails, which is another bug. Not sure if I should fix here or not.

    $default_option = NULL;
    if ($order_payment_method) {
      $default_option = $order_payment_method->id();
    }
    elseif ($order_payment_gateway && !($order_payment_gateway instanceof SupportsStoredPaymentMethodsInterface)) {
      $default_option = $order_payment_gateway->id();
    }

Returns payment gateway... which is not a method.

    $selected_option = $pane_form['payment_method'][$default_option];
    $payment_gateway = $payment_gateways[$selected_option['#payment_gateway']];
    if ($payment_gateway->getPlugin() instanceof SupportsStoredPaymentMethodsInterface) {

This supports no reconciliation for the fact we have a gateway ID. So I suppose the thing to do is remove returning gateway ID?

# Conflicts:
#	modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentProcess.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant