You are here

function commerce_cop_transaction in Commerce Custom Offline Payments 7

Creates a cheque payment transaction for the specified charge amount.

Parameters

$transaction: The transaction instance object.

$payment_method: The payment method instance object used to charge this payment.

$order: The order object the payment applies to.

$charge: An array indicating the amount and currency code to charge.

1 call to commerce_cop_transaction()
commerce_cop_submit_form_submit in ./commerce_cop.module
Payment method callback: checkout form submission.

File

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

Code

function commerce_cop_transaction($transaction, $payment_method, $order, $charge) {
  $transaction->instance_id = $payment_method['instance_id'];
  $transaction->amount = $charge['amount'];
  $transaction->currency_code = $charge['currency_code'];
  $transaction->status = COMMERCE_PAYMENT_STATUS_PENDING;
  $transaction->message = $payment_method['description'];
  commerce_payment_transaction_save($transaction);
}