function uc_credit_log_prior_auth_capture in Ubercart 5
Same name and namespace in other branches
- 8.4 payment/uc_credit/uc_credit.module \uc_credit_log_prior_auth_capture()
- 6.2 payment/uc_credit/uc_credit.module \uc_credit_log_prior_auth_capture()
- 7.3 payment/uc_credit/uc_credit.module \uc_credit_log_prior_auth_capture()
Logs the capture of a prior authorization to an order's data array.
Parameters
$order_id: The order associated with the credit card capture.
$auth_id: The payment service's ID for the authorization that was captured.
Return value
The entire updated data array for the order or FALSE to indicate the specified authorization was not found.
3 calls to uc_credit_log_prior_auth_capture()
- uc_paypal_wpp_charge in payment/
uc_paypal/ uc_paypal.module - _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
File
- payment/
uc_credit/ uc_credit.module, line 1921 - Defines the credit card payment method and hooks in payment gateways.
Code
function uc_credit_log_prior_auth_capture($order_id, $auth_id) {
// 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);
// Return FALSE if we can't find the authorization.
if (empty($data['cc_txns']['authorizations'][$auth_id])) {
return FALSE;
}
// Otherwise log the capture timestamp to the authorization.
$data['cc_txns']['authorizations'][$auth_id]['captured'] = 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;
}