You are here

protected function PaymentMethodAddForm::submitCreditCardForm in Commerce Core 8.2

Handles the submission of the credit card form.

Parameters

array $element: The credit card form element.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the complete form.

1 call to PaymentMethodAddForm::submitCreditCardForm()
PaymentMethodAddForm::submitConfigurationForm in modules/payment/src/PluginForm/PaymentMethodAddForm.php
Form submission handler.

File

modules/payment/src/PluginForm/PaymentMethodAddForm.php, line 209

Class

PaymentMethodAddForm

Namespace

Drupal\commerce_payment\PluginForm

Code

protected function submitCreditCardForm(array $element, FormStateInterface $form_state) {
  $values = $form_state
    ->getValue($element['#parents']);
  $this->entity->card_type = $values['type'];
  $this->entity->card_number = substr($values['number'], -4);
  $this->entity->card_exp_month = $values['expiration']['month'];
  $this->entity->card_exp_year = $values['expiration']['year'];
}