You are here

function commerce_worldpay_bg_txn_save in Commerce Worldpay 7

Saves information on the Worldpay transaction with some meta data related to local processing.

Parameters

$wp_tx: The values to write to the table in an array format of col => value.

Return value

The operation performed by drupal_write_record() on save; since $wp_tx is received by reference, it will also contain the serial numeric txn_id used locally.

1 call to commerce_worldpay_bg_txn_save()
commerce_worldpay_bg_response_page in includes/commerce_worldpay_bg.page.inc
Page callback that listens for transaction information from WorldPay.

File

./commerce_worldpay_bg.module, line 993
Provides a Worldpay Business Gateway payment method for Drupal Commerce.

Code

function commerce_worldpay_bg_txn_save(&$wp_tx) {
  if (!empty($wp_tx['txn_id']) && commerce_worldpay_bg_txn_load($wp_tx['wp_txn_id'])) {
    $wp_tx['changed'] = REQUEST_TIME;
    return drupal_write_record('commerce_worldpay_bg_txn', $wp_tx, 'txn_id');
  }
  else {
    $wp_tx['created'] = REQUEST_TIME;
    $wp_tx['changed'] = REQUEST_TIME;
    return drupal_write_record('commerce_worldpay_bg_txn', $wp_tx);
  }
}