You are here

function uc_credit_log_reference in Ubercart 7.3

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

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

Parameters

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

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

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

Return value

array The entire updated data array for the order.

2 calls to uc_credit_log_reference()
_uc_authorizenet_cim_profile_create in payment/uc_authorizenet/uc_authorizenet.module
Creates a CIM profile using an order's data.
_uc_cybersource_soap_charge in payment/uc_cybersource/uc_cybersource.module
Handles the SOAP charge request and Ubercart order save.

File

payment/uc_credit/uc_credit.module, line 1112
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_query("SELECT data FROM {uc_orders} WHERE order_id = :id", array(
    ':id' => $order_id,
  ))
    ->fetchField();
  $data = unserialize($data);
  $data['cc_txns']['references'][$ref_id] = array(
    'card' => substr($cc_number, -4),
    'created' => REQUEST_TIME,
  );

  // Save the updated data array to the database.
  db_update('uc_orders')
    ->fields(array(
    'data' => serialize($data),
  ))
    ->condition('order_id', $order_id)
    ->execute();
  return $data;
}