You are here

public function WorldpayRedirect::submitConfigurationForm in Commerce Worldpay 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Commerce/PaymentGateway/WorldpayRedirect.php \Drupal\commerce_worldpay\Plugin\Commerce\PaymentGateway\WorldpayRedirect::submitConfigurationForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides PaymentGatewayBase::submitConfigurationForm

File

src/Plugin/Commerce/PaymentGateway/WorldpayRedirect.php, line 393

Class

WorldpayRedirect
Provides the Worldpay Redirect payment gateway.

Namespace

Drupal\commerce_worldpay\Plugin\Commerce\PaymentGateway

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  parent::submitConfigurationForm($form, $form_state);
  if (!$form_state
    ->getErrors()) {
    $values = $form_state
      ->getValue($form['#parents']);
    $this->configuration['installation_id'] = $values['installation_id'];
    $this->configuration['debug'] = $values['debug'];
    $this->configuration['confirmed_setup'] = $values['help_text']['confirmed_setup'];
    $this->configuration['site_id'] = $values['site_id'];
    $this->configuration['payment_parameters']['test_mode'] = $values['payment_parameters']['test_mode'];
    $this->configuration['payment_parameters']['test_result'] = $values['payment_parameters']['test_result'];
    $this->configuration['payment_security']['password'] = $values['payment_security']['password'];
    $this->configuration['payment_security']['md5_salt'] = $values['payment_security']['md5_salt'];
    $this->configuration['payment_urls']['live'] = $values['payment_urls']['live'];
    $this->configuration['payment_urls']['test'] = $values['payment_urls']['test'];
    $this->configuration['payment_urls']['use_ssl'] = $values['payment_urls']['use_ssl'];
    $this->configuration['payment_urls']['force_non_ssl_links'] = $values['payment_urls']['force_non_ssl_links'];
  }
}