<?php
if (!defined('IN_ECS'))
{
die('Hacking attempt');
}
$payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/icbc.php';
if (file_exists($payment_lang))
{
global $_LANG;
include_once($payment_lang);
}
/**
* 模块信息
*/
if (isset($set_modules) && $set_modules == true)
{
$i = isset($modules) ? count($modules) : 0;
/* 代码 */
$modules[$i]['code'] = basename(__FILE__, '.php');
/* 描述对应的语言项 */
$modules[$i]['desc'] = 'icbc_desc';
/* 是否支持货到付款 */
$modules[$i]['is_cod'] = '0'; //否
/* 是否支持在线支付 */
$modules[$i]['is_online'] = '1'; //是
/* 作者 */
$modules[$i]['author'] = 'ec';
/* 网址 */
$modules[$i]['website'] = 'http://www.baidu.com';
/* 版本号 */
$modules[$i]['version'] = '1.0.0.11';
/* 配置信息 */
$modules[$i]['config'] = array(
array('name' => 'merID', 'type' => 'text', 'value' => ''),//商户代码
array('name' => 'merAcct', 'type' => 'text', 'value' => ''),//商户帐号
array('name' => 'curType', 'type' => 'text', 'value' => ''),//支付币种
);
return;
}
class icbc
{
/**
* 构造函数
*
* @access public
* @param
*
* @return void
*/
function icbc()
{
}
function __construct()
{
$this->icbc();
}
/**
* 生成支付代码
* @param array $order 订单信息
* @param array $payment 支付方式信息
*/
function get_code($order, $payment)
{
//构造参数
$a_parameter = array(
//公共证书地址
'cert_public_file' => ROOT_PATH."includes/modules/payment/icbc/ebb2cpublic.crt",
//私有证书地址
'cert_private_file' => ROOT_PATH."includes/modules/payment/icbc/th2.crt",
//私钥地址
'cert_key_file' => ROOT_PATH."includes/modules/payment/icbc/th2.key",
//接口名称
'interfaceName' => 'ICBC_PERBANK_B2C',
//接口版本
'interfaceVersion' => '1.0.0.11',
//商城代码
'merID' => $payment['merID'],
//商户帐号
'merAcct' => $payment['merAcct'],
// 支持订单支付的银行卡种类 0表示仅允许使用借记卡支付,1表示仅允许使用信用卡支付,2表示借记卡和信用卡都能对订单进行支付
'creditType' => 2,
//HS方式实时发送通知 AG方式不发送通知
'notifyType' => 'HS',
//订单号
'orderid' => $order['order_sn'],
//金额以分为单位
'amount' => number_format($order['order_amount'], 2, '.', '') * 100,
//币种目前只支持人民币,代码为001
'curType' => '001',
//对于HS方式 0: 发送成功或者失败信息 1: 只发送交易成功信息
'resultType' => 0,
工商银行支付接口 B2C PHP ecshop
最新推荐文章于 2022-08-06 00:33:55 发布