You are here

public function StripeGateway::cartProcess in Ubercart Stripe 8.2

Same name and namespace in other branches
  1. 8.3 src/Plugin/Ubercart/PaymentMethod/StripeGateway.php \Drupal\uc_stripe\Plugin\Ubercart\PaymentMethod\StripeGateway::cartProcess()

Called when checkout is submitted with this payment method selected.

Use this method to process any form elements output by the cartDetails() method.

Parameters

\Drupal\uc_order\OrderInterface $order: The order which is being processed.

array $form: The checkout form array.

\Drupal\Core\Form\FormStateInterface $form_state: The checkout form state array.

Return value

bool Return FALSE to abort the checkout process, or any other value to continue the checkout process.

Overrides CreditCardPaymentMethodBase::cartProcess

File

src/Plugin/Ubercart/PaymentMethod/StripeGateway.php, line 183

Class

StripeGateway
Stripe Ubercart gateway payment method.

Namespace

Drupal\uc_stripe\Plugin\Ubercart\PaymentMethod

Code

public function cartProcess(OrderInterface $order, array $form, FormStateInterface $form_state) {
  $stripe_token_val = $form_state
    ->getValue([
    'panes',
    'payment',
    'details',
    'stripe_token',
  ]);
  if (!empty($stripe_token_val)) {
    \Drupal::service('user.private_tempstore')
      ->get('uc_stripe')
      ->set('uc_stripe_token', $stripe_token_val);
  }
  return parent::cartProcess($order, $form, $form_state);

  // TODO: Change the autogenerated stub
}