You are here

function _save_cc_data_to_order in Ubercart 6.2

Same name and namespace in other branches
  1. 5 payment/uc_credit/uc_credit.module \_save_cc_data_to_order()

Saves a CC data array to an order's data array.

2 calls to _save_cc_data_to_order()
uc_credit_order in payment/uc_credit/uc_credit.module
Implements hook_order().
uc_credit_terminal_form_submit in payment/uc_credit/uc_credit.admin.inc
Submit handler for credit terminal form.

File

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

Code

function _save_cc_data_to_order($cc_data, $order_id) {
  $crypt = new uc_encryption_class();

  // Load up the existing data array.
  $data = db_result(db_query("SELECT data FROM {uc_orders} WHERE order_id = %d", $order_id));
  $data = unserialize($data);

  // Stuff the serialized and encrypted CC details into the array.
  $data['cc_data'] = $crypt
    ->encrypt(uc_credit_encryption_key(), base64_encode(serialize($cc_data)));
  uc_store_encryption_errors($crypt, 'uc_credit');

  // Save it again.
  db_query("UPDATE {uc_orders} SET data = '%s' WHERE order_id = %d", serialize($data), $order_id);
}