You are here

function commerce_authnet_aim_submit_form in Commerce Authorize.Net 7

Payment method callback: checkout form.

File

./commerce_authnet.module, line 336
Implements Authorize.Net payment services for use in Drupal Commerce.

Code

function commerce_authnet_aim_submit_form($payment_method, $pane_values, $checkout_pane, $order) {
  module_load_include('inc', 'commerce_payment', 'includes/commerce_payment.credit_card');

  // Prepare the fields to include on the credit card form.
  $fields = array(
    'code' => '',
  );

  // Add the credit card types array if necessary.
  if (isset($payment_method['settings']['card_types'])) {
    $card_types = array_diff(array_values($payment_method['settings']['card_types']), array(
      0,
    ));
    if (!empty($card_types)) {
      $fields['type'] = $card_types;
    }
  }
  return commerce_payment_credit_card_form($fields);
}