You are here

function commerce_cop_submit_form_submit in Commerce Custom Offline Payments 7

Payment method callback: checkout form submission.

File

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

Code

function commerce_cop_submit_form_submit($payment_method, $pane_form, $pane_values, $order, $charge) {
  $order->data['commerce_cop'] = $pane_values;

  // Drupal Commerce Payment Transaction Fields integration.
  // If installed and payment fieldable, the payment transaction object
  // with the fields data will be available here in the pane values.
  // @see https://www.drupal.org/node/2272735
  // @see https://www.drupal.org/node/2293025
  if (is_object($pane_values['transaction'])) {
    $transaction = $pane_values['transaction'];
  }
  else {
    $transaction = commerce_payment_transaction_new($payment_method['method_id'], $order->order_id);
  }
  commerce_cop_transaction($transaction, $payment_method, $order, $charge);
}