Skip to content

Commit e5ef345

Browse files
authored
🆕 #3645【小程序】增加虚拟支付的更多接口
1 parent 4cdd056 commit e5ef345

31 files changed

+1729
-2
lines changed

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/WxMaXPayService.java

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cn.binarywang.wx.miniapp.api;
22

3+
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
34
import cn.binarywang.wx.miniapp.bean.xpay.*;
45
import me.chanjar.weixin.common.error.WxErrorException;
56

@@ -149,4 +150,156 @@ public interface WxMaXPayService {
149150
* @throws WxErrorException 查询失败时抛出
150151
*/
151152
WxMaXPayQueryPublishGoodsResponse queryPublishGoods(WxMaXPayQueryPublishGoodsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
153+
154+
/**
155+
* 查询商家账户里的可提现余额。
156+
*
157+
* @param request 查询商家账户里的可提现余额请求对象
158+
* @param sigParams 签名参数对象
159+
* @return 商家账户里的可提现余额查询结果
160+
* @throws WxErrorException 查询失败时抛出
161+
*/
162+
WxMaXPayQueryBizBalanceResponse queryBizBalance(WxMaXPayQueryBizBalanceRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
163+
164+
/**
165+
* 查询广告金充值账户。
166+
*
167+
* @param request 查询广告金充值账户请求对象
168+
* @param sigParams 签名参数对象
169+
* @return 广告金充值账户查询结果
170+
* @throws WxErrorException 查询失败时抛出
171+
*/
172+
WxMaXPayQueryTransferAccountResponse queryTransferAccount(WxMaXPayQueryTransferAccountRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
173+
174+
/**
175+
* 查询广告金发放记录。
176+
*
177+
* @param request 查询广告金发放记录请求对象
178+
* @param sigParams 签名参数对象
179+
* @return 查询广告金发放记录结果
180+
* @throws WxErrorException 查询失败时抛出
181+
*/
182+
WxMaXPayQueryAdverFundsResponse queryAdverFunds(WxMaXPayQueryAdverFundsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
183+
184+
/**
185+
* 充值广告金。
186+
*
187+
* @param request 充值广告金请求对象
188+
* @param sigParams 签名参数对象
189+
* @return 充值广告金结果
190+
* @throws WxErrorException 查询失败时抛出
191+
*/
192+
WxMaXPayCreateFundsBillResponse createFundsBill(WxMaXPayCreateFundsBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
193+
194+
/**
195+
* 绑定广告金充值账户。
196+
*
197+
* @param request 绑定广告金充值账户请求对象
198+
* @param sigParams 签名参数对象
199+
* @return 绑定广告金充值账户结果
200+
* @throws WxErrorException 查询失败时抛出
201+
*/
202+
WxMaBaseResponse bindTransferAccount(WxMaXPayBindTransferAccountRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
203+
204+
/**
205+
* 查询广告金充值记录。
206+
*
207+
* @param request 查询广告金充值记录请求对象
208+
* @param sigParams 签名参数对象
209+
* @return 查询广告金充值记录结果
210+
* @throws WxErrorException 查询失败时抛出
211+
*/
212+
WxMaXPayQueryFundsBillResponse queryFundsBill(WxMaXPayQueryFundsBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
213+
214+
/**
215+
* 查询广告金回收记录。
216+
*
217+
* @param request 查询广告金回收记录请求对象
218+
* @param sigParams 签名参数对象
219+
* @return 查询广告金回收记录结果
220+
* @throws WxErrorException 查询失败时抛出
221+
*/
222+
WxMaXPayQueryRecoverBillResponse queryRecoverBill(WxMaXPayQueryRecoverBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
223+
224+
225+
/**
226+
* 获取投诉列表。
227+
*
228+
* @param request 获取投诉列表请求对象
229+
* @param sigParams 签名参数对象
230+
* @return 获取投诉列表结果
231+
* @throws WxErrorException 查询失败时抛出
232+
*/
233+
WxMaXPayGetComplaintListResponse getComplaintList(WxMaXPayGetComplaintListRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
234+
235+
/**
236+
* 获取投诉详情。
237+
*
238+
* @param request 获取投诉详情请求对象
239+
* @param sigParams 签名参数对象
240+
* @return 获取投诉详情结果
241+
* @throws WxErrorException 查询失败时抛出
242+
*/
243+
WxMaXPayGetComplaintDetailResponse getComplaintDetail(WxMaXPayGetComplaintDetailRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
244+
245+
/**
246+
* 获取协商历史。
247+
*
248+
* @param request 获取协商历史请求对象
249+
* @param sigParams 签名参数对象
250+
* @return 获取协商历史结果
251+
* @throws WxErrorException 查询失败时抛出
252+
*/
253+
WxMaXPayGetNegotiationHistoryResponse getNegotiationHistory(WxMaXPayGetNegotiationHistoryRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
254+
255+
/**
256+
* 回复用户。
257+
*
258+
* @param request 回复用户请求对象
259+
* @param sigParams 签名参数对象
260+
* @return 回复用户结果
261+
* @throws WxErrorException 查询失败时抛出
262+
*/
263+
WxMaBaseResponse responseComplaint(WxMaXPayResponseComplaintRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
264+
265+
/**
266+
* 完成投诉处理。
267+
*
268+
* @param request 完成投诉处理请求对象
269+
* @param sigParams 签名参数对象
270+
* @return 完成投诉处理结果
271+
* @throws WxErrorException 查询失败时抛出
272+
*/
273+
WxMaBaseResponse completeComplaint(WxMaXPayCompleteComplaintRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
274+
275+
/**
276+
* 上传媒体文件(如图片,凭证等)。
277+
*
278+
* @param request 上传媒体文件(如图片,凭证等)请求对象
279+
* @param sigParams 签名参数对象
280+
* @return 上传媒体文件(如图片,凭证等)结果
281+
* @throws WxErrorException 查询失败时抛出
282+
*/
283+
WxMaXPayUploadVpFileResponse uploadVpFile(WxMaXPayUploadVpFileRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
284+
285+
/**
286+
* 获取微信支付反馈投诉图片的签名头部。
287+
*
288+
* @param request 获取微信支付反馈投诉图片的签名头部请求对象
289+
* @param sigParams 签名参数对象
290+
* @return 获取微信支付反馈投诉图片的签名头部结果
291+
* @throws WxErrorException 查询失败时抛出
292+
*/
293+
WxMaXPayGetUploadFileSignResponse getUploadFileSign(WxMaXPayGetUploadFileSignRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
294+
295+
/**
296+
* 下载广告金对应的商户订单信息。
297+
*
298+
* @param request 下载广告金对应的商户订单信息请求对象
299+
* @param sigParams 签名参数对象
300+
* @return 下载广告金对应的商户订单信息结果
301+
* @throws WxErrorException 查询失败时抛出
302+
*/
303+
WxMaXPayDownloadAdverfundsOrderResponse downloadAdverfundsOrder(WxMaXPayDownloadAdverfundsOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException;
304+
152305
}

weixin-java-miniapp/src/main/java/cn/binarywang/wx/miniapp/api/impl/WxMaXPayServiceImpl.java

Lines changed: 215 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package cn.binarywang.wx.miniapp.api.impl;
22

33
import cn.binarywang.wx.miniapp.api.WxMaService;
4-
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
5-
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
64
import cn.binarywang.wx.miniapp.api.WxMaXPayService;
5+
import cn.binarywang.wx.miniapp.bean.WxMaBaseResponse;
76
import cn.binarywang.wx.miniapp.bean.xpay.*;
7+
import cn.binarywang.wx.miniapp.json.WxMaGsonBuilder;
88
import lombok.RequiredArgsConstructor;
99
import lombok.extern.slf4j.Slf4j;
1010
import me.chanjar.weixin.common.enums.WxType;
@@ -235,4 +235,217 @@ public WxMaXPayQueryPublishGoodsResponse queryPublishGoods(WxMaXPayQueryPublishG
235235

236236
return getDetailResponse;
237237
}
238+
239+
@Override
240+
public WxMaXPayQueryBizBalanceResponse queryBizBalance(WxMaXPayQueryBizBalanceRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
241+
final String postBody = request.toJson();
242+
final String uri = sigParams.signUriWithPay(QUERY_BIZ_BALANCE_URL, postBody);
243+
String responseContent = this.service.post(uri, postBody);
244+
WxMaXPayQueryBizBalanceResponse getDetailResponse = WxMaGsonBuilder.create()
245+
.fromJson(responseContent, WxMaXPayQueryBizBalanceResponse.class);
246+
247+
if (getDetailResponse.getErrcode() != 0) {
248+
throw new WxErrorException(
249+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
250+
}
251+
252+
return getDetailResponse;
253+
}
254+
255+
@Override
256+
public WxMaXPayQueryTransferAccountResponse queryTransferAccount(WxMaXPayQueryTransferAccountRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
257+
final String postBody = request.toJson();
258+
final String uri = sigParams.signUriWithPay(QUERY_TRANSFER_ACCOUNT_URL, postBody);
259+
String responseContent = this.service.post(uri, postBody);
260+
WxMaXPayQueryTransferAccountResponse getDetailResponse = WxMaGsonBuilder.create()
261+
.fromJson(responseContent, WxMaXPayQueryTransferAccountResponse.class);
262+
if (getDetailResponse.getErrcode() != 0) {
263+
throw new WxErrorException(
264+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
265+
}
266+
return getDetailResponse;
267+
}
268+
269+
@Override
270+
public WxMaXPayQueryAdverFundsResponse queryAdverFunds(WxMaXPayQueryAdverFundsRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
271+
final String postBody = request.toJson();
272+
final String uri = sigParams.signUriWithPay(QUERY_ADVER_FUNDS_URL, postBody);
273+
String responseContent = this.service.post(uri, postBody);
274+
WxMaXPayQueryAdverFundsResponse getDetailResponse = WxMaGsonBuilder.create()
275+
.fromJson(responseContent, WxMaXPayQueryAdverFundsResponse.class);
276+
if (getDetailResponse.getErrcode() != 0) {
277+
throw new WxErrorException(
278+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
279+
}
280+
return getDetailResponse;
281+
}
282+
283+
@Override
284+
public WxMaXPayCreateFundsBillResponse createFundsBill(WxMaXPayCreateFundsBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
285+
final String postBody = request.toJson();
286+
final String uri = sigParams.signUriWithPay(CREATE_FUNDS_BILL_URL, postBody);
287+
String responseContent = this.service.post(uri, postBody);
288+
WxMaXPayCreateFundsBillResponse getDetailResponse = WxMaGsonBuilder.create()
289+
.fromJson(responseContent, WxMaXPayCreateFundsBillResponse.class);
290+
if (getDetailResponse.getErrcode() != 0) {
291+
throw new WxErrorException(
292+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
293+
}
294+
return getDetailResponse;
295+
}
296+
297+
@Override
298+
public WxMaBaseResponse bindTransferAccount(WxMaXPayBindTransferAccountRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
299+
final String postBody = request.toJson();
300+
final String uri = sigParams.signUriWithPay(BIND_TRANSFER_ACCOUNT_URL, postBody);
301+
String responseContent = this.service.post(uri, postBody);
302+
WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create()
303+
.fromJson(responseContent, WxMaBaseResponse.class);
304+
if (getDetailResponse.getErrcode() != 0) {
305+
throw new WxErrorException(
306+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
307+
}
308+
return getDetailResponse;
309+
}
310+
311+
@Override
312+
public WxMaXPayQueryFundsBillResponse queryFundsBill(WxMaXPayQueryFundsBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
313+
final String postBody = request.toJson();
314+
final String uri = sigParams.signUriWithPay(QUERY_FUNDS_BILL_URL, postBody);
315+
String responseContent = this.service.post(uri, postBody);
316+
WxMaXPayQueryFundsBillResponse getDetailResponse = WxMaGsonBuilder.create()
317+
.fromJson(responseContent, WxMaXPayQueryFundsBillResponse.class);
318+
if (getDetailResponse.getErrcode() != 0) {
319+
throw new WxErrorException(
320+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
321+
}
322+
return getDetailResponse;
323+
}
324+
325+
@Override
326+
public WxMaXPayQueryRecoverBillResponse queryRecoverBill(WxMaXPayQueryRecoverBillRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
327+
final String postBody = request.toJson();
328+
final String uri = sigParams.signUriWithPay(QUERY_RECOVER_BILL_URL, postBody);
329+
String responseContent = this.service.post(uri, postBody);
330+
WxMaXPayQueryRecoverBillResponse getDetailResponse = WxMaGsonBuilder.create()
331+
.fromJson(responseContent, WxMaXPayQueryRecoverBillResponse.class);
332+
if (getDetailResponse.getErrcode() != 0) {
333+
throw new WxErrorException(
334+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
335+
}
336+
return getDetailResponse;
337+
}
338+
339+
340+
@Override
341+
public WxMaXPayGetComplaintListResponse getComplaintList(WxMaXPayGetComplaintListRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
342+
final String postBody = request.toJson();
343+
final String uri = sigParams.signUriWithPay(GET_COMPLAINT_LIST_URL, postBody);
344+
String responseContent = this.service.post(uri, postBody);
345+
WxMaXPayGetComplaintListResponse getDetailResponse = WxMaGsonBuilder.create()
346+
.fromJson(responseContent, WxMaXPayGetComplaintListResponse.class);
347+
if (getDetailResponse.getErrcode() != 0) {
348+
throw new WxErrorException(
349+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
350+
}
351+
return getDetailResponse;
352+
}
353+
354+
@Override
355+
public WxMaXPayGetComplaintDetailResponse getComplaintDetail(WxMaXPayGetComplaintDetailRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
356+
final String postBody = request.toJson();
357+
final String uri = sigParams.signUriWithPay(GET_COMPLAINT_DETAIL_URL, postBody);
358+
String responseContent = this.service.post(uri, postBody);
359+
WxMaXPayGetComplaintDetailResponse getDetailResponse = WxMaGsonBuilder.create()
360+
.fromJson(responseContent, WxMaXPayGetComplaintDetailResponse.class);
361+
if (getDetailResponse.getErrcode() != 0) {
362+
throw new WxErrorException(
363+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
364+
}
365+
return getDetailResponse;
366+
}
367+
368+
@Override
369+
public WxMaXPayGetNegotiationHistoryResponse getNegotiationHistory(WxMaXPayGetNegotiationHistoryRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
370+
final String postBody = request.toJson();
371+
final String uri = sigParams.signUriWithPay(GET_NEGOTIATION_HISTORY_URL, postBody);
372+
String responseContent = this.service.post(uri, postBody);
373+
WxMaXPayGetNegotiationHistoryResponse getDetailResponse = WxMaGsonBuilder.create()
374+
.fromJson(responseContent, WxMaXPayGetNegotiationHistoryResponse.class);
375+
if (getDetailResponse.getErrcode() != 0) {
376+
throw new WxErrorException(
377+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
378+
}
379+
return getDetailResponse;
380+
}
381+
382+
@Override
383+
public WxMaBaseResponse responseComplaint(WxMaXPayResponseComplaintRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
384+
final String postBody = request.toJson();
385+
final String uri = sigParams.signUriWithPay(RESPONSE_COMPLAINT_URL, postBody);
386+
String responseContent = this.service.post(uri, postBody);
387+
WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create()
388+
.fromJson(responseContent, WxMaBaseResponse.class);
389+
if (getDetailResponse.getErrcode() != 0) {
390+
throw new WxErrorException(
391+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
392+
}
393+
return getDetailResponse;
394+
}
395+
396+
@Override
397+
public WxMaBaseResponse completeComplaint(WxMaXPayCompleteComplaintRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
398+
final String postBody = request.toJson();
399+
final String uri = sigParams.signUriWithPay(COMPLETE_COMPLAINT_URL, postBody);
400+
String responseContent = this.service.post(uri, postBody);
401+
WxMaBaseResponse getDetailResponse = WxMaGsonBuilder.create()
402+
.fromJson(responseContent, WxMaBaseResponse.class);
403+
if (getDetailResponse.getErrcode() != 0) {
404+
throw new WxErrorException(
405+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
406+
}
407+
return getDetailResponse;
408+
}
409+
410+
@Override
411+
public WxMaXPayUploadVpFileResponse uploadVpFile(WxMaXPayUploadVpFileRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
412+
final String postBody = request.toJson();
413+
final String uri = sigParams.signUriWithPay(UPLOAD_VP_FILE_URL, postBody);
414+
String responseContent = this.service.post(uri, postBody);
415+
WxMaXPayUploadVpFileResponse getDetailResponse = WxMaGsonBuilder.create()
416+
.fromJson(responseContent, WxMaXPayUploadVpFileResponse.class);
417+
if (getDetailResponse.getErrcode() != 0) {
418+
throw new WxErrorException(
419+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
420+
}
421+
return getDetailResponse;
422+
}
423+
424+
@Override
425+
public WxMaXPayGetUploadFileSignResponse getUploadFileSign(WxMaXPayGetUploadFileSignRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
426+
final String postBody = request.toJson();
427+
final String uri = sigParams.signUriWithPay(GET_UPLOAD_FILE_SIGN_URL, postBody);
428+
String responseContent = this.service.post(uri, postBody);
429+
WxMaXPayGetUploadFileSignResponse getDetailResponse = WxMaGsonBuilder.create()
430+
.fromJson(responseContent, WxMaXPayGetUploadFileSignResponse.class);
431+
if (getDetailResponse.getErrcode() != 0) {
432+
throw new WxErrorException(
433+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
434+
}
435+
return getDetailResponse;
436+
}
437+
438+
@Override
439+
public WxMaXPayDownloadAdverfundsOrderResponse downloadAdverfundsOrder(WxMaXPayDownloadAdverfundsOrderRequest request, WxMaXPaySigParams sigParams) throws WxErrorException {
440+
final String postBody = request.toJson();
441+
final String uri = sigParams.signUriWithPay(DOWNLOAD_ADVERFUNDS_ORDER_URL, postBody);
442+
String responseContent = this.service.post(uri, postBody);
443+
WxMaXPayDownloadAdverfundsOrderResponse getDetailResponse = WxMaGsonBuilder.create()
444+
.fromJson(responseContent, WxMaXPayDownloadAdverfundsOrderResponse.class);
445+
if (getDetailResponse.getErrcode() != 0) {
446+
throw new WxErrorException(
447+
new WxError(getDetailResponse.getErrcode(), getDetailResponse.getErrmsg()));
448+
}
449+
return getDetailResponse;
450+
}
238451
}

0 commit comments

Comments
 (0)