|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Trait PaySetterTrait |
|
4
|
|
|
* |
|
5
|
|
|
* @link https://www.icy2003.com/ |
|
6
|
|
|
* @author icy2003 <[email protected]> |
|
7
|
|
|
* @copyright Copyright (c) 2017, icy2003 |
|
8
|
|
|
*/ |
|
9
|
|
|
namespace icy2003\php\iapis\wechat; |
|
10
|
|
|
|
|
11
|
|
|
use icy2003\php\I; |
|
12
|
|
|
use icy2003\php\ihelpers\Json; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Pay setter |
|
16
|
|
|
*/ |
|
17
|
|
|
trait PaySetterTrait |
|
18
|
|
|
{ |
|
19
|
|
|
/** |
|
20
|
|
|
* 商户号 |
|
21
|
|
|
* |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
protected $_mchId; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* 应用ID |
|
28
|
|
|
* |
|
29
|
|
|
* @var string |
|
30
|
|
|
*/ |
|
31
|
|
|
protected $_appId; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* 密钥 |
|
35
|
|
|
* |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
protected $_apiKey; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* 证书路径 |
|
42
|
|
|
* |
|
43
|
|
|
* @var string |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $_certPath; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* 设置证书路径 |
|
49
|
|
|
* |
|
50
|
|
|
* @param string $certPath |
|
51
|
|
|
* |
|
52
|
|
|
* @return static |
|
53
|
|
|
*/ |
|
54
|
|
|
public function setCertPath($certPath) |
|
55
|
|
|
{ |
|
56
|
|
|
$this->_certPath = $certPath; |
|
57
|
|
|
return $this; |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* 证书密钥路径 |
|
62
|
|
|
* |
|
63
|
|
|
* @var string |
|
64
|
|
|
*/ |
|
65
|
|
|
protected $_certKeyPath; |
|
66
|
|
|
|
|
67
|
|
|
/** |
|
68
|
|
|
* 设置证书密钥路径 |
|
69
|
|
|
* |
|
70
|
|
|
* @param string $certKeyPath |
|
71
|
|
|
* |
|
72
|
|
|
* @return static |
|
73
|
|
|
*/ |
|
74
|
|
|
public function setCertKeyPath($certKeyPath) |
|
75
|
|
|
{ |
|
76
|
|
|
$this->_certKeyPath = $certKeyPath; |
|
77
|
|
|
return $this; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* 设置设备号 |
|
82
|
|
|
* |
|
83
|
|
|
* - 终端设备号(门店号或收银设备ID),默认请传'WEB' |
|
84
|
|
|
* |
|
85
|
|
|
* @param string $deviceInfo |
|
86
|
|
|
* |
|
87
|
|
|
* @return static |
|
88
|
|
|
*/ |
|
89
|
|
|
public function setDeviceInfo($deviceInfo) |
|
90
|
|
|
{ |
|
91
|
|
|
$this->_options['device_info'] = $deviceInfo; |
|
|
|
|
|
|
92
|
|
|
return $this; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* 设置签名类型 |
|
97
|
|
|
* |
|
98
|
|
|
* - 目前支持HMAC-SHA256和MD5,默认为MD5 |
|
99
|
|
|
* |
|
100
|
|
|
* @param string $signType |
|
101
|
|
|
* |
|
102
|
|
|
* @return static |
|
103
|
|
|
*/ |
|
104
|
|
|
public function setSignType($signType = 'MD5') |
|
105
|
|
|
{ |
|
106
|
|
|
$this->_options['sign_type'] = $signType; |
|
|
|
|
|
|
107
|
|
|
return $this; |
|
108
|
|
|
} |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* 设置商品描述 |
|
112
|
|
|
* |
|
113
|
|
|
* - 商品描述交易字段格式根据不同的应用场景按照以下格式:APP——需传入应用市场上的APP名字-实际商品名称,天天爱消除-游戏充值。 |
|
114
|
|
|
* |
|
115
|
|
|
* @param string $body |
|
116
|
|
|
* |
|
117
|
|
|
* @return static |
|
118
|
|
|
*/ |
|
119
|
|
|
public function setBody($body) |
|
120
|
|
|
{ |
|
121
|
|
|
$this->_options['body'] = $body; |
|
|
|
|
|
|
122
|
|
|
return $this; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
/** |
|
126
|
|
|
* 设置商品详情 |
|
127
|
|
|
* |
|
128
|
|
|
* - 商品详细描述,对于使用单品优惠的商户,该字段必须按照规范上传 |
|
129
|
|
|
* - 详见:[单品优惠参数说明](https://pay.weixin.qq.com/wiki/doc/api/danpin.php?chapter=9_102&index=2) |
|
130
|
|
|
* |
|
131
|
|
|
* @param string $detail |
|
132
|
|
|
* |
|
133
|
|
|
* @return static |
|
134
|
|
|
*/ |
|
135
|
|
|
public function setDetail($detail) |
|
136
|
|
|
{ |
|
137
|
|
|
$this->_options['detail'] = $detail; |
|
|
|
|
|
|
138
|
|
|
return $this; |
|
139
|
|
|
} |
|
140
|
|
|
|
|
141
|
|
|
/** |
|
142
|
|
|
* 设置附加数据 |
|
143
|
|
|
* |
|
144
|
|
|
* - 附加数据,在查询API和支付通知中原样返回,该字段主要用于商户携带订单的自定义数据 |
|
145
|
|
|
* |
|
146
|
|
|
* @param string $attach |
|
147
|
|
|
* |
|
148
|
|
|
* @return static |
|
149
|
|
|
*/ |
|
150
|
|
|
public function setAttach($attach) |
|
151
|
|
|
{ |
|
152
|
|
|
$this->_options['attach'] = $attach; |
|
|
|
|
|
|
153
|
|
|
return $this; |
|
154
|
|
|
} |
|
155
|
|
|
|
|
156
|
|
|
/** |
|
157
|
|
|
* 设置商户订单号 |
|
158
|
|
|
* |
|
159
|
|
|
* - 商户系统内部订单号,要求32个字符内,只能是数字、大小写字母_-|*且在同一个商户号下唯一 |
|
160
|
|
|
* - 详见:[商户订单号](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=4_2) |
|
161
|
|
|
* |
|
162
|
|
|
* @param string $outTradeNo |
|
163
|
|
|
* |
|
164
|
|
|
* @return static |
|
165
|
|
|
*/ |
|
166
|
|
|
public function setOutTradeNo($outTradeNo) |
|
167
|
|
|
{ |
|
168
|
|
|
$this->_options['out_trade_no'] = $outTradeNo; |
|
|
|
|
|
|
169
|
|
|
return $this; |
|
170
|
|
|
} |
|
171
|
|
|
|
|
172
|
|
|
/** |
|
173
|
|
|
* 设置货币类型 |
|
174
|
|
|
* |
|
175
|
|
|
* - 符合ISO 4217标准的三位字母代码,默认人民币:CNY,其他值列表 |
|
176
|
|
|
* - 详见:[货币类型](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=4_2) |
|
177
|
|
|
* |
|
178
|
|
|
* @param string $feeType |
|
179
|
|
|
* |
|
180
|
|
|
* @return static |
|
181
|
|
|
*/ |
|
182
|
|
|
public function setFeeType($feeType = 'CNY') |
|
183
|
|
|
{ |
|
184
|
|
|
$this->_options['fee_type'] = $feeType; |
|
|
|
|
|
|
185
|
|
|
return $this; |
|
186
|
|
|
} |
|
187
|
|
|
|
|
188
|
|
|
/** |
|
189
|
|
|
* 设置总金额 |
|
190
|
|
|
* |
|
191
|
|
|
* - 订单总金额,单位为分 |
|
192
|
|
|
* - 详见:[支付金额](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=4_2) |
|
193
|
|
|
* |
|
194
|
|
|
* @param integer $totalFee |
|
195
|
|
|
* |
|
196
|
|
|
* @return static |
|
197
|
|
|
*/ |
|
198
|
|
|
public function setTotalFee($totalFee) |
|
199
|
|
|
{ |
|
200
|
|
|
$this->_options['total_fee'] = $totalFee; |
|
|
|
|
|
|
201
|
|
|
return $this; |
|
202
|
|
|
} |
|
203
|
|
|
|
|
204
|
|
|
/** |
|
205
|
|
|
* 设置交易起始时间 |
|
206
|
|
|
* |
|
207
|
|
|
* - 订单生成时间,格式为yyyyMMddHHmmss,如2009年12月25日9点10分10秒表示为20091225091010 |
|
208
|
|
|
* - 其他详见:[时间规则](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=4_2) |
|
209
|
|
|
* |
|
210
|
|
|
* @param string $timeStart |
|
211
|
|
|
* |
|
212
|
|
|
* @return static |
|
213
|
|
|
*/ |
|
214
|
|
|
public function setTimeStart($timeStart) |
|
215
|
|
|
{ |
|
216
|
|
|
$this->_options['time_start'] = $timeStart; |
|
|
|
|
|
|
217
|
|
|
return $this; |
|
218
|
|
|
} |
|
219
|
|
|
|
|
220
|
|
|
/** |
|
221
|
|
|
* 设置交易结束时间 |
|
222
|
|
|
* |
|
223
|
|
|
* - 订单失效时间,格式为yyyyMMddHHmmss,如2009年12月27日9点10分10秒表示为20091227091010 |
|
224
|
|
|
* - 订单失效时间是针对订单号而言的,由于在请求支付的时候有一个必传参数prepay_id只有两小时的有效期,所以在重入时间超过2小时的时候需要重新请求下单接口获取新的prepay_id |
|
225
|
|
|
* - 其他详见:[时间规则](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=4_2) |
|
226
|
|
|
* - 建议:最短失效时间间隔大于1分钟 |
|
227
|
|
|
* |
|
228
|
|
|
* @param string $timeExpire |
|
229
|
|
|
* |
|
230
|
|
|
* @return static |
|
231
|
|
|
*/ |
|
232
|
|
|
public function setTimeExpire($timeExpire) |
|
233
|
|
|
{ |
|
234
|
|
|
$this->_options['time_expire'] = $timeExpire; |
|
|
|
|
|
|
235
|
|
|
return $this; |
|
236
|
|
|
} |
|
237
|
|
|
|
|
238
|
|
|
/** |
|
239
|
|
|
* 设置订单优惠标记 |
|
240
|
|
|
* |
|
241
|
|
|
* - 订单优惠标记,代金券或立减优惠功能的参数 |
|
242
|
|
|
* - 说明详见:[代金券或立减优惠](https://pay.weixin.qq.com/wiki/doc/api/tools/sp_coupon.php?chapter=12_1) |
|
243
|
|
|
* |
|
244
|
|
|
* @param string $goodsTag |
|
245
|
|
|
* |
|
246
|
|
|
* @return static |
|
247
|
|
|
*/ |
|
248
|
|
|
public function setGoodsTag($goodsTag) |
|
249
|
|
|
{ |
|
250
|
|
|
$this->_options['goods_tag'] = $goodsTag; |
|
|
|
|
|
|
251
|
|
|
return $this; |
|
252
|
|
|
} |
|
253
|
|
|
|
|
254
|
|
|
/** |
|
255
|
|
|
* 设置通知地址 |
|
256
|
|
|
* |
|
257
|
|
|
* - 接收微信支付异步通知回调地址,通知url必须为直接可访问的url,不能携带参数 |
|
258
|
|
|
* |
|
259
|
|
|
* @param string $notifyUrl |
|
260
|
|
|
* |
|
261
|
|
|
* @return static |
|
262
|
|
|
*/ |
|
263
|
|
|
public function setNotifyUrl($notifyUrl) |
|
264
|
|
|
{ |
|
265
|
|
|
$this->_options['notify_url'] = $notifyUrl; |
|
|
|
|
|
|
266
|
|
|
return $this; |
|
267
|
|
|
} |
|
268
|
|
|
|
|
269
|
|
|
/** |
|
270
|
|
|
* 设置指定支付方式 |
|
271
|
|
|
* |
|
272
|
|
|
* - no_credit--指定不能使用信用卡支付 |
|
273
|
|
|
* |
|
274
|
|
|
* @param string $limitPay |
|
275
|
|
|
* |
|
276
|
|
|
* @return static |
|
277
|
|
|
*/ |
|
278
|
|
|
public function setLimitPay($limitPay) |
|
279
|
|
|
{ |
|
280
|
|
|
$this->_options['limit_pay'] = $limitPay; |
|
|
|
|
|
|
281
|
|
|
return $this; |
|
282
|
|
|
} |
|
283
|
|
|
|
|
284
|
|
|
/** |
|
285
|
|
|
* 设置开发票入口开放标识 |
|
286
|
|
|
* |
|
287
|
|
|
* - Y,传入Y时,支付成功消息和支付详情页将出现开票入口 |
|
288
|
|
|
* - 需要在微信支付商户平台或微信公众平台开通电子发票功能,传此字段才可生效 |
|
289
|
|
|
* |
|
290
|
|
|
* @param string $receipt |
|
291
|
|
|
* |
|
292
|
|
|
* @return static |
|
293
|
|
|
*/ |
|
294
|
|
|
public function setReceipt($receipt) |
|
295
|
|
|
{ |
|
296
|
|
|
$this->_options['receipt'] = $receipt; |
|
|
|
|
|
|
297
|
|
|
return $this; |
|
298
|
|
|
} |
|
299
|
|
|
|
|
300
|
|
|
/** |
|
301
|
|
|
* 设置交易类型 |
|
302
|
|
|
* |
|
303
|
|
|
* - 不同 trade_type 决定了调起支付的方式,请根据支付产品正确上传 |
|
304
|
|
|
* 1. JSAPI--JSAPI 支付(或小程序支付) |
|
305
|
|
|
* 2. NATIVE--Native 支付 |
|
306
|
|
|
* 3. APP--app 支付 |
|
307
|
|
|
* 4. MWEB--H5 支付 |
|
308
|
|
|
* 5. MICROPAY--付款码支付,付款码支付有单独的支付接口,所以接口不需要上传,该字段在对账单中会出现 |
|
309
|
|
|
* |
|
310
|
|
|
* @param string $tradeType |
|
311
|
|
|
* |
|
312
|
|
|
* @return static |
|
313
|
|
|
*/ |
|
314
|
|
|
public function setTradeType($tradeType) |
|
315
|
|
|
{ |
|
316
|
|
|
$this->_options['trade_type'] = $tradeType; |
|
|
|
|
|
|
317
|
|
|
return $this; |
|
318
|
|
|
} |
|
319
|
|
|
|
|
320
|
|
|
/** |
|
321
|
|
|
* 商品ID |
|
322
|
|
|
* |
|
323
|
|
|
* - trade_type=NATIVE时,此参数必传。此参数为二维码中包含的商品ID,商户自行定义 |
|
324
|
|
|
* |
|
325
|
|
|
* @param string $productId |
|
326
|
|
|
* |
|
327
|
|
|
* @return static |
|
328
|
|
|
*/ |
|
329
|
|
|
public function setProductId($productId) |
|
330
|
|
|
{ |
|
331
|
|
|
$this->_options['product_id'] = $productId; |
|
|
|
|
|
|
332
|
|
|
return $this; |
|
333
|
|
|
} |
|
334
|
|
|
|
|
335
|
|
|
/** |
|
336
|
|
|
* 用户标识 |
|
337
|
|
|
* |
|
338
|
|
|
* - trade_type=JSAPI时(即JSAPI支付),此参数必传,此参数为微信用户在商户对应appid下的唯一标识 |
|
339
|
|
|
* - openid如何获取,可参考【[获取openid](https://pay.weixin.qq.com/wiki/doc/api/native.php?chapter=4_4)】 |
|
340
|
|
|
* - 企业号请使用【[企业号OAuth2.0接口](https://qydev.weixin.qq.com/wiki/index.php?title=OAuth%E9%AA%8C%E8%AF%81%E6%8E%A5%E5%8F%A3)】获取企业号内成员userid,再调用【[企业号userid转openid接口](https://qydev.weixin.qq.com/wiki/index.php?title=Userid%E4%B8%8Eopenid%E4%BA%92%E6%8D%A2%E6%8E%A5%E5%8F%A3)】进行转换 |
|
341
|
|
|
* |
|
342
|
|
|
* @param string $openId |
|
343
|
|
|
* |
|
344
|
|
|
* @return static |
|
345
|
|
|
*/ |
|
346
|
|
|
public function setOpenId($openId) |
|
347
|
|
|
{ |
|
348
|
|
|
$this->_options['openid'] = $openId; |
|
|
|
|
|
|
349
|
|
|
return $this; |
|
350
|
|
|
} |
|
351
|
|
|
|
|
352
|
|
|
/** |
|
353
|
|
|
* 场景信息 |
|
354
|
|
|
* |
|
355
|
|
|
* - 该字段常用于线下活动时的场景信息上报,支持上报实际门店信息,商户也可以按需求自己上报相关信息 |
|
356
|
|
|
* - NATIVE(扫码支付)涉及字段: |
|
357
|
|
|
* - store_info: |
|
358
|
|
|
* - id:门店编号,由商户自定义 |
|
359
|
|
|
* - name:门店名称 ,由商户自定义 |
|
360
|
|
|
* - area_code:门店所在地行政区划码,详细见《[最新县及县以上行政区划代码](https://pay.weixin.qq.com/wiki/doc/api/download/store_adress.csv)》 |
|
361
|
|
|
* - address:门店详细地址 ,由商户自定义 |
|
362
|
|
|
* - MWEB(H5支付)涉及字段: |
|
363
|
|
|
* - h5_info: |
|
364
|
|
|
* - type:场景类型,如:IOS、Android、Wap |
|
365
|
|
|
* - app_name:应用名 |
|
366
|
|
|
* - package_name:安卓填,包名 |
|
367
|
|
|
* - bundle_id:IOS填,bundle_id |
|
368
|
|
|
* - wap_name:WAP网站填,WAP 网站名 |
|
369
|
|
|
* |
|
370
|
|
|
* @param array $sceneInfo |
|
371
|
|
|
* |
|
372
|
|
|
* @return static |
|
373
|
|
|
*/ |
|
374
|
|
|
public function setSceneInfo($sceneInfo) |
|
375
|
|
|
{ |
|
376
|
|
|
$this->_options['scene_info'] = Json::encode($sceneInfo); |
|
|
|
|
|
|
377
|
|
|
return $this; |
|
378
|
|
|
} |
|
379
|
|
|
|
|
380
|
|
|
/** |
|
381
|
|
|
* 设置微信订单号 |
|
382
|
|
|
* |
|
383
|
|
|
* - 微信的订单号,优先使用 |
|
384
|
|
|
* |
|
385
|
|
|
* @param string $transactionId |
|
386
|
|
|
* |
|
387
|
|
|
* @return static |
|
388
|
|
|
*/ |
|
389
|
|
|
public function setTransactionId($transactionId) |
|
390
|
|
|
{ |
|
391
|
|
|
$this->_options['transaction_id'] = $transactionId; |
|
|
|
|
|
|
392
|
|
|
return $this; |
|
393
|
|
|
} |
|
394
|
|
|
|
|
395
|
|
|
/** |
|
396
|
|
|
* 设置商户退款单号 |
|
397
|
|
|
* |
|
398
|
|
|
* - 商户系统内部的退款单号,商户系统内部唯一,只能是数字、大小写字母_-|*@ ,同一退款单号多次请求只退一笔 |
|
399
|
|
|
* - 如未设置,则和【商户订单号】一致 |
|
400
|
|
|
* |
|
401
|
|
|
* @param string $outRefundNo |
|
402
|
|
|
* |
|
403
|
|
|
* @return static |
|
404
|
|
|
*/ |
|
405
|
|
|
public function setOutRefundNo($outRefundNo = null) |
|
406
|
|
|
{ |
|
407
|
|
|
$this->_options['out_refund_no'] = null === $outRefundNo ? I::get($this->_options, 'out_trade_no') : $outRefundNo; |
|
|
|
|
|
|
408
|
|
|
return $this; |
|
409
|
|
|
} |
|
410
|
|
|
|
|
411
|
|
|
/** |
|
412
|
|
|
* 设置退款金额 |
|
413
|
|
|
* |
|
414
|
|
|
* - 退款总金额,订单总金额,单位为分,只能为整数 |
|
415
|
|
|
* - 详见[支付金额](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=4_2) |
|
416
|
|
|
* - 如未设置,则和【订单金额】一致 |
|
417
|
|
|
* |
|
418
|
|
|
* @param integer $refundFee |
|
419
|
|
|
* |
|
420
|
|
|
* @return static |
|
421
|
|
|
*/ |
|
422
|
|
|
public function setRefundFee($refundFee = null) |
|
423
|
|
|
{ |
|
424
|
|
|
$this->_options['refund_fee'] = null === $refundFee ? I::get($this->_options, 'total_fee') : $refundFee; |
|
|
|
|
|
|
425
|
|
|
return $this; |
|
426
|
|
|
} |
|
427
|
|
|
|
|
428
|
|
|
/** |
|
429
|
|
|
* 设置退款货币种类 |
|
430
|
|
|
* |
|
431
|
|
|
* - 退款货币类型,需与支付一致,或者不填 |
|
432
|
|
|
* - 符合ISO 4217标准的三位字母代码,默认人民币:CNY |
|
433
|
|
|
* - 其他值列表详见[货币类型](https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=4_2) |
|
434
|
|
|
* |
|
435
|
|
|
* @param string $refundFeeType |
|
436
|
|
|
* |
|
437
|
|
|
* @return static |
|
438
|
|
|
*/ |
|
439
|
|
|
public function setRefundFeeType($refundFeeType = 'CNY') |
|
440
|
|
|
{ |
|
441
|
|
|
$this->_options['refund_fee_type'] = $refundFeeType; |
|
|
|
|
|
|
442
|
|
|
return $this; |
|
443
|
|
|
} |
|
444
|
|
|
|
|
445
|
|
|
/** |
|
446
|
|
|
* 设置退款原因 |
|
447
|
|
|
* |
|
448
|
|
|
* - 若商户传入,会在下发给用户的退款消息中体现退款原因 |
|
449
|
|
|
* - 注意:若订单退款金额≤1元,且属于部分退款,则不会在退款消息中体现退款原因 |
|
450
|
|
|
* |
|
451
|
|
|
* @param string $refundDesc |
|
452
|
|
|
* |
|
453
|
|
|
* @return static |
|
454
|
|
|
*/ |
|
455
|
|
|
public function setRefundDesc($refundDesc) |
|
456
|
|
|
{ |
|
457
|
|
|
$this->_options['refund_desc'] = $refundDesc; |
|
|
|
|
|
|
458
|
|
|
return $this; |
|
459
|
|
|
} |
|
460
|
|
|
|
|
461
|
|
|
/** |
|
462
|
|
|
* 设置退款资金来源 |
|
463
|
|
|
* |
|
464
|
|
|
* - 仅针对老资金流商户使用: |
|
465
|
|
|
* 1. REFUND_SOURCE_UNSETTLED_FUNDS---未结算资金退款(默认使用未结算资金退款) |
|
466
|
|
|
* 2. REFUND_SOURCE_RECHARGE_FUNDS---可用余额退款 |
|
467
|
|
|
* |
|
468
|
|
|
* @param string $refundAccount |
|
469
|
|
|
* |
|
470
|
|
|
* @return static |
|
471
|
|
|
*/ |
|
472
|
|
|
public function setRefundAccount($refundAccount) |
|
473
|
|
|
{ |
|
474
|
|
|
$this->_options['refund_account'] = $refundAccount; |
|
|
|
|
|
|
475
|
|
|
return $this; |
|
476
|
|
|
} |
|
477
|
|
|
|
|
478
|
|
|
/** |
|
479
|
|
|
* 设置偏移量 |
|
480
|
|
|
* |
|
481
|
|
|
* - 查询退款:偏移量,当部分退款次数超过10次时可使用,表示返回的查询结果从这个偏移量开始取记录 |
|
482
|
|
|
* |
|
483
|
|
|
* @param integer $offset |
|
484
|
|
|
* |
|
485
|
|
|
* @return static |
|
486
|
|
|
*/ |
|
487
|
|
|
public function setOffset($offset) |
|
488
|
|
|
{ |
|
489
|
|
|
$this->_options['offset'] = $offset; |
|
|
|
|
|
|
490
|
|
|
return $this; |
|
491
|
|
|
} |
|
492
|
|
|
|
|
493
|
|
|
/** |
|
494
|
|
|
* 设置微信退款单号 |
|
495
|
|
|
* |
|
496
|
|
|
* - 微信生成的退款单号,在申请退款接口有返回 |
|
497
|
|
|
* |
|
498
|
|
|
* @param string $refundId |
|
499
|
|
|
* |
|
500
|
|
|
* @return static |
|
501
|
|
|
*/ |
|
502
|
|
|
public function setRefundId($refundId) |
|
503
|
|
|
{ |
|
504
|
|
|
$this->_options['refund_id'] = $refundId; |
|
|
|
|
|
|
505
|
|
|
return $this; |
|
506
|
|
|
} |
|
507
|
|
|
|
|
508
|
|
|
/** |
|
509
|
|
|
* 设置对账单日期 |
|
510
|
|
|
* |
|
511
|
|
|
* - 下载对账单的日期,格式:20140603 |
|
512
|
|
|
* |
|
513
|
|
|
* @param string $billDate |
|
514
|
|
|
* |
|
515
|
|
|
* @return static |
|
516
|
|
|
*/ |
|
517
|
|
|
public function setBillDate($billDate) |
|
518
|
|
|
{ |
|
519
|
|
|
$this->_options['bill_date'] = $billDate; |
|
|
|
|
|
|
520
|
|
|
return $this; |
|
521
|
|
|
} |
|
522
|
|
|
|
|
523
|
|
|
/** |
|
524
|
|
|
* 设置账单类型 |
|
525
|
|
|
* |
|
526
|
|
|
* - ALL(默认值),返回当日所有订单信息(不含充值退款订单) |
|
527
|
|
|
* - SUCCESS,返回当日成功支付的订单(不含充值退款订单) |
|
528
|
|
|
* - REFUND,返回当日退款订单(不含充值退款订单) |
|
529
|
|
|
* - RECHARGE_REFUND,返回当日充值退款订单 |
|
530
|
|
|
* |
|
531
|
|
|
* @param string $billType |
|
532
|
|
|
* |
|
533
|
|
|
* @return static |
|
534
|
|
|
*/ |
|
535
|
|
|
public function setBillType($billType = 'ALL') |
|
536
|
|
|
{ |
|
537
|
|
|
$this->_options['bill_type'] = $billType; |
|
|
|
|
|
|
538
|
|
|
return $this; |
|
539
|
|
|
} |
|
540
|
|
|
|
|
541
|
|
|
/** |
|
542
|
|
|
* 压缩账单 |
|
543
|
|
|
* |
|
544
|
|
|
* - 非必传参数,固定值:GZIP,返回格式为.gzip的压缩包账单。不传则默认为数据流形式 |
|
545
|
|
|
* |
|
546
|
|
|
* @param string $tarType |
|
547
|
|
|
* |
|
548
|
|
|
* @return static |
|
549
|
|
|
*/ |
|
550
|
|
|
public function setTarType($tarType = 'GZIP') |
|
551
|
|
|
{ |
|
552
|
|
|
$this->_options['tar_type'] = $tarType; |
|
|
|
|
|
|
553
|
|
|
return $this; |
|
554
|
|
|
} |
|
555
|
|
|
|
|
556
|
|
|
/** |
|
557
|
|
|
* 设置资金账户类型 |
|
558
|
|
|
* |
|
559
|
|
|
* - 账单的资金来源账户: |
|
560
|
|
|
* 1. Basic 基本账户 |
|
561
|
|
|
* 2. Operation 运营账户 |
|
562
|
|
|
* 3. Fees 手续费账户 |
|
563
|
|
|
* |
|
564
|
|
|
* @param string $accountType |
|
565
|
|
|
* |
|
566
|
|
|
* @return static |
|
567
|
|
|
*/ |
|
568
|
|
|
public function setAccountType($accountType) |
|
569
|
|
|
{ |
|
570
|
|
|
$this->_options['account_type'] = $accountType; |
|
|
|
|
|
|
571
|
|
|
return $this; |
|
572
|
|
|
} |
|
573
|
|
|
|
|
574
|
|
|
/** |
|
575
|
|
|
* 设置URL链接 |
|
576
|
|
|
* |
|
577
|
|
|
* - 此参数不需要 URLencode,内部会做处理 |
|
578
|
|
|
* |
|
579
|
|
|
* @param string $longUrl |
|
580
|
|
|
* |
|
581
|
|
|
* @return static |
|
582
|
|
|
*/ |
|
583
|
|
|
public function setLongUrl($longUrl) |
|
584
|
|
|
{ |
|
585
|
|
|
$this->_options['long_url'] = $longUrl; |
|
|
|
|
|
|
586
|
|
|
return $this; |
|
587
|
|
|
} |
|
588
|
|
|
|
|
589
|
|
|
/** |
|
590
|
|
|
* 设置预支付ID |
|
591
|
|
|
* |
|
592
|
|
|
* - 调用统一下单接口生成的预支付ID |
|
593
|
|
|
* |
|
594
|
|
|
* @param string $prepayId |
|
595
|
|
|
* |
|
596
|
|
|
* @return static |
|
597
|
|
|
*/ |
|
598
|
|
|
public function setPrepayId($prepayId) |
|
599
|
|
|
{ |
|
600
|
|
|
$this->_options['prepay_id'] = $prepayId; |
|
|
|
|
|
|
601
|
|
|
return $this; |
|
602
|
|
|
} |
|
603
|
|
|
|
|
604
|
|
|
/** |
|
605
|
|
|
* 设置开始时间 |
|
606
|
|
|
* |
|
607
|
|
|
* - 按用户评论时间批量拉取的起始时间,格式为yyyyMMddHHmmss |
|
608
|
|
|
* |
|
609
|
|
|
* @param string $beginTime |
|
610
|
|
|
* |
|
611
|
|
|
* @return static |
|
612
|
|
|
*/ |
|
613
|
|
|
public function setBeginTime($beginTime) |
|
614
|
|
|
{ |
|
615
|
|
|
$this->_options['begin_time'] = $beginTime; |
|
|
|
|
|
|
616
|
|
|
return $this; |
|
617
|
|
|
} |
|
618
|
|
|
|
|
619
|
|
|
/** |
|
620
|
|
|
* 设置结束时间 |
|
621
|
|
|
* |
|
622
|
|
|
* - 按用户评论时间批量拉取的结束时间,格式为yyyyMMddHHmmss |
|
623
|
|
|
* |
|
624
|
|
|
* @param string $endTime |
|
625
|
|
|
* |
|
626
|
|
|
* @return static |
|
627
|
|
|
*/ |
|
628
|
|
|
public function setEndTime($endTime) |
|
629
|
|
|
{ |
|
630
|
|
|
$this->_options['end_time'] = $endTime; |
|
|
|
|
|
|
631
|
|
|
return $this; |
|
632
|
|
|
} |
|
633
|
|
|
|
|
634
|
|
|
/** |
|
635
|
|
|
* 设置条数 |
|
636
|
|
|
* |
|
637
|
|
|
* - 一次拉取的条数, 最大值是200,默认是200 |
|
638
|
|
|
* |
|
639
|
|
|
* @param integer $limit |
|
640
|
|
|
* |
|
641
|
|
|
* @return static |
|
642
|
|
|
*/ |
|
643
|
|
|
public function setLimit($limit = 200) |
|
644
|
|
|
{ |
|
645
|
|
|
$this->_options['limit'] = $limit; |
|
|
|
|
|
|
646
|
|
|
return $this; |
|
647
|
|
|
} |
|
648
|
|
|
} |
|
649
|
|
|
|