| | |
| | | import com.doumee.dao.system.model.SystemDictData; |
| | | import com.wechat.pay.java.service.refund.model.AmountReq; |
| | | import com.wechat.pay.java.service.refund.model.CreateRequest; |
| | | import com.wechat.pay.java.service.refund.model.QueryByOutRefundNoRequest; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import okhttp3.OkHttpClient; |
| | | import okhttp3.Request; |
| | |
| | | amountReq.setCurrency("CNY"); |
| | | request.setAmount(amountReq); |
| | | try { |
| | | log.error("=============="+JSONObject.toJSONString(request)); |
| | | com.wechat.pay.java.service.refund.model.Refund response = WxMiniConfig.refundService.create(request); |
| | | log.error("=============="+JSONObject.toJSONString(response)); |
| | | if ("SUCCESS".equals(response.getStatus().name()) |
| | | || "PROCESSING".equals(response.getStatus().name()) ) { |
| | | return true; |
| | |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,退款申请失败!"); |
| | | } |
| | | |
| | | } |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public com.wechat.pay.java.service.refund.model.Refund isSuucessRefund(String outTradeNo) { |
| | | // 发送退款请求 |
| | | |
| | | QueryByOutRefundNoRequest request = new QueryByOutRefundNoRequest(); |
| | | request.setOutRefundNo(outTradeNo); |
| | | request.setSubMchid(WxMiniConfig.wxProperties.getSubMchId()); |
| | | try { |
| | | log.error("=============="+JSONObject.toJSONString(request)); |
| | | com.wechat.pay.java.service.refund.model.Refund response = WxMiniConfig.refundService.queryByOutRefundNo(request); |
| | | log.error("=============="+JSONObject.toJSONString(response)); |
| | | if ("SUCCESS".equals(response.getStatus().name()) |
| | | || "PROCESSING".equals(response.getStatus().name()) ) { |
| | | return response; |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | |
| | | } |
| | | return null; |
| | | } |
| | | public Refund wxRefundOld(RefundDTO refundDTO) { |
| | | // 发送退款请求 |
| | |
| | | body.put("scene", locks.getSiteId() + "/" +locks.getCode() ); |
| | | // 正式版为 "release",体验版为 "trial",开发版为 "develop"。默认是正式版。 |
| | | body.put("env_version", "release"); |
| | | body.put("env_version", "trial"); |
| | | // 透明,根据你的场景自行设置body参数 |
| | | body.put("is_hyaline", false); |
| | | body.put("check_path", false); |