forked from binarywang/WxJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEcommerceService.java
More file actions
439 lines (403 loc) · 14.9 KB
/
EcommerceService.java
File metadata and controls
439 lines (403 loc) · 14.9 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
package com.github.binarywang.wxpay.service;
import com.github.binarywang.wxpay.bean.ecommerce.*;
import com.github.binarywang.wxpay.bean.ecommerce.enums.FundBillTypeEnum;
import com.github.binarywang.wxpay.bean.ecommerce.enums.SpAccountTypeEnum;
import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
import com.github.binarywang.wxpay.exception.WxPayException;
import java.io.InputStream;
/**
* <pre>
* 电商收付通相关服务类.
* 接口规则:https://wechatpay-api.gitbook.io/wechatpay-api-v3
* </pre>
*
* @author cloudX
* @date 2020 /08/17
*/
public interface EcommerceService {
/**
* <pre>
* 二级商户进件API
* 接口地址: https://api.mch.weixin.qq.com/v3/ecommerce/applyments/
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_1.shtml
*
* </pre>
*
* @param request 请求对象
* @return . applyments result
* @throws WxPayException the wx pay exception
*/
ApplymentsResult createApply(ApplymentsRequest request) throws WxPayException;
/**
* <pre>
* 查询申请状态API
* 请求URL: https://api.mch.weixin.qq.com/v3/ecommerce/applyments/{applyment_id}
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_2.shtml
* </pre>
*
* @param applymentId 申请单ID
* @return . applyments status result
* @throws WxPayException the wx pay exception
*/
ApplymentsStatusResult queryApplyStatusByApplymentId(String applymentId) throws WxPayException;
/**
* <pre>
* 查询申请状态API
* 请求URL: https://api.mch.weixin.qq.com/v3/ecommerce/applyments/out-request-no/{out_request_no}
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_2.shtml
* </pre>
*
* @param outRequestNo 业务申请编号
* @return . applyments status result
* @throws WxPayException the wx pay exception
*/
ApplymentsStatusResult queryApplyStatusByOutRequestNo(String outRequestNo) throws WxPayException;
/**
* <pre>
* 合单支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
* 请求URL:https://api.mch.weixin.qq.com/v3/combine-transactions/jsapi
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/e-combine.shtml
* </pre>
*
* @param tradeType 支付方式
* @param request 请求对象
* @return 微信合单支付返回 transactions result
* @throws WxPayException the wx pay exception
*/
TransactionsResult combine(TradeTypeEnum tradeType, CombineTransactionsRequest request) throws WxPayException;
/**
* <pre>
* 合单支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
* 请求URL:https://api.mch.weixin.qq.com/v3/combine-transactions/jsapi
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/e-combine.shtml
* </pre>
*
* @param <T> the type parameter
* @param tradeType 支付方式
* @param request 请求对象
* @return 调起支付需要的参数 t
* @throws WxPayException the wx pay exception
*/
<T> T combineTransactions(TradeTypeEnum tradeType, CombineTransactionsRequest request) throws WxPayException;
/**
* <pre>
* 合单支付通知回调数据处理
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/e-combine.shtml
* </pre>
*
* @param notifyData 通知数据
* @param header 通知头部数据,不传则表示不校验头
* @return 解密后通知数据 combine transactions notify result
* @throws WxPayException the wx pay exception
*/
CombineTransactionsNotifyResult parseCombineNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
/**
* <pre>
* 合单查询订单API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_3.shtml
* </pre>
*
* @param outTradeNo 合单商户订单号
* @return 支付订单信息
* @throws WxPayException the wx pay exception
*/
CombineTransactionsResult queryCombineTransactions(String outTradeNo) throws WxPayException;
/**
* <pre>
* 服务商模式普通支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
* 请求URL:https://api.mch.weixin.qq.com/v3/pay/partner/transactions/jsapi
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/transactions_sl.shtml
* </pre>
*
* @param tradeType 支付方式
* @param request 请求对象
* @return 调起支付需要的参数 transactions result
* @throws WxPayException the wx pay exception
*/
TransactionsResult partner(TradeTypeEnum tradeType, PartnerTransactionsRequest request) throws WxPayException;
/**
* <pre>
* 服务商模式普通支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
* 请求URL:https://api.mch.weixin.qq.com/v3/pay/partner/transactions/jsapi
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/transactions_sl.shtml
* </pre>
*
* @param <T> the type parameter
* @param tradeType 支付方式
* @param request 请求对象
* @return 调起支付需要的参数 t
* @throws WxPayException the wx pay exception
*/
<T> T partnerTransactions(TradeTypeEnum tradeType, PartnerTransactionsRequest request) throws WxPayException;
/**
* <pre>
* 普通支付通知回调数据处理
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/e_transactions.shtml
* </pre>
*
* @param notifyData 通知数据
* @param header 通知头部数据,不传则表示不校验头
* @return 解密后通知数据 partner transactions notify result
* @throws WxPayException the wx pay exception
*/
PartnerTransactionsNotifyResult parsePartnerNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
/**
* <pre>
* 普通查询订单API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/e_transactions/chapter3_5.shtml
* </pre>
*
* @param request 商户订单信息
* @return 支付订单信息
* @throws WxPayException the wx pay exception
*/
PartnerTransactionsResult queryPartnerTransactions(PartnerTransactionsQueryRequest request) throws WxPayException;
/**
* <pre>
* 关闭普通订单API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/e_transactions/chapter3_6.shtml
* </pre>
*
* @param request 关闭普通订单请求
* @throws WxPayException the wx pay exception
*/
void closePartnerTransactions(PartnerTransactionsCloseRequest request) throws WxPayException;
/**
* <pre>
* 服务商账户实时余额
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
* </pre>
*
* @param accountType 服务商账户类型
* @return 返回数据 fund balance result
* @throws WxPayException the wx pay exception
*/
FundBalanceResult spNowBalance(SpAccountTypeEnum accountType) throws WxPayException;
/**
* <pre>
* 服务商账户日终余额
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
* </pre>
*
* @param accountType 服务商账户类型
* @param date 查询日期 2020-09-11
* @return 返回数据 fund balance result
* @throws WxPayException the wx pay exception
*/
FundBalanceResult spDayEndBalance(SpAccountTypeEnum accountType, String date) throws WxPayException;
/**
* <pre>
* 二级商户号账户实时余额
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
* </pre>
*
* @param subMchid 二级商户号
* @return 返回数据 fund balance result
* @throws WxPayException the wx pay exception
*/
FundBalanceResult subNowBalance(String subMchid) throws WxPayException;
/**
* <pre>
* 二级商户号账户日终余额
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
* </pre>
*
* @param subMchid 二级商户号
* @param date 查询日期 2020-09-11
* @return 返回数据 fund balance result
* @throws WxPayException the wx pay exception
*/
FundBalanceResult subDayEndBalance(String subMchid, String date) throws WxPayException;
/**
* <pre>
* 请求分账API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_1.shtml
* </pre>
*
* @param request 分账请求
* @return 返回数据 profit sharing result
* @throws WxPayException the wx pay exception
*/
ProfitSharingResult profitSharing(ProfitSharingRequest request) throws WxPayException;
/**
* <pre>
* 查询分账结果API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_2.shtml
* </pre>
*
* @param request 查询分账请求
* @return 返回数据 profit sharing result
* @throws WxPayException the wx pay exception
*/
ProfitSharingResult queryProfitSharing(ProfitSharingQueryRequest request) throws WxPayException;
/**
* <pre>
* 请求分账回退API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_3.shtml
* </pre>
*
* @param request 分账回退请求
* @return 返回数据 return orders result
* @throws WxPayException the wx pay exception
*/
ReturnOrdersResult returnOrders(ReturnOrdersRequest request) throws WxPayException;
/**
* <pre>
* 完结分账API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_5.shtml
* </pre>
*
* @param request 完结分账请求
* @return 返回数据 return orders result
* @throws WxPayException the wx pay exception
*/
ProfitSharingResult finishOrder(FinishOrderRequest request) throws WxPayException;
/**
* <pre>
* 退款申请API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_1.shtml
* </pre>
*
* @param request 退款请求
* @return 返回数据 return refunds result
* @throws WxPayException the wx pay exception
*/
RefundsResult refunds(RefundsRequest request) throws WxPayException;
/**
* <pre>
* 查询退款API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_2.shtml
* </pre>
*
* @param subMchid 二级商户号
* @param refundId 微信退款单号
* @return 返回数据 return refunds result
* @throws WxPayException the wx pay exception
*/
RefundQueryResult queryRefundByRefundId(String subMchid, String refundId) throws WxPayException;
/**
* <pre>
* 查询退款API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_2.shtml
* </pre>
*
* @param subMchid 二级商户号
* @param outRefundNo 商户退款单号
* @return 返回数据 return refunds result
* @throws WxPayException the wx pay exception
*/
RefundQueryResult queryRefundByOutRefundNo(String subMchid, String outRefundNo) throws WxPayException;
/**
* <pre>
* 退款通知回调数据处理
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_3.shtml
* </pre>
*
* @param notifyData 通知数据
* @param header 通知头部数据,不传则表示不校验头
* @return 解密后通知数据 partner refund notify result
* @throws WxPayException the wx pay exception
*/
RefundNotifyResult parseRefundNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
/**
* <pre>
* 二级商户账户余额提现API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_2.shtml
* </pre>
*
* @param request 提现请求
* @return 返回数据 return withdraw result
* @throws WxPayException the wx pay exception
*/
SubWithdrawResult subWithdraw(SubWithdrawRequest request) throws WxPayException;
/**
* <pre>
* 电商平台提现API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_5.shtml
* </pre>
*
* @param request 提现请求
* @return 返回数据 return withdraw result
* @throws WxPayException the wx pay exception
*/
SpWithdrawResult spWithdraw(SpWithdrawRequest request) throws WxPayException;
/**
* <pre>
* 二级商户查询提现状态API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_3.shtml
* </pre>
*
* @param subMchid 二级商户号
* @param outRequestNo 商户提现单号
* @return 返回数据 return sub withdraw status result
* @throws WxPayException the wx pay exception
*/
SubWithdrawStatusResult querySubWithdrawByOutRequestNo(String subMchid, String outRequestNo) throws WxPayException;
/**
* <pre>
* 电商平台查询提现状态API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_6.shtml
* </pre>
*
* @param outRequestNo 商户提现单号
* @return 返回数据 return sp withdraw status result
* @throws WxPayException the wx pay exception
*/
SpWithdrawStatusResult querySpWithdrawByOutRequestNo(String outRequestNo) throws WxPayException;
/**
* <pre>
* 修改结算帐号API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_4.shtml
* </pre>
*
* @param subMchid 二级商户号。
* @param request 结算帐号
* @throws WxPayException the wx pay exception
*/
void modifySettlement(String subMchid, SettlementRequest request) throws WxPayException;
/**
* <pre>
* 查询结算账户API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_5.shtml
* </pre>
*
* @param subMchid 二级商户号。
* @return 返回数据 return settlement result
* @throws WxPayException the wx pay exception
*/
SettlementResult querySettlement(String subMchid) throws WxPayException;
/**
* <pre>
* 请求账单API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/bill.shtml
* </pre>
*
* @param request 请求信息。
* @return 返回数据 return trade bill result
* @throws WxPayException the wx pay exception
*/
TradeBillResult applyBill(TradeBillRequest request) throws WxPayException;
/**
* <pre>
* 申请资金账单API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/bill/chapter3_2.shtml
* </pre>
*
* @param billType 账单类型。
* @param request 请求信息。
* @return 返回数据 return fund bill result
* @throws WxPayException the wx pay exception
*/
FundBillResult applyFundBill(FundBillTypeEnum billType, FundBillRequest request) throws WxPayException;
/**
* <pre>
* 下载账单API
* 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/bill.shtml
* </pre>
*
* @param url 微信返回的账单地址。
* @return 返回数据 return inputStream
* @throws WxPayException the wx pay exception
*/
InputStream downloadBill(String url) throws WxPayException;
}