You are here

function commerce_cop_submit_form in Commerce Custom Offline Payments 7

Payment method callback: checkout form.

File

./commerce_cop.module, line 277
Custom offline payment methods for Drupal Commerce.

Code

function commerce_cop_submit_form($payment_method, $pane_values, $checkout_pane, $order) {
  $form = array();
  $payment_info = NULL;
  if (!empty($payment_method['settings']['information'])) {
    $payment_info = check_markup($payment_method['settings']['information']['value'], $payment_method['settings']['information']['format']);
  }
  else {
    $payment = custom_offline_payment_load($payment_method['method_id']);
    if ($payment && !empty($payment['information'])) {
      $payment_info = $payment['information'];
    }
  }
  if ($payment_info) {

    // Run token replacement.
    $payment_info = token_replace($payment_info, array(
      'commerce_order' => $order,
    ), array(
      'language' => $GLOBALS['language'],
      'clear' => TRUE,
    ));
    $form['commerce_cop_info'] = array(
      '#markup' => $payment_info,
    );
  }

  // Need to create a dummy value to solve http://drupal.org/node/1230666
  // Probably an issue in the main commerce module
  $form['transaction'] = array(
    '#type' => 'hidden',
    '#value' => 'dummy_value',
  );
  return $form;
}