ECSHOP 农行 支付 PHP B2C 接口 API

<?php
/**
 * ECSHOP 农行在线插件
 * $Author: zzz

 */

if (!defined('IN_ECS'))
{
    die('Hacking attempt');
}

$payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/abcbank.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']    = abcbank_desc;

    /* 是否支持货到付款 */
    $modules[$i]['is_cod']  = '0';

    /* 是否支持在线支付 */
    $modules[$i]['is_online']  = '1';

    /* 支付费用 */
    $modules[$i]['pay_fee'] = '0';

    /* 作者 */
    $modules[$i]['author']  = 'ecshop';

    /* 网址 */
    $modules[$i]['website'] = 'http://www.baidu.com/';

    /* 版本号 */
    $modules[$i]['version'] = 'V1.0';

    /* 配置信息 */
    $modules[$i]['config'] = array(
    array('name' => 'merchantNo', 'type' => 'text', 'value' => ''),//商户代码
	//array('name' => 'merAcct', 'type' => 'text', 'value' => ''),//商户帐号
	//array('name' => 'curType', 'type' => 'text', 'value' => ''),//支付币种
    );

    return;
}

/**
 * 类
 */
class abcbank
{
    /**
     * 构造函数
     *
     * @access  public
     * @param
     *
     * @return void
     */
    function abcbank()
    {
    }

    function __construct()
    {
        $this->abcbank();
    }

    /**
     * 生成支付代码
     * @param   array   $order      订单信息
     * @param   array   $payment    支付方式信息
     */
    function get_code($order, $payment)
    {   
        if (!defined('EC_CHARSET'))
        {
            $charset = 'utf-8';
        }
        else
        {
            $charset = EC_CHARSET;
        }
        
        $tOrderNo    = $order['order_id'];//$order['order_sn'];                         /*订单编号*/
        $tOrderDesc = 'Game Card Order';                           /*订单说明*/
        $tOrderDate = date("Y/m/d", $order['add_time']);           /*订单日期*/
        $tOrderTime = date("h:i:s", $order['add_time']);           /*订单时间*/
        $tOrderAmountStr = $order['order_amount'];//sprintf("%012d",$order['order_amount']);                  /*订单金额*/
        $tOrderURL ='http://localhost:8080/huahui/MerchantPayment/MerchantQueryOrder.php?OrderNo=ON200306300001&QueryType=1';                   /*订单查询网址*/
        $tProductType = '0202';                                        /*商品种类*/
        $tPaymentType ='A';                                         /*支付类型*/
        $tpaymentlinktype ='1';                                     /*接入类型*/
        $tnotifytype = '0';                                         /*通知方式*/
        $tresultnotifyurl ='http://localhost:8080/huahui/MerchantPayment/MerchantResult.php';                                               /*支付结果地址*/
        $tMerchantRemarks = 'Hi!';                                  /*商家备注*/
        $tTotalCount = '1';                                         /*订单数量*/
        $tproductid = "160605";                                     /*商品ID*/
        $tproductname= "HTC s710e";                                 /*商品名称*/
        $tuniteprice ="0.01";                                       /*商品单价*/
        $tqty        ="1";                                          /*购买数量*/
        

        $def_url  = '<br /><form style="text-align:center;" method=post action="MerchantPayment/MerchantPayment.php">';
        $def_url .= "<input type=HIDDEN name='OrderNo' value='". $tOrderNo."'>";
        $def_url .= "<input type=HIDDEN name='OrderDesc' value='". $tOrderDesc."'>";
        $def_url .= "<input type=HIDDEN name='OrderDate' value='".$tOrderDate."'>";
        $def_url .= "<input type=HIDDEN name='OrderTime'  value='".$tOrderTime."'>";
        $def_url .= "<input type=HIDDEN name='OrderAmount'  value='".$tOrderAmountStr."'>";
        $def_url .= "<input type=HIDDEN name='OrderURL' value='".$tOrderURL."'>";
        $def_url .= "<input type=HIDDEN name='ProductType' value='".$tProductType."'>";
        $def_url .= "<input type=HIDDEN name='PaymentType' value='".$tPaymentType."'>";
        $def_url .= "<input type=HIDDEN name='PaymentLinkType' value='".$tpaymentlinktype."'>";
        $def_url .= "<input type=HIDDEN name='NotifyType' value='".$tnotifytype."'>";
        $def_url .= "<input type=HIDDEN name='ResultNotifyURL' value='".$tresultnotifyurl."'>";
        $def_url .= "<input type=HIDDEN name='MerchantRemarks' value='".$tMerchantRemarks."'>";
        $def_url .= "<input type=HIDDEN name='TotalCount' value='".$tTotalCount."'>";
        $def_url .= "<input type=HIDDEN name='productid[]' value='".$tproductid."'>";
        $def_url .= "<input type=HIDDEN name='productname[]' value='".$tproductname."'>";
        $def_url .= "<input type=HIDDEN name='uniteprice[]' value='".$tuniteprice."'>";
        $def_url .= "<input type=HIDDEN name='qty[]' value='".$tqty."'>";
        $def_url .= "<input type=submit value='" .$GLOBALS['_LANG']['pay_button']. "'>";
        $def_url .= "</form>";
        
         return $def_url;
    }

    /**
     * 响应操作
     */
    function respond()
    {
    }
}
   ?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值