|
@@ -178,12 +178,12 @@ public class WxProviderServiceImpl implements WxProviderService {
|
|
|
String url = wechatPayServiceConfig.getBaseUrl().concat(CombinePayUrlEnum.DOMESTIC_REFUNDS.getType());
|
|
|
Map<String, Object> params = new HashMap<>(2);
|
|
|
params.put("out_trade_no", orderNo);
|
|
|
- params.put("sub_mchid", wechatPayServiceConfig.getSubAppId());
|
|
|
+ params.put("sub_mchid", wechatPayServiceConfig.getSubMchId());
|
|
|
String outRefundNo = OrderUtils.getOrderNo("TK");
|
|
|
log.info("退款申请号:{}", outRefundNo);
|
|
|
params.put("out_refund_no", outRefundNo);
|
|
|
params.put("reason", "申请退款");
|
|
|
- params.put("notify_url", wechatPayServiceConfig.getRefundNotifyUrl());
|
|
|
+ params.put("notify_url", "http://he56cd66.natappfree.cc/notice/pay/order/refundNotify");
|
|
|
Map<String, Object> amountMap = new HashMap<>();
|
|
|
//退款金额,单位:分
|
|
|
amountMap.put("refund", refundMoney);
|
|
@@ -387,6 +387,29 @@ public class WxProviderServiceImpl implements WxProviderService {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void refundNotifyParse(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ JSONObject bodyJson = getNotifyBodyJson(request);
|
|
|
+ if (lock.tryLock()) {
|
|
|
+ try {
|
|
|
+ // 解密resource中的通知数据
|
|
|
+ String resource = bodyJson.getString("resource");
|
|
|
+ JSONObject resourceJson = WechatPayValidator.decryptFromResource(resource, wechatPayServiceConfig.getApiV3Key());
|
|
|
+ System.out.println("=================== 服务商小程序退款回调解密resource中的通知数据 ===================\n" + resource);
|
|
|
+ if (resourceJson.getString("refund_status").equals("SUCCESS")) {
|
|
|
+ //TODO 业务处理
|
|
|
+ resourceJson.get("out_trade_no");
|
|
|
+ resourceJson.get("transaction_id");
|
|
|
+ resourceJson.get("out_refund_no");
|
|
|
+ resourceJson.get("refund_id");
|
|
|
+ }
|
|
|
+
|
|
|
+ } finally {
|
|
|
+ lock.unlock();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private JSONObject getNotifyBodyJson(HttpServletRequest request) {
|
|
|
String body = WechatPayValidator.readData(request);
|
|
|
log.info("===========微信回调参数===========\n" + body);
|