You are here

function uc_cybersource_update_1 in Ubercart 5

File

payment/uc_cybersource/uc_cybersource.install, line 13
Handles installing, uninstalling, and updating CyberSource settings.

Code

function uc_cybersource_update_1() {

  // Change the variable used to define the default transaction type.
  if (variable_get('uc_cybersource_transaction_type', 'sale') == 'sale') {
    variable_set('uc_pg_cybersource_cc_txn_type', UC_CREDIT_AUTH_CAPTURE);
  }
  else {
    variable_set('uc_pg_cybersource_cc_txn_type', UC_CREDIT_AUTH_ONLY);
  }
  variable_del('uc_cybersource_transaction_type');

  // Convert the old subscription IDs to the new ones.
  $result = db_query("SELECT order_id, data FROM {uc_orders} WHERE data LIKE '%%cybersource%%soap%%'");
  while ($row = db_fetch_array($result)) {
    $data = unserialize($row['data']);
    uc_credit_log_reference($row['order_id'], $data['uc_cybersource']['soap']['subscription_id'], 'XXXX');
  }
  return array();
}