You are here

function commerce_sermepa_submit_form in Commerce sermepa 7

Payment method callback: checkout form.

Parameters

array $payment_method: An array of the current settings.

array $pane_values: The current values of the pane.

array $checkout_pane: The checkout pane array. The checkout pane will be NULL if the payment is being added through the administration form.

commerce_order $order: The order object.

Return value

array A form snippet for the checkout pane.

File

./commerce_sermepa.module, line 618
Provides a payment method for Drupal Commerce using Sermepa/Redsys gateway.

Code

function commerce_sermepa_submit_form($payment_method, $pane_values, $checkout_pane, $order) {
  $form = array();
  if (!empty($payment_method['settings']['description'])) {
    $form['sermepa_description'] = array(
      '#type' => 'item',
      '#title' => t('Payment instructions'),
      '#markup' => '<p class="sermepa-description">' . $payment_method['settings']['description'] . '</p>',
    );
  }
  if (is_null($checkout_pane)) {

    // The authorisationCode must be required as it is used to check if the
    // transaction already exists.
    // @see commerce_sermepa_process_transaction();
    // @see commerce_sermepa_get_payment_transaction();
    $form['Ds_AuthorisationCode'] = array(
      '#type' => 'textfield',
      '#title' => t('Ds_AuthorisationCode'),
      '#description' => t('Assigned authorisation code.'),
      '#required' => TRUE,
    );
  }
  return $form;
}