| | |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.payment.api.vo.PaymentOrder; |
| | | import com.ruoyi.payment.wx.enums.RefundEnum; |
| | | import com.ruoyi.payment.wx.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.wx.resp.NotifyV3PayDecodeRespBody; |
| | | import com.ruoyi.payment.wx.utils.WxV3Pay; |
| | | import io.swagger.annotations.Api; |
| | |
| | | // TODO 退款业务处理 |
| | | return AjaxResult.success(); |
| | | } |
| | | |
| | | /** |
| | | * 微信v3支付-订单退款 远程调用 |
| | | * |
| | | * @return |
| | | */ |
| | | @ApiOperation("订单退款") |
| | | @PostMapping(value = "refundOrderR") |
| | | public R<String> refundOrderR(@RequestBody WxPaymentRefundModel model) { |
| | | Map<String, Object> result = wxV3Pay.refund(model); |
| | | log.info("退款结果:{}", result); |
| | | // 微信支付退款单号 |
| | | String refund_id = result.get("refund_id").toString(); |
| | | // 商户退款单号 |
| | | String out_refund_no = result.get("out_refund_no").toString(); |
| | | // 微信支付订单号 |
| | | String transaction_id = result.get("transaction_id").toString(); |
| | | // 商户订单号 tradeNo |
| | | String out_trade_no = result.get("out_trade_no").toString(); |
| | | // 退款成功时间 |
| | | String success_time = Objects.nonNull(result.get("success_time")) ? result.get("success_time").toString() : null; |
| | | // 退款状态 RefundEnum |
| | | String status = result.get("status").toString(); |
| | | return R.ok(status); |
| | | } |
| | | /** |
| | | * 支付回调 |
| | | */ |
| | |
| | | // 时间不对的话,可以调用 WxTimeUtils.toRfc3339Date(success_time)转换一下 |
| | | String success_time = params.get("success_time").toString(); |
| | | if (tradeState.equals(RefundEnum.SUCCESS.name())) { |
| | | String substring = out_refund_no.substring(0, 2); |
| | | switch (substring){ |
| | | case "GW": |
| | | break; |
| | | |
| | | } |
| | | // TODO 退款成功处理 |
| | | wxV3Pay.ack(); |
| | | } else { |