ThinkPay 支持支付宝双接口

浏览:1954 发布日期:2015/01/10 分类:技术分享 关键字: ThinkPay 支付宝 双接口
http://git.oschina.net/yunwuxin/ThinkPay

修改了Alipay.class.php的buildRequestForm方法.支持支付宝双接口.
只是根据我的需求修改了一下并没有完善发布上来和大家分享一下...    //dualfun
    //direct
    public function buildRequestForm(\Think\Pay\PayVo $vo,$type='direct') {
        if($type=='direct'){
            $param = array(
                'service' => 'create_direct_pay_by_user',
                'payment_type' => '1',
                '_input_charset' => 'utf-8',
                'seller_email' => $this->config['email'],
                'partner' => $this->config['partner'],
                'notify_url' => $this->config['notify_url'],
                'return_url' => $this->config['return_url'],
                'out_trade_no' => $vo->getOrderNo(),
                'subject' => $vo->getTitle(),
                'body' => $vo->getBody(),
                'total_fee' => $vo->getFee()
            );
        }
        if($type=='dualfun'){
            $param = array(
                'service' => 'trade_create_by_buyer',
                'payment_type' => '1',
                '_input_charset' => 'utf-8',
                'seller_email' => $this->config['email'],
                'partner' => $this->config['partner'],
                'notify_url' => $this->config['notify_url'],
                'return_url' => $this->config['return_url'],
                'out_trade_no' => $vo->getOrderNo(),
                'subject' => $vo->getTitle(),
                'body' => $vo->getBody(),
                'price' => $vo->getFee(),
                'quantity' => "1",
                'logistics_fee' => "0.00",
                'logistics_type' => "EXPRESS",
                'logistics_payment' => "SELLER_PAY",
                'show_url'  => getPageURl(),
                'receive_name'  => "会员",
                'receive_address'   => "北京",
                'receive_zip'   => "100000",
                'receive_phone' => "010-88888888",
                'receive_mobile'    => "13800138000",
            );
        }
        ksort($param);
        reset($param);

        $arg = '';
        foreach ($param as $key => $value) {
            if ($value) {
                $arg .= "$key=$value&";
            }
        }

        $param['sign'] = md5(substr($arg, 0, -1) . $this->config['key']);
        $param['sign_type'] = 'MD5';

        $sHtml = $this->_buildForm($param, $this->gateway, 'get');

        return $sHtml;
    }
最佳答案
评论( 相关
后面还有条评论,点击查看>>