Commit 1773befd authored by Jonathan Sacksick's avatar Jonathan Sacksick Committed by Jonathan Sacksick
Browse files

Issue #3118985 by jsacksick, scottsawyer, mglaman, dwkitchen, rszrama:...

Issue #3118985 by jsacksick, scottsawyer, mglaman, dwkitchen, rszrama: Customers cannot modify billing information after adding payment method details.
parent 5a792d60
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -207,16 +207,24 @@ class PaymentInformation extends CheckoutPaneBase {
    // Store the options for submitPaneForm().
    $pane_form['#payment_options'] = $options;

    $default_payment_gateway_id = $default_option->getPaymentGatewayId();
    $payment_gateway = $payment_gateways[$default_payment_gateway_id];
    $payment_gateway_plugin = $payment_gateway->getPlugin();

    // If this is an existing payment method, return the pane form.
    // Editing payment methods at checkout is not supported.
    if ($default_option->getPaymentMethodId()) {
      $payment_method_storage = $this->entityTypeManager->getStorage('commerce_payment_method');
      /** @var \Drupal\commerce_payment\Entity\PaymentMethodInterface $payment_method */
      $payment_method = $payment_method_storage->load($default_option->getPaymentMethodId());
      // If the payment method hasn't been tokenized yet, allow updating the
      // billing information.
      if (empty($payment_method->getRemoteId()) && $payment_gateway_plugin->collectsBillingInformation()) {
        $pane_form = $this->buildBillingProfileForm($pane_form, $form_state);
      }
      return $pane_form;
    }

    $default_payment_gateway_id = $default_option->getPaymentGatewayId();
    $payment_gateway = $payment_gateways[$default_payment_gateway_id];
    $payment_gateway_plugin = $payment_gateway->getPlugin();

    // If this payment gateway plugin supports creating tokenized payment
    // methods before processing payment, we build the "add-payment-method"
    // plugin form.
+2 −0
Original line number Diff line number Diff line
@@ -140,6 +140,7 @@ class CouponRedemptionPaneTest extends CommerceWebDriverTestBase {
      'uid' => $this->adminUser->id(),
      'type' => 'credit_card',
      'payment_gateway' => 'onsite',
      'remote_id' => '123456',
      'card_type' => 'visa',
      'card_number' => '1111',
      'billing_profile' => $profile,
@@ -151,6 +152,7 @@ class CouponRedemptionPaneTest extends CommerceWebDriverTestBase {
    $payment_method2 = $this->createEntity('commerce_payment_method', [
      'type' => 'credit_card',
      'payment_gateway' => 'onsite',
      'remote_id' => '123456',
      'card_type' => 'visa',
      'card_number' => '9999',
      'billing_profile' => $profile,