You are here

function uc_credit_log_reference in Ubercart 5

Same name and namespace in other branches
  1. 8.4 payment/uc_credit/uc_credit.module \uc_credit_log_reference()
  2. 6.2 payment/uc_credit/uc_credit.module \uc_credit_log_reference()
  3. 7.3 payment/uc_credit/uc_credit.module \uc_credit_log_reference()

Logs a credit card reference to an order's data array.

Parameters

$order_id: The order associated with the credit card details.

$ref_id: The payment service's ID for the reference that may be used to charge the same credit card at a later date.

$cc_number: The credit card number associated with this reference. Only the last 4 digits will be stored.

Return value

The entire updated data array for the order.

3 calls to uc_credit_log_reference()
uc_cybersource_update_1 in payment/uc_cybersource/uc_cybersource.install
_uc_authorizenet_cim_profile_create in payment/uc_authorizenet/uc_authorizenet.module
Create a CIM profile using an order's data.
_uc_cybersource_soap_charge in payment/uc_cybersource/uc_cybersource.module

File

payment/uc_credit/uc_credit.module, line 1954
Defines the credit card payment method and hooks in payment gateways.

Code

function uc_credit_log_reference($order_id, $ref_id, $cc_number) {

  // Load the existing order data array.
  $data = db_result(db_query("SELECT data FROM {uc_orders} WHERE order_id = %d", $order_id));
  $data = unserialize($data);
  $data['cc_txns']['references'][$ref_id] = array(
    'card' => substr($cc_number, -4),
    'created' => time(),
  );

  // Save the updated data array to the database.
  db_query("UPDATE {uc_orders} SET data = '%s' WHERE order_id = %d", serialize($data), $order_id);
  return $data;
}