// class constructor
function CS() {
global $order;
$this->code = 'cs';
$this->title = MODULE_PAYMENT_CS_TEXT_TITLE;
$this->description = MODULE_PAYMENT_CS_TEXT_DESCRIPTION;
$this->enabled = ((MODULE_PAYMENT_CS_STATUS == 'True') ? true : false);
$this->sort_order = MODULE_PAYMENT_CS_SORT_ORDER;
if ((int)MODULE_PAYMENT_CS_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_CS_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
$url = explode('/',$_SERVER['PHP_SELF']);
if( strcmp($url[2],'admin') != 0 ) {
// Make sure that your HOP.php file is located in your store's root
// directory, i.e., /store/ or /catalog/ etc.
//include_once("HOP.php");
include_once(DIR_FS_CATALOG. DIR_WS_MODULES . 'payment/cybersource/HOP.php');
}
// The line below is the production line.
$this->form_action_url = 'https://orderpage.ic3.com/hop/ProcessOrder.do';
// The line below is for debugging and doesn't process the order or
// return a status. It halts on CyberSource's checker script to show you
// the data being received and if it's valid.
//$this->form_action_url = 'https://orderpage.ic3.com/hop/CheckOrderData.do';
}
// class methods
function update_status() {
global $order, $db;
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_CS_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_CS_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}