From bd1dc8dc5bce46cfb919556ad4b033f1396b3546 Mon Sep 17 00:00:00 2001 From: zhibing.pu <393733352@qq.com> Date: 星期三, 21 八月 2024 16:57:00 +0800 Subject: [PATCH] 新增加小程序接口 --- ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/utils/WxV3Pay.java | 21 +++++++++++++++++---- 1 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/utils/WxV3Pay.java b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/utils/WxV3Pay.java index 2768601..4e01120 100644 --- a/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/utils/WxV3Pay.java +++ b/ruoyi-service/ruoyi-payment/src/main/java/com/ruoyi/payment/wx/utils/WxV3Pay.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.ruoyi.payment.wx.model.WeixinProperties; +import com.ruoyi.payment.wx.model.WxCloseOrderModel; import com.ruoyi.payment.wx.model.WxPaymentInfoModel; import com.ruoyi.payment.wx.model.WxPaymentRefundModel; import com.ruoyi.payment.wx.resp.NotifyV3PayDecodeRespBody; @@ -170,15 +171,14 @@ * 订单查询 * * @param out_trade_no - * @param mchid * @return com.abl.biz.center.payment.wx.v3.NotifyV3PayDecodeRespBody * @author xiaochen * @date 2021-12-20 16:47 */ @Override - public NotifyV3PayDecodeRespBody query(String out_trade_no, String mchid) { + public NotifyV3PayDecodeRespBody query(String out_trade_no) { String url = - String.format("/v3/pay/transactions/out-trade-no/%s", out_trade_no) + String.format("?mchid=%s", mchid); + String.format("/v3/pay/transactions/out-trade-no/%s", out_trade_no) + String.format("?mchid=%s", this.getConfig().getMchId()); return query(this.httpClient, this.config.getHttpReadTimeoutMs(), this.config.getHttpConnectTimeoutMs(), url); } @@ -194,5 +194,18 @@ // refundModel.setNotify_url(this.config.getV3().getNotifyRefundUrl()); return refund(this.httpClient, "/v3/refund/domestic/refunds", this.config.getHttpReadTimeoutMs(), this.config.getHttpConnectTimeoutMs(), refundModel); } - + + + /** + * 关闭订单 + * @param out_trade_no + * @return + */ + @Override + public String close(String out_trade_no) { + String uri = String.format("/v3/pay/transactions/out-trade-no/%s/close", out_trade_no); + WxCloseOrderModel wxCloseOrderModel = new WxCloseOrderModel(); + wxCloseOrderModel.setMchid(this.config.getMchId()); + return close(this.httpClient, uri, this.config.getHttpReadTimeoutMs(), this.config.getHttpConnectTimeoutMs(), wxCloseOrderModel); + } } -- Gitblit v1.7.1