You are here

public function PaymentReferenceElement::submitForm in Payment 8.2

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

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

Overrides FormInterface::submitForm

File

modules/payment_reference_test/src/PaymentReferenceElement.php, line 77

Class

PaymentReferenceElement
Provides a form for testing the payment_reference element.

Namespace

Drupal\payment_reference_test

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $payment_id = $form['payment_reference']['#value'];
  $acquisition_code = PaymentReference::queue()
    ->claimPayment($payment_id);
  if ($acquisition_code && PaymentReference::queue()
    ->acquirePayment($payment_id, $acquisition_code)) {
    \Drupal::state()
      ->set('payment_reference_test_payment_reference_element', $payment_id);
  }
}