📄 chinabank.php
字号:
<?php
class chinabank {
var $code, $title, $description, $enabled;
// class constructor
function chinabank() {
global $order;
$this->code = 'chinabank';
$this->title = MODULE_PAYMENT_CHINABANK_TEXT_TITLE;
$this->description = MODULE_PAYMENT_CHINABANK_TEXT_DESCRIPTION;
$this->sort_order = MODULE_PAYMENT_CHINABANK_SORT_ORDER;
$this->enabled = ((MODULE_PAYMENT_CHINABANK_STATUS == 'True') ? true : false);
if ((int)MODULE_PAYMENT_CHINABANK_ORDER_STATUS_ID > 0) {
$this->order_status = MODULE_PAYMENT_CHINABANK_ORDER_STATUS_ID;
}
if (is_object($order)) $this->update_status();
$this->form_action_url = 'https://pay.chinaebank.cn/customer/gb/payment.jsp';
}
// class methods
function update_status() {
global $order;
if ( ($this->enabled == true) && ((int)MODULE_PAYMENT_CHINABANK_ZONE > 0) ) {
$check_flag = false;
$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_PAYMENT_PAYPAL_ZONE . "' and zone_country_id = '" . $order->billing['country']['id'] . "' order by zone_id");
while ($check = tep_db_fetch_array($check_query)) {
if ($check['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check['zone_id'] == $order->billing['zone_id']) {
$check_flag = true;
break;
}
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
function javascript_validation() {
return false;
}
function selection() {
return array('id' => $this->code,
'module' => $this->title);
}
function pre_confirmation_check() {
return false;
}
function confirmation() {
return false;
}
function process_button() {
global $order, $currencies, $currency;
if (MODULE_PAYMENT_CHINABANK_CURRENCY == 'Selected Currency') {
$my_currency = $currency;
} else {
$my_currency = substr(MODULE_PAYMENT_CHINABANK_CURRENCY, 5);
}
if (!in_array($my_currency, array('0', '1'))) {
$my_currency = '0';
}
$v_amount=number_format(($order->info['total'] - $order->info['shipping_cost']) * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency));
$v_moneytype=$my_currency;
$v_oid=date("ymd",time()).'-'.MODULE_PAYMENT_CHINABANK_ID.'-'.time();
$v_mid=MODULE_PAYMENT_CHINABANK_ID;
$v_url=tep_href_link('checkout_process.php', '', 'SSL');
$process_button_string = '<input name="v_rcvname" value="'.$order->customer['firstname'].'" type="hidden">'. //收货人姓名
'<input name="v_rcvaddr" value="'.$order->customer['state'].$order->customer['city'].'" type="hidden">'. //收货人地址
'<input name="v_rcvtel" value="'.$order->customer['tel_regular'].'" type="hidden">'. //收货人电话
//tep_draw_hidden_field('business', MODULE_PAYMENT_PAYPAL_ID) .
'<input name="item_name" value="'.STORE_NAME.'" type="hidden">'.
'<input name="v_amount" value="'.$v_amount.'" type="hidden">'. // 订单总金额
//tep_draw_hidden_field('shipping', number_format($order->info['shipping_cost'] * $currencies->get_value($my_currency), $currencies->get_decimal_places($my_currency))) . // 订单总金额
'<input name="v_moneytype" value="'.$v_moneytype.'" type="hidden">'. //币种
'<input name="v_oid" value="'.date("ymd",time()).MODULE_PAYMENT_CHINABANK_ID.time().'" type="hidden">'. // 订单编号
'<input name="v_mid" value="'.MODULE_PAYMENT_CHINABANK_ID.'" type="hidden">'. //商户编号
'<input name="v_url" value="'.tep_href_link('checkout_process.php', '', 'SSL').'" type="hidden">'.//支付动作完成后返回到该url,支付结果以GET方式发送
'<input name="v_md5info" value="'.$v_amount.$v_moneytype.$v_oid.$v_mid.$v_url.MODULE_PAYMENT_CHINABANK_KEY.'" type="hidden">'; //订单MD5校验码
return $process_button_string;
}
function before_process() {
return false;
}
function after_process() {
return false;
}
function output_error() {
return false;
}
function check() {
global $db, $table_configuration;
if (!isset($this->_check)) {
$check_query = $db->query("select configuration_value from $table_configuration where configuration_key = 'MODULE_PAYMENT_CHINABANK_STATUS'");
$this->_check = $db->num_rows($check_query);
}
return $this->_check;
}
function install() {
global $db, $table_configuration;
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('是否支持网银在线付款模块', 'MODULE_PAYMENT_CHINABANK_STATUS', 'True', '你是否接受网银支付付款方式?', '6', '3', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('商户编号值', 'MODULE_PAYMENT_CHINABANK_ID', '1001', '网银在线公司提供给您的商户编号值', '6', '4', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('密钥值', 'MODULE_PAYMENT_CHINABANK_KEY', '123456', '网银在线公司提供给您的密钥值', '6', '4', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('交易货币', 'MODULE_PAYMENT_CHINABANK_CURRENCY', '选择货币', '信用卡交易使用的货币', '6', '6', 'tep_cfg_select_option(array(\'选择货币\',\'只用美元\',\'只用人民币\'), ', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('排列顺序', 'MODULE_PAYMENT_CHINABANK_SORT_ORDER', '0', '越小越靠前', '6', '0', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('支付区域', 'MODULE_PAYMENT_CHINABANK_ZONE', '0', '如果选择了一个区域,那么这种支付方式只支持这个区域.', '6', '2', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
$db->query("insert into $table_configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('确定订购状况', 'MODULE_PAYMENT_CHINABANK_ORDER_STATUS_ID', '0', '设定这种支付方式的定购状态值', '6', '0', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())");
}
function remove() {
global $db, $table_configuration;
$db->query("delete from $table_configuration where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
return array('MODULE_PAYMENT_CHINABANK_STATUS', 'MODULE_PAYMENT_CHINABANK_ID','MODULE_PAYMENT_CHINABANK_KEY', 'MODULE_PAYMENT_CHINABANK_CURRENCY', 'MODULE_PAYMENT_CHINABANK_ZONE', 'MODULE_PAYMENT_CHINABANK_ORDER_STATUS_ID', 'MODULE_PAYMENT_CHINABANK_SORT_ORDER');
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -