| | |
| | | import com.ruoyi.other.api.feignClient.CouponClient; |
| | | import com.ruoyi.other.api.feignClient.GoodsClient; |
| | | import com.ruoyi.payment.api.feignClient.AliPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.IcbcPaymentClient; |
| | | import com.ruoyi.payment.api.feignClient.WxPaymentClient; |
| | | import com.ruoyi.payment.api.model.RefundReq; |
| | | import com.ruoyi.payment.api.model.RefundResp; |
| | | import com.ruoyi.payment.api.model.WxPaymentRefundModel; |
| | | import com.ruoyi.payment.api.vo.WxRefundNotifyResp; |
| | | import com.ruoyi.payment.api.vo.IcbcRefundReq; |
| | | import com.ruoyi.payment.api.vo.IcbcRefundResp; |
| | | import com.ruoyi.system.api.domain.SysUser; |
| | | import com.ruoyi.system.api.feignClient.SysUserClient; |
| | | import io.swagger.annotations.Api; |
| | |
| | | private AliPaymentClient aliPaymentClient; |
| | | @Resource |
| | | private WxPaymentClient wxPaymentClient; |
| | | @Resource |
| | | private IcbcPaymentClient icbcPaymentClient; |
| | | @Resource |
| | | private AppCouponClient appCouponClient; |
| | | @Resource |
| | |
| | | tShoppingOrderRefund.setPayTime(byId.getPayTime()); |
| | | tShoppingOrderRefund.setPayCode(byId.getSerialNumber()); |
| | | tShoppingOrderRefund.setPayAmount(byId.getPaymentAmount()); |
| | | tShoppingOrderRefund.setPayType(1); |
| | | tShoppingOrderRefund.setPayType(byId.getPaymentType()); |
| | | tShoppingOrderRefund.setShoppingOrderId(byId.getId()); |
| | | tShoppingOrderRefund.setRefundAmount(byId.getPaymentAmount()); |
| | | tShoppingOrderRefund.setRefundStatus(1); |
| | |
| | | shoppingOrderService.updateById(byId); |
| | | } |
| | | break; |
| | | case 3: |
| | | IcbcRefundReq icbcRefundReq = new IcbcRefundReq(); |
| | | icbcRefundReq.setOutTradeNo(byId.getCode()); |
| | | icbcRefundReq.setOrderId(byId.getSerialNumber()); |
| | | icbcRefundReq.setOutRefundNo(tShoppingOrderRefund.getCode()); |
| | | icbcRefundReq.setRefundAmount(byId.getPaymentAmount()); |
| | | icbcRefundReq.setTotalAmount(byId.getPaymentAmount()); |
| | | icbcRefundReq.setReason("后台购物订单退款"); |
| | | R<IcbcRefundResp> icbcRefundResult = icbcPaymentClient.refund(icbcRefundReq); |
| | | IcbcRefundResp icbcRefundResp = icbcRefundResult == null ? null : icbcRefundResult.getData(); |
| | | if (icbcRefundResult == null || icbcRefundResult.getCode() != 200 || icbcRefundResp == null || !"SUCCESS".equals(icbcRefundResp.getStatus())) { |
| | | return AjaxResult.error(icbcRefundResult == null ? "工行退款服务无响应" : icbcRefundResult.getMsg()); |
| | | } |
| | | tShoppingOrderRefund.setRefundStatus(2); |
| | | tShoppingOrderRefund.setRefundSerialNumber(icbcRefundResp.getRefundId()); |
| | | tShoppingOrderRefund.setRefundTime(LocalDateTime.now()); |
| | | shoppingOrderRefundService.save(tShoppingOrderRefund); |
| | | byId.setStatus(4); |
| | | byId.setRefundCode(tShoppingOrderRefund.getCode()); |
| | | byId.setRefundAmount(byId.getPaymentAmount()); |
| | | byId.setRefundStatus(2); |
| | | byId.setRefundSerialNumber(icbcRefundResp.getRefundId()); |
| | | byId.setRefundTime(LocalDateTime.now()); |
| | | break; |
| | | } |
| | | shoppingOrderService.updateById(byId); |
| | | return AjaxResult.success(); |