| | |
| | | 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; |
| | |
| | | * @author xiaochen |
| | | * @date 2022-03-22 12:47 |
| | | */ |
| | | public Map<String, Object> jsApi(String tradeNo, Integer amount, String openid, String description) { |
| | | public Map<String, Object> jsApi(String tradeNo, Integer amount, String openid, String notify_url, String description) { |
| | | WxPaymentInfoModel requestBody = WxPaymentInfoModel.builder() |
| | | .mchid(this.config.getMchId()) |
| | | .appid(this.config.getAppId()) |
| | | .description(description) |
| | | .out_trade_no(tradeNo) |
| | | .notify_url(notify_url) |
| | | // .attach("") |
| | | .amount(WxPaymentInfoModel.Amount.builder().total(amount).build()) |
| | | .payer(WxPaymentInfoModel.Payer.builder().openid(openid).build()) |
| | |
| | | * 订单查询 |
| | | * |
| | | * @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); |
| | | } |
| | | |
| | |
| | | // 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); |
| | | } |
| | | } |