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