You are here

function _save_cc_data_to_order in Ubercart 5

Same name and namespace in other branches
  1. 6.2 payment/uc_credit/uc_credit.module \_save_cc_data_to_order()
3 calls to _save_cc_data_to_order()
uc_credit_encrypt_existing in payment/uc_credit/uc_credit.module
uc_credit_order in payment/uc_credit/uc_credit.module
Implementation of hook_order().
uc_credit_terminal_form_submit in payment/uc_credit/uc_credit.module

File

payment/uc_credit/uc_credit.module, line 1795
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(), 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);
}