|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Kaylyu\Alipay\F2fpay\Base\Model\Builder; |
|
4
|
|
|
|
|
5
|
|
|
class AlipayTradePayContentBuilder extends ContentBuilder |
|
6
|
|
|
{ |
|
7
|
|
|
//支付场景码,此处为条码支付bar_code |
|
8
|
|
|
private $scene; |
|
9
|
|
|
|
|
10
|
|
|
//支付授权码,用户支付宝钱包app点击"付款",在条码下对应的一串数字 |
|
11
|
|
|
private $authCode; |
|
12
|
|
|
|
|
13
|
|
|
// 商户网站订单系统中唯一订单号,64个字符以内,只能包含字母、数字、下划线, |
|
14
|
|
|
// 需保证商户系统端不能重复,建议通过数据库sequence生成, |
|
15
|
|
|
private $outTradeNo; |
|
16
|
|
|
|
|
17
|
|
|
// 卖家支付宝账号ID,用于支持一个签约账号下支持打款到不同的收款账号,(打款到sellerId对应的支付宝账号) |
|
18
|
|
|
// 如果该字段为空,则默认为与支付宝签约的商户的PID,也就是appid对应的PID |
|
19
|
|
|
private $sellerId; |
|
20
|
|
|
|
|
21
|
|
|
// 订单总金额,整形,此处单位为元,精确到小数点后2位,不能超过1亿元 |
|
22
|
|
|
// 如果同时传入了【打折金额】,【不可打折金额】,【订单总金额】三者,则必须满足如下条件:【订单总金额】=【打折金额】+【不可打折金额】 |
|
23
|
|
|
private $totalAmount; |
|
24
|
|
|
|
|
25
|
|
|
// 订单可打折金额,此处单位为元,精确到小数点后2位 |
|
26
|
|
|
// 可以配合商家平台配置折扣活动,如果订单部分商品参与打折,可以将部分商品总价填写至此字段,默认全部商品可打折 |
|
27
|
|
|
// 如果该值未传入,但传入了【订单总金额】,【不可打折金额】 则该值默认为【订单总金额】- 【不可打折金额】 |
|
28
|
|
|
private $discountableAmount; |
|
29
|
|
|
|
|
30
|
|
|
// 订单不可打折金额,此处单位为元,精确到小数点后2位,可以配合商家平台配置折扣活动,如果酒水不参与打折,则将对应金额填写至此字段 |
|
31
|
|
|
// 如果该值未传入,但传入了【订单总金额】,【打折金额】,则该值默认为【订单总金额】-【打折金额】 |
|
32
|
|
|
private $undiscountableAmount; |
|
33
|
|
|
|
|
34
|
|
|
// 订单标题,粗略描述用户的支付目的。如“XX品牌XXX门店消费” |
|
35
|
|
|
private $subject; |
|
36
|
|
|
|
|
37
|
|
|
// 订单描述,可以对交易或商品进行一个详细地描述,比如填写"购买商品2件共15.00元" |
|
38
|
|
|
private $body; |
|
39
|
|
|
|
|
40
|
|
|
// 商品明细列表,需填写购买商品详细信息, |
|
41
|
|
|
private $goodsDetailList = array(); |
|
42
|
|
|
|
|
43
|
|
|
// 商户操作员编号,添加此参数可以为商户操作员做销售统 |
|
44
|
|
|
private $operatorId; |
|
45
|
|
|
|
|
46
|
|
|
// 商户门店编号,通过门店号和商家后台可以配置精准到门店的折扣信息,详询支付宝技术支持 |
|
47
|
|
|
private $storeId; |
|
48
|
|
|
|
|
49
|
|
|
// 支付宝商家平台中配置的商户门店号,详询支付宝技术支持 |
|
50
|
|
|
private $alipayStoreId; |
|
51
|
|
|
|
|
52
|
|
|
// 商户机具终端编号,当以机具方式接入支付宝时必传,详询支付宝技术支持 |
|
53
|
|
|
private $terminalId; |
|
54
|
|
|
|
|
55
|
|
|
// 业务扩展参数,目前可添加由支付宝分配的系统商编号(通过setSysServiceProviderId方法),详情请咨询支付宝技术支持 |
|
56
|
|
|
private $extendParams = array(); |
|
57
|
|
|
|
|
58
|
|
|
// (推荐使用,相对时间) 支付超时时间,5m 5分钟 |
|
59
|
|
|
private $timeExpress; |
|
60
|
|
|
|
|
61
|
|
|
private $bizContent = NULL; |
|
62
|
|
|
|
|
63
|
|
|
private $bizParas = array(); |
|
64
|
|
|
|
|
65
|
|
|
|
|
66
|
|
|
public function __construct() |
|
67
|
|
|
{ |
|
68
|
|
|
$this->bizParas['scene'] = "bar_code"; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function AlipayTradePayContentBuilder() |
|
72
|
|
|
{ |
|
73
|
|
|
$this->__construct(); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
public function getBizContent() |
|
77
|
|
|
{ |
|
78
|
|
|
/*$this->bizContent = "{"; |
|
79
|
|
|
foreach ($this->bizParas as $k=>$v){ |
|
80
|
|
|
$this->bizContent.= "\"".$k."\":\"".$v."\","; |
|
81
|
|
|
} |
|
82
|
|
|
$this->bizContent = substr($this->bizContent,0,-1); |
|
83
|
|
|
$this->bizContent.= "}";*/ |
|
84
|
|
|
if(!empty($this->bizParas)){ |
|
85
|
|
|
$this->bizContent = json_encode($this->bizParas,JSON_UNESCAPED_UNICODE); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
return $this->bizContent; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
|
|
public function getAuthCode() |
|
92
|
|
|
{ |
|
93
|
|
|
return $this->authCode; |
|
94
|
|
|
} |
|
95
|
|
|
|
|
96
|
|
|
public function setAuthCode($authCode) |
|
97
|
|
|
{ |
|
98
|
|
|
$this->authCode = $authCode; |
|
99
|
|
|
$this->bizParas['auth_code'] = $authCode; |
|
100
|
|
|
} |
|
101
|
|
|
|
|
102
|
|
|
public function setOutTradeNo($outTradeNo) |
|
103
|
|
|
{ |
|
104
|
|
|
$this->outTradeNo = $outTradeNo; |
|
105
|
|
|
$this->bizParas['out_trade_no'] = $outTradeNo; |
|
106
|
|
|
} |
|
107
|
|
|
public function getOutTradeNo() |
|
108
|
|
|
{ |
|
109
|
|
|
return $this->outTradeNo; |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
public function setSellerId($sellerId) |
|
113
|
|
|
{ |
|
114
|
|
|
$this->sellerId = $sellerId; |
|
115
|
|
|
$this->bizParas['seller_id'] = $sellerId; |
|
116
|
|
|
} |
|
117
|
|
|
|
|
118
|
|
|
public function getSellerId() |
|
119
|
|
|
{ |
|
120
|
|
|
return $this->sellerId; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
public function setTotalAmount($totalAmount) |
|
124
|
|
|
{ |
|
125
|
|
|
$this->totalAmount = $totalAmount; |
|
126
|
|
|
$this->bizParas['total_amount'] = $totalAmount; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
public function getTotalAmount() |
|
130
|
|
|
{ |
|
131
|
|
|
return $this->totalAmount; |
|
132
|
|
|
} |
|
133
|
|
|
|
|
134
|
|
|
public function setDiscountableAmount($discountableAmount) |
|
135
|
|
|
{ |
|
136
|
|
|
$this->discountableAmount = $discountableAmount; |
|
137
|
|
|
$this->bizParas['discountable_amount'] = $discountableAmount; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
public function getDiscountableAmount() |
|
141
|
|
|
{ |
|
142
|
|
|
return $this->discountableAmount; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
public function setUndiscountableAmount($undiscountableAmount) |
|
146
|
|
|
{ |
|
147
|
|
|
$this->undiscountableAmount = $undiscountableAmount; |
|
148
|
|
|
$this->bizParas['undiscountable_amount'] = $undiscountableAmount; |
|
149
|
|
|
} |
|
150
|
|
|
|
|
151
|
|
|
public function getUndiscountableAmount() |
|
152
|
|
|
{ |
|
153
|
|
|
return $this->undiscountableAmount; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
public function setSubject($subject) |
|
157
|
|
|
{ |
|
158
|
|
|
$this->subject = $subject; |
|
159
|
|
|
$this->bizParas['subject'] = $subject; |
|
160
|
|
|
} |
|
161
|
|
|
|
|
162
|
|
|
public function getSubject() |
|
163
|
|
|
{ |
|
164
|
|
|
return $this->subject; |
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
public function setBody($body) |
|
168
|
|
|
{ |
|
169
|
|
|
$this->body = $body; |
|
170
|
|
|
$this->bizParas['body'] = $body; |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
public function getBody() |
|
174
|
|
|
{ |
|
175
|
|
|
return $this->body; |
|
176
|
|
|
} |
|
177
|
|
|
|
|
178
|
|
|
public function setOperatorId($operatorId) |
|
179
|
|
|
{ |
|
180
|
|
|
$this->operatorId = $operatorId; |
|
181
|
|
|
$this->bizParas['operator_id'] = $operatorId; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
public function getOperatorId() |
|
185
|
|
|
{ |
|
186
|
|
|
return $this->operatorId; |
|
187
|
|
|
} |
|
188
|
|
|
|
|
189
|
|
|
public function setStoreId($storeId) |
|
190
|
|
|
{ |
|
191
|
|
|
$this->storeId = $storeId; |
|
192
|
|
|
$this->bizParas['store_id'] = $storeId; |
|
193
|
|
|
} |
|
194
|
|
|
|
|
195
|
|
|
public function getStoreId() |
|
196
|
|
|
{ |
|
197
|
|
|
return $this->storeId; |
|
198
|
|
|
} |
|
199
|
|
|
|
|
200
|
|
|
public function setTerminalId($terminalId) |
|
201
|
|
|
{ |
|
202
|
|
|
$this->terminalId = $terminalId; |
|
203
|
|
|
$this->bizParas['terminal_id'] = $terminalId; |
|
204
|
|
|
} |
|
205
|
|
|
|
|
206
|
|
|
public function getTerminalId() |
|
207
|
|
|
{ |
|
208
|
|
|
return $this->terminalId; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
public function setTimeExpress($timeExpress) |
|
212
|
|
|
{ |
|
213
|
|
|
$this->timeExpress = $timeExpress; |
|
214
|
|
|
$this->bizParas['timeout_express'] = $timeExpress; |
|
215
|
|
|
} |
|
216
|
|
|
|
|
217
|
|
|
public function getTimeExpress() |
|
218
|
|
|
{ |
|
219
|
|
|
return $this->timeExpress; |
|
220
|
|
|
} |
|
221
|
|
|
|
|
222
|
|
|
public function getAlipayStoreId() |
|
223
|
|
|
{ |
|
224
|
|
|
return $this->alipayStoreId; |
|
225
|
|
|
} |
|
226
|
|
|
|
|
227
|
|
|
|
|
228
|
|
|
public function setAlipayStoreId($alipayStoreId) |
|
229
|
|
|
{ |
|
230
|
|
|
$this->alipayStoreId = $alipayStoreId; |
|
231
|
|
|
$this->bizParas['alipay_store_id'] = $alipayStoreId; |
|
232
|
|
|
} |
|
233
|
|
|
|
|
234
|
|
|
public function getExtendParams() |
|
235
|
|
|
{ |
|
236
|
|
|
return $this->extendParams; |
|
237
|
|
|
} |
|
238
|
|
|
|
|
239
|
|
|
public function setExtendParams($extendParams) |
|
240
|
|
|
{ |
|
241
|
|
|
$this->extendParams = $extendParams; |
|
242
|
|
|
$this->bizParas['extend_params'] = $extendParams; |
|
243
|
|
|
} |
|
244
|
|
|
|
|
245
|
|
|
public function getGoodsDetailList() |
|
246
|
|
|
{ |
|
247
|
|
|
return $this->goodsDetailList; |
|
248
|
|
|
} |
|
249
|
|
|
|
|
250
|
|
|
public function setGoodsDetailList($goodsDetailList) |
|
251
|
|
|
{ |
|
252
|
|
|
$this->goodsDetailList = $goodsDetailList; |
|
253
|
|
|
$this->bizParas['goods_detail'] = $goodsDetailList; |
|
254
|
|
|
} |
|
255
|
|
|
|
|
256
|
|
|
} |