You are here

function uc_credit_log_authorization in Ubercart 7.3

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

Stores a credit card authorization to an order's data array.

Parameters

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

string $auth_id: The payment service's ID for the authorization.

float $amount: The amount that was authorized on the card.

Return value

array The entire updated data array for the order.

3 calls to uc_credit_log_authorization()
uc_paypal_wpp_charge in payment/uc_paypal/uc_paypal.module
Processes a credit card payment through Website Payments Pro.
_uc_authorizenet_charge in payment/uc_authorizenet/uc_authorizenet.module
Handles authorizations and captures through AIM at Authorize.net.
_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 1043
Defines the credit card payment method and hooks in payment gateways.

Code

function uc_credit_log_authorization($order_id, $auth_id, $amount) {

  // 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);

  // Add the authorization to the cc_txns.
  $data['cc_txns']['authorizations'][$auth_id] = array(
    'amount' => $amount,
    'authorized' => 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;
}