wanglizhong
2025-05-05 9b8a7157bb9c401de973a4107f74ff3e723ec156
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
/* *
 * 功能:支付宝手机网站支付接口(alipay.trade.wap.pay)接口业务参数封装
 * 版本:2.0
 * 修改日期:2016-11-01
 * 说明:
 * 以下代码只是为了方便商户测试而提供的样例代码,商户可以根据自己网站的需要,按照技术文档编写,并非一定要使用该代码。
 */
 
 
class AlipayTradeWapPayContentBuilder
{
 
    // 订单描述,可以对交易或商品进行一个详细地描述,比如填写"购买商品2件共15.00元"
    private $body;
 
    // 订单标题,粗略描述用户的支付目的。
    private $subject;
 
    // 商户订单号.
    private $outTradeNo;
 
    // (推荐使用,相对时间) 支付超时时间,5m 5分钟
    private $timeExpress;
 
    // 订单总金额,整形,此处单位为元,精确到小数点后2位,不能超过1亿元
    private $totalAmount;
 
    // 如果该字段为空,则默认为与支付宝签约的商户的PID,也就是appid对应的PID
    private $sellerId;
 
    // 产品标示码,固定值:QUICK_WAP_PAY
    private $productCode;
 
    private $bizContentarr = array();
 
    private $bizContent = NULL;
 
    public function getBizContent()
    {
        if(!empty($this->bizContentarr)){
            $this->bizContent = json_encode($this->bizContentarr,JSON_UNESCAPED_UNICODE);
        }
        return $this->bizContent;
    }
 
    public function __construct()
    {
        $this->bizContentarr['productCode'] = "QUICK_WAP_PAY";
    }
 
    public function AlipayTradeWapPayContentBuilder()
    {
        $this->__construct();
    }
 
    public function getBody()
    {
        return $this->body;
    }
 
    public function setBody($body)
    {
        $this->body = $body;
        $this->bizContentarr['body'] = $body;
    }
 
    public function setSubject($subject)
    {
        $this->subject = $subject;
        $this->bizContentarr['subject'] = $subject;
    }
 
    public function getSubject()
    {
        return $this->subject;
    }
 
    public function getOutTradeNo()
    {
        return $this->outTradeNo;
    }
 
    public function setOutTradeNo($outTradeNo)
    {
        $this->outTradeNo = $outTradeNo;
        $this->bizContentarr['out_trade_no'] = $outTradeNo;
    }
 
    public function setTimeExpress($timeExpress)
    {
        $this->timeExpress = $timeExpress;
        $this->bizContentarr['timeout_express'] = $timeExpress;
    }
 
    public function getTimeExpress()
    {
        return $this->timeExpress;
    }
 
    public function setTotalAmount($totalAmount)
    {
        $this->totalAmount = $totalAmount;
        $this->bizContentarr['total_amount'] = $totalAmount;
    }
 
    public function getTotalAmount()
    {
        return $this->totalAmount;
    }
 
    public function setSellerId($sellerId)
    {
        $this->sellerId = $sellerId;
        $this->bizContentarr['seller_id'] = $sellerId;
    }
 
    public function getSellerId()
    {
        return $this->sellerId;
    }
}
 
?>