| | |
| | | |
| | | @Resource |
| | | private ChargingOrderClient chargingOrderClient; |
| | | |
| | | |
| | | @Resource |
| | | private ShoppingOrderClient shoppingOrderClient; |
| | | |
| | |
| | | */ |
| | | @ApiOperation("订单退款") |
| | | @PostMapping(value = "refundOrderR") |
| | | public R<String> refundOrderR(@RequestBody WxPaymentRefundModel model) { |
| | | public R<Map<String, Object>> refundOrderR(@RequestBody WxPaymentRefundModel model) { |
| | | Map<String, Object> result = wxV3Pay.refund(model); |
| | | log.info("退款结果:{}", result); |
| | | // 微信支付退款单号 |
| | |
| | | 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); |
| | | return R.ok(result); |
| | | } |
| | | /** |
| | | * 支付回调 |
| | | */ |
| | | @PostMapping("pay/notify") |
| | | @ApiOperation("订单回调") |
| | | public R<Map<String, Object>> payNotify(HttpServletRequest request) throws Exception { |
| | | public void payNotify(HttpServletRequest request) throws Exception { |
| | | try { |
| | | Map<String, Object> params = wxV3Pay.verifyNotify(request, new TypeReference<Map<String, Object>>() {}); |
| | | log.info("支付回调:{}", params); |
| | |
| | | break; |
| | | } |
| | | wxV3Pay.ack(); |
| | | return R.ok(params); |
| | | } catch (Exception e) { |
| | | log.error("支付回调异常:{}", e, e); |
| | | wxV3Pay.ack(false, e.getMessage()); |
| | | return R.fail("回调异常"); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | * 退款回调 |
| | | */ |
| | | @PostMapping("refund/notify") |
| | | public R<WxRefundNotifyResp> refundNotify(HttpServletRequest request) throws IOException { |
| | | public void refundNotify(HttpServletRequest request) throws IOException { |
| | | try { |
| | | Map<String, Object> params = wxV3Pay.verifyNotify(request, new TypeReference<Map<String, Object>>() { |
| | | }); |
| | |
| | | shoppingOrderClient.cancelShoppingOrderWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | System.err.println("----商城订单取消退款回调通知"); |
| | | break; |
| | | //充电订单 |
| | | case "GWF": |
| | | chargingOrderClient.shoppingOrderWxRefund(out_refund_no, refund_id, tradeState, success_time); |
| | | System.err.println("----管理后台取消购物订单退款回调通知"); |
| | | break; |
| | | } |
| | | |
| | | WxRefundNotifyResp resp = new WxRefundNotifyResp(); |
| | |
| | | resp.setRefund_id(refund_id); |
| | | resp.setSuccess_time(success_time); |
| | | wxV3Pay.ack(); |
| | | return R.ok(resp); |
| | | } else { |
| | | wxV3Pay.ack(false, "不是成功的退款状态"); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | wxV3Pay.ack(false, e.getMessage()); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | /** |