|
@@ -80,26 +80,16 @@ public class NewPayServiceImpl implements NewPayService {
|
|
|
throw new SqxException("当前订单已超时关闭,请重新下单!");
|
|
throw new SqxException("当前订单已超时关闭,请重新下单!");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ if (BigDecimal.valueOf(payDetails.getMoney()).compareTo(dto.getAmount()) != 0) {
|
|
|
|
|
+ throw new SqxException("支付金额检验失败,请清空购车后重试!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return JSONUtil.toBean(payDetails.getRemark(), WechatTransactionsParamVO.class);
|
|
return JSONUtil.toBean(payDetails.getRemark(), WechatTransactionsParamVO.class);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
WechatPayConfig wechatMchConfig = getWechatMchConfig();
|
|
WechatPayConfig wechatMchConfig = getWechatMchConfig();
|
|
|
-
|
|
|
|
|
- // h5服务域名配置
|
|
|
|
|
- String notifyUrl = wechatMchConfig.getH5Url() + "/sqx_fast/app/new-pay/wechat-pay/notify";
|
|
|
|
|
-
|
|
|
|
|
RhtQrcodePayApi qrcodePay = new RhtQrcodePayApi(wechatMchConfig.getMchId(), wechatMchConfig.getMchKey(), RHT_PAY_BASE_URL);
|
|
RhtQrcodePayApi qrcodePay = new RhtQrcodePayApi(wechatMchConfig.getMchId(), wechatMchConfig.getMchKey(), RHT_PAY_BASE_URL);
|
|
|
- QrcodeOpenPayRequestBean openRequest = new QrcodeOpenPayRequestBean();
|
|
|
|
|
- openRequest.setAmount(dto.getAmount().toString());
|
|
|
|
|
- openRequest.setTraceno(dto.getOrderNo());
|
|
|
|
|
- openRequest.setPayType(Constant.PAY_TYPE_WECHAT);
|
|
|
|
|
- openRequest.setGoodsName(dto.getOrderDesc());
|
|
|
|
|
- openRequest.setNotifyUrl(notifyUrl);
|
|
|
|
|
-
|
|
|
|
|
- // 小程序支付,固定填1
|
|
|
|
|
- openRequest.setCallType("1");
|
|
|
|
|
- openRequest.setAppid(wechatMchConfig.getAppId());
|
|
|
|
|
- openRequest.setOpenid(dto.getUserThirdId());
|
|
|
|
|
|
|
+ QrcodeOpenPayRequestBean openRequest = getQrcodeOpenPayRequestBean(dto, wechatMchConfig);
|
|
|
|
|
|
|
|
WechatTransactionsParamVO wechatPayParamVO;
|
|
WechatTransactionsParamVO wechatPayParamVO;
|
|
|
try {
|
|
try {
|
|
@@ -121,6 +111,31 @@ public class NewPayServiceImpl implements NewPayService {
|
|
|
return wechatPayParamVO;
|
|
return wechatPayParamVO;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 创建支付请求参数
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param dto 包含支付参数的数据传输对象
|
|
|
|
|
+ * @param wechatMchConfig 微信商户配置信息
|
|
|
|
|
+ * @return 返回一个填充了支付信息的QrcodeOpenPayRequestBean对象
|
|
|
|
|
+ */
|
|
|
|
|
+ private QrcodeOpenPayRequestBean getQrcodeOpenPayRequestBean(GetPayParamDTO dto, WechatPayConfig wechatMchConfig) {
|
|
|
|
|
+ String notifyUrl = wechatMchConfig.getH5Url() + "/sqx_fast/app/new-pay/wechat-pay/notify";
|
|
|
|
|
+
|
|
|
|
|
+ QrcodeOpenPayRequestBean openRequest = new QrcodeOpenPayRequestBean();
|
|
|
|
|
+ openRequest.setAmount(dto.getAmount().toString());
|
|
|
|
|
+ openRequest.setTraceno(dto.getOrderNo());
|
|
|
|
|
+ openRequest.setPayType(Constant.PAY_TYPE_WECHAT);
|
|
|
|
|
+ openRequest.setGoodsName(dto.getOrderDesc());
|
|
|
|
|
+ // 设置支付通知地址
|
|
|
|
|
+ openRequest.setNotifyUrl(notifyUrl);
|
|
|
|
|
+ // 小程序支付,固定填1
|
|
|
|
|
+ openRequest.setCallType("1");
|
|
|
|
|
+ openRequest.setAppid(wechatMchConfig.getAppId());
|
|
|
|
|
+ openRequest.setOpenid(dto.getUserThirdId());
|
|
|
|
|
+
|
|
|
|
|
+ return openRequest;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public boolean wechatRefund(String orderNo) {
|
|
public boolean wechatRefund(String orderNo) {
|
|
|
WechatPayConfig wechatMchConfig = getWechatMchConfig();
|
|
WechatPayConfig wechatMchConfig = getWechatMchConfig();
|
|
@@ -142,9 +157,8 @@ public class NewPayServiceImpl implements NewPayService {
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
- log.error("订单【{}】退款失败,失败原因:{}", orderNo, e.getMessage());
|
|
|
|
|
|
|
+ throw new SqxException("订单【" + orderNo + "】退款失败,失败原因:" + e.getMessage());
|
|
|
}
|
|
}
|
|
|
- return false;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|