function uc_credit_log_reference in Ubercart 8.4
Same name and namespace in other branches
- 5 payment/uc_credit/uc_credit.module \uc_credit_log_reference()
- 6.2 payment/uc_credit/uc_credit.module \uc_credit_log_reference()
- 7.3 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.
1 call 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.
File
- payment/
uc_credit/ uc_credit.module, line 298 - 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.
$connection = \Drupal::database();
$data = $connection
->query("SELECT data FROM {uc_orders} WHERE order_id = :id", [
':id' => $order_id,
])
->fetchField();
$data = unserialize($data);
$data['cc_txns']['references'][$ref_id] = [
'card' => substr($cc_number, -4),
'created' => \Drupal::time()
->getRequestTime(),
];
// Save the updated data array to the database.
$connection
->update('uc_orders')
->fields([
'data' => serialize($data),
])
->condition('order_id', $order_id)
->execute();
return $data;
}