uc_authorizenet.install in Ubercart 5
Same filename and directory in other branches
Handles installing, uninstalling, and updating Authorize.net settings.
File
payment/uc_authorizenet/uc_authorizenet.installView source
<?php
/**
* @file
* Handles installing, uninstalling, and updating Authorize.net settings.
*/
function uc_authorizenet_uninstall() {
// Delete related variables all at once.
db_query("DELETE FROM {variable} WHERE name LIKE 'uc_authnet_%%'");
}
function uc_authorizenet_update_1() {
// Update variable values to the new names that match the API documentation.
variable_set('uc_authnet_api_login_id', variable_get('authnet_aim_login_id', ''));
variable_del('authnet_aim_login_id');
variable_set('uc_authnet_api_transaction_key', variable_get('authnet_aim_transaction_key', ''));
variable_del('authnet_aim_transaction_key');
$mode = variable_get('authnet_aim_transaction_mode', 'live_test');
if ($mode == 'production') {
$mode = 'live';
}
elseif ($mode == 'test') {
$mode = 'developer_test';
}
variable_set('uc_authnet_aim_txn_mode', $mode);
variable_del('authnet_aim_transaction_mode');
if (variable_get('authnet_aim_transaction_type', 'capture') == 'capture') {
variable_set('uc_authnet_aim_txn_type', 'AUTH_CAPTURE');
}
else {
variable_set('uc_authnet_aim_txn_type', 'AUTH_ONLY');
}
variable_del('authnet_aim_transaction_type');
variable_del('authnet_aim_delimiter');
if (variable_get('authnet_aim_customer_notification', 'FALSE') == 'TRUE') {
variable_set('uc_authnet_aim_customer_email', TRUE);
}
variable_del('authnet_aim_customer_notification');
variable_del('authnet_aim_merchant_notification');
return array();
}
function uc_authorizenet_update_2() {
// Change the variable used to define the default transaction type.
if (variable_get('uc_authnet_aim_txn_type', 'AUTH_CAPTURE') == 'AUTH_CAPTURE') {
variable_set('uc_pg_authorizenet_cc_txn_type', UC_CREDIT_AUTH_CAPTURE);
}
else {
variable_set('uc_pg_authorizenet_cc_txn_type', UC_CREDIT_AUTH_ONLY);
}
variable_del('uc_authnet_aim_txn_type');
return array();
}
function uc_authorizenet_update_3() {
// Update the name of the CIM transaction mode variable.
variable_set('uc_authnet_cim_mode', variable_get('uc_authnet_cim_server', 'disabled'));
variable_del('uc_authet_cim_server');
return array();
}
Functions
Name | Description |
---|---|
uc_authorizenet_uninstall | @file Handles installing, uninstalling, and updating Authorize.net settings. |
uc_authorizenet_update_1 | |
uc_authorizenet_update_2 | |
uc_authorizenet_update_3 |