AliwapService.php 1.55 KB
<?php

namespace Plugin\Pay\aliwap\v303;

/**
 * 支付宝手机网页支付
 */
class AliwapService
{

    var $config;
    var $alipay_config;

    public function __construct()
    {
        $this->config = require(dirname(__FILE__) . '/AliwapConfig.php');
        
        require_once(dirname(__FILE__) . '/lib/alipay_submit.class.php');
    }

    /**
     * 构造请求参数
     * @see QPay_Utils_Interface::getPayRequestPars()
     */
    public function getResponse($params)
    {
        $this->config['cacert'] = dirname(__FILE__) . '/cacert.pem';

        //构造要请求的参数数组,无需改动
        $parameter = array(
            "service" => 'alipay.wap.create.direct.pay.by.user',
            "partner" => $this->config['partner'],
            "seller_id" => $this->config['seller_id'],
            "payment_type" => $this->config['payment_type'],
            "notify_url" => $this->config['notify_url'],
            "return_url" => $this->config['return_url'],
            "out_trade_no" => date('Ymdhis') . $params['orderCode'],
            "subject" => 'yoho order:' . $params['orderCode'],
            "total_fee" => $params['totalFee'],
            "show_url" => $params['showUrl'],
            "body" => '有货订单号:' . $params['orderCode'],
            "it_b_pay" => $params['payExpire'],
            "_input_charset" => $this->config['input_charset'],
        );

        //建立请求
        $alipaySubmit = new \AlipaySubmit($this->config);
        $para = $alipaySubmit->buildRequestHttp($parameter);
        var_dump($para);
    }

}