EcommerceService.java 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. package com.github.binarywang.wxpay.service;
  2. import com.github.binarywang.wxpay.bean.ecommerce.*;
  3. import com.github.binarywang.wxpay.bean.ecommerce.enums.SpAccountTypeEnum;
  4. import com.github.binarywang.wxpay.bean.ecommerce.enums.TradeTypeEnum;
  5. import com.github.binarywang.wxpay.exception.WxPayException;
  6. /**
  7. * <pre>
  8. * 电商收付通相关服务类.
  9. * 接口规则:https://wechatpay-api.gitbook.io/wechatpay-api-v3
  10. * </pre>
  11. *
  12. * @author cloudX
  13. * @date 2020 /08/17
  14. */
  15. public interface EcommerceService {
  16. /**
  17. * <pre>
  18. * 二级商户进件API
  19. * 接口地址: https://api.mch.weixin.qq.com/v3/ecommerce/applyments/
  20. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_1.shtml
  21. *
  22. * </pre>
  23. *
  24. * @param request 请求对象
  25. * @return . applyments result
  26. * @throws WxPayException the wx pay exception
  27. */
  28. ApplymentsResult createApply(ApplymentsRequest request) throws WxPayException;
  29. /**
  30. * <pre>
  31. * 查询申请状态API
  32. * 请求URL: https://api.mch.weixin.qq.com/v3/ecommerce/applyments/{applyment_id}
  33. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_2.shtml
  34. * </pre>
  35. *
  36. * @param applymentId 申请单ID
  37. * @return . applyments status result
  38. * @throws WxPayException the wx pay exception
  39. */
  40. ApplymentsStatusResult queryApplyStatusByApplymentId(String applymentId) throws WxPayException;
  41. /**
  42. * <pre>
  43. * 查询申请状态API
  44. * 请求URL: https://api.mch.weixin.qq.com/v3/ecommerce/applyments/out-request-no/{out_request_no}
  45. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_2.shtml
  46. * </pre>
  47. *
  48. * @param outRequestNo 业务申请编号
  49. * @return . applyments status result
  50. * @throws WxPayException the wx pay exception
  51. */
  52. ApplymentsStatusResult queryApplyStatusByOutRequestNo(String outRequestNo) throws WxPayException;
  53. /**
  54. * <pre>
  55. * 合单支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
  56. * 请求URL:https://api.mch.weixin.qq.com/v3/combine-transactions/jsapi
  57. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/e-combine.shtml
  58. * </pre>
  59. *
  60. * @param tradeType 支付方式
  61. * @param request 请求对象
  62. * @return 微信合单支付返回 transactions result
  63. * @throws WxPayException the wx pay exception
  64. */
  65. TransactionsResult combine(TradeTypeEnum tradeType, CombineTransactionsRequest request) throws WxPayException;
  66. /**
  67. * <pre>
  68. * 合单支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
  69. * 请求URL:https://api.mch.weixin.qq.com/v3/combine-transactions/jsapi
  70. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/e-combine.shtml
  71. * </pre>
  72. *
  73. * @param <T> the type parameter
  74. * @param tradeType 支付方式
  75. * @param request 请求对象
  76. * @return 调起支付需要的参数 t
  77. * @throws WxPayException the wx pay exception
  78. */
  79. <T> T combineTransactions(TradeTypeEnum tradeType, CombineTransactionsRequest request) throws WxPayException;
  80. /**
  81. * <pre>
  82. * 合单支付通知回调数据处理
  83. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/e-combine.shtml
  84. * </pre>
  85. *
  86. * @param notifyData 通知数据
  87. * @param header 通知头部数据,不传则表示不校验头
  88. * @return 解密后通知数据 combine transactions notify result
  89. * @throws WxPayException the wx pay exception
  90. */
  91. CombineTransactionsNotifyResult parseCombineNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
  92. /**
  93. * <pre>
  94. * 合单查询订单API
  95. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pay/combine/chapter3_3.shtml
  96. * </pre>
  97. *
  98. * @param outTradeNo 合单商户订单号
  99. * @return 支付订单信息
  100. * @throws WxPayException the wx pay exception
  101. */
  102. CombineTransactionsResult queryCombineTransactions(String outTradeNo) throws WxPayException;
  103. /**
  104. * <pre>
  105. * 服务商模式普通支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
  106. * 请求URL:https://api.mch.weixin.qq.com/v3/pay/partner/transactions/jsapi
  107. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/transactions_sl.shtml
  108. * </pre>
  109. *
  110. * @param tradeType 支付方式
  111. * @param request 请求对象
  112. * @return 调起支付需要的参数 transactions result
  113. * @throws WxPayException the wx pay exception
  114. */
  115. TransactionsResult partner(TradeTypeEnum tradeType, PartnerTransactionsRequest request) throws WxPayException;
  116. /**
  117. * <pre>
  118. * 服务商模式普通支付API(APP支付、JSAPI支付、H5支付、NATIVE支付).
  119. * 请求URL:https://api.mch.weixin.qq.com/v3/pay/partner/transactions/jsapi
  120. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/transactions_sl.shtml
  121. * </pre>
  122. *
  123. * @param <T> the type parameter
  124. * @param tradeType 支付方式
  125. * @param request 请求对象
  126. * @return 调起支付需要的参数 t
  127. * @throws WxPayException the wx pay exception
  128. */
  129. <T> T partnerTransactions(TradeTypeEnum tradeType, PartnerTransactionsRequest request) throws WxPayException;
  130. /**
  131. * <pre>
  132. * 普通支付通知回调数据处理
  133. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/e_transactions.shtml
  134. * </pre>
  135. *
  136. * @param notifyData 通知数据
  137. * @param header 通知头部数据,不传则表示不校验头
  138. * @return 解密后通知数据 partner transactions notify result
  139. * @throws WxPayException the wx pay exception
  140. */
  141. PartnerTransactionsNotifyResult parsePartnerNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
  142. /**
  143. * <pre>
  144. * 普通查询订单API
  145. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/e_transactions/chapter3_5.shtml
  146. * </pre>
  147. *
  148. * @param request 商户订单信息
  149. * @return 支付订单信息
  150. * @throws WxPayException the wx pay exception
  151. */
  152. PartnerTransactionsResult queryPartnerTransactions(PartnerTransactionsQueryRequest request) throws WxPayException;
  153. /**
  154. * <pre>
  155. * 服务商账户实时余额
  156. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
  157. * </pre>
  158. *
  159. * @param accountType 服务商账户类型
  160. * @return 返回数据 fund balance result
  161. * @throws WxPayException the wx pay exception
  162. */
  163. FundBalanceResult spNowBalance(SpAccountTypeEnum accountType) throws WxPayException;
  164. /**
  165. * <pre>
  166. * 服务商账户日终余额
  167. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
  168. * </pre>
  169. *
  170. * @param accountType 服务商账户类型
  171. * @param date 查询日期 2020-09-11
  172. * @return 返回数据 fund balance result
  173. * @throws WxPayException the wx pay exception
  174. */
  175. FundBalanceResult spDayEndBalance(SpAccountTypeEnum accountType, String date) throws WxPayException;
  176. /**
  177. * <pre>
  178. * 二级商户号账户实时余额
  179. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
  180. * </pre>
  181. *
  182. * @param subMchid 二级商户号
  183. * @return 返回数据 fund balance result
  184. * @throws WxPayException the wx pay exception
  185. */
  186. FundBalanceResult subNowBalance(String subMchid) throws WxPayException;
  187. /**
  188. * <pre>
  189. * 二级商户号账户日终余额
  190. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/pages/amount.shtml
  191. * </pre>
  192. *
  193. * @param subMchid 二级商户号
  194. * @param date 查询日期 2020-09-11
  195. * @return 返回数据 fund balance result
  196. * @throws WxPayException the wx pay exception
  197. */
  198. FundBalanceResult subDayEndBalance(String subMchid, String date) throws WxPayException;
  199. /**
  200. * <pre>
  201. * 请求分账API
  202. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_1.shtml
  203. * </pre>
  204. *
  205. * @param request 分账请求
  206. * @return 返回数据 profit sharing result
  207. * @throws WxPayException the wx pay exception
  208. */
  209. ProfitSharingResult profitSharing(ProfitSharingRequest request) throws WxPayException;
  210. /**
  211. * <pre>
  212. * 查询分账结果API
  213. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_2.shtml
  214. * </pre>
  215. *
  216. * @param request 查询分账请求
  217. * @return 返回数据 profit sharing result
  218. * @throws WxPayException the wx pay exception
  219. */
  220. ProfitSharingResult queryProfitSharing(ProfitSharingQueryRequest request) throws WxPayException;
  221. /**
  222. * <pre>
  223. * 请求分账回退API
  224. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_3.shtml
  225. * </pre>
  226. *
  227. * @param request 分账回退请求
  228. * @return 返回数据 return orders result
  229. * @throws WxPayException the wx pay exception
  230. */
  231. ReturnOrdersResult returnOrders(ReturnOrdersRequest request) throws WxPayException;
  232. /**
  233. * <pre>
  234. * 完结分账API
  235. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/profitsharing/chapter3_5.shtml
  236. * </pre>
  237. *
  238. * @param request 完结分账请求
  239. * @return 返回数据 return orders result
  240. * @throws WxPayException the wx pay exception
  241. */
  242. ProfitSharingResult finishOrder(FinishOrderRequest request) throws WxPayException;
  243. /**
  244. * <pre>
  245. * 退款申请API
  246. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_1.shtml
  247. * </pre>
  248. *
  249. * @param request 退款请求
  250. * @return 返回数据 return refunds result
  251. * @throws WxPayException the wx pay exception
  252. */
  253. RefundsResult refunds(RefundsRequest request) throws WxPayException;
  254. /**
  255. * <pre>
  256. * 查询退款API
  257. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_2.shtml
  258. * </pre>
  259. *
  260. * @param subMchid 二级商户号
  261. * @param refundId 微信退款单号
  262. * @return 返回数据 return refunds result
  263. * @throws WxPayException the wx pay exception
  264. */
  265. RefundQueryResult queryRefundByRefundId(String subMchid, String refundId) throws WxPayException;
  266. /**
  267. * <pre>
  268. * 查询退款API
  269. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_2.shtml
  270. * </pre>
  271. *
  272. * @param subMchid 二级商户号
  273. * @param outRefundNo 商户退款单号
  274. * @return 返回数据 return refunds result
  275. * @throws WxPayException the wx pay exception
  276. */
  277. RefundQueryResult queryRefundByOutRefundNo(String subMchid, String outRefundNo) throws WxPayException;
  278. /**
  279. * <pre>
  280. * 退款通知回调数据处理
  281. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/refunds/chapter3_3.shtml
  282. * </pre>
  283. *
  284. * @param notifyData 通知数据
  285. * @param header 通知头部数据,不传则表示不校验头
  286. * @return 解密后通知数据 partner refund notify result
  287. * @throws WxPayException the wx pay exception
  288. */
  289. RefundNotifyResult parseRefundNotifyResult(String notifyData, SignatureHeader header) throws WxPayException;
  290. /**
  291. * <pre>
  292. * 二级商户账户余额提现API
  293. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_2.shtml
  294. * </pre>
  295. *
  296. * @param request 提现请求
  297. * @return 返回数据 return withdraw result
  298. * @throws WxPayException the wx pay exception
  299. */
  300. SubWithdrawResult subWithdraw(SubWithdrawRequest request) throws WxPayException;
  301. /**
  302. * <pre>
  303. * 电商平台提现API
  304. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/fund/chapter3_5.shtml
  305. * </pre>
  306. *
  307. * @param request 提现请求
  308. * @return 返回数据 return withdraw result
  309. * @throws WxPayException the wx pay exception
  310. */
  311. SpWithdrawResult spWithdraw(SpWithdrawRequest request) throws WxPayException;
  312. /**
  313. * <pre>
  314. * 修改结算帐号API
  315. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_4.shtml
  316. * </pre>
  317. *
  318. * @param subMchid 二级商户号。
  319. * @param request 结算帐号
  320. * @throws WxPayException the wx pay exception
  321. */
  322. void modifySettlement(String subMchid, SettlementRequest request) throws WxPayException;
  323. /**
  324. * <pre>
  325. * 查询结算账户API
  326. * 文档地址: https://pay.weixin.qq.com/wiki/doc/apiv3/wxpay/ecommerce/applyments/chapter3_5.shtml
  327. * </pre>
  328. *
  329. * @param subMchid 二级商户号。
  330. * @return 返回数据 return settlement result
  331. * @throws WxPayException the wx pay exception
  332. */
  333. SettlementResult querySettlement(String subMchid) throws WxPayException;
  334. }