|
|
|
@ -23,6 +23,7 @@ import com.github.binarywang.wxpay.bean.notify.WxPayNotifyV3Result;
|
|
|
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
|
|
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
|
|
|
|
import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyV3Result;
|
|
|
|
|
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
|
|
|
|
|
import com.github.binarywang.wxpay.bean.request.*;
|
|
|
|
|
import com.github.binarywang.wxpay.bean.result.*;
|
|
|
|
|
import com.github.binarywang.wxpay.config.WxPayConfig;
|
|
|
|
@ -168,7 +169,19 @@ public abstract class AbstractWxPayClient extends AbstractPayClient<WxPayClientC
|
|
|
|
|
|
|
|
|
|
private PayOrderRespDTO doParseOrderNotifyV2(String body) throws WxPayException {
|
|
|
|
|
// 1. 解析回调
|
|
|
|
|
WxPayOrderNotifyResult response = client.parseOrderNotifyResult(body);
|
|
|
|
|
// WxPayOrderNotifyResult response = client.parseOrderNotifyResult(body);
|
|
|
|
|
|
|
|
|
|
JSONObject paramMap = new JSONObject();
|
|
|
|
|
paramMap.put("appid", config.getAppId());
|
|
|
|
|
paramMap.put("mchid", config.getMchId());
|
|
|
|
|
paramMap.put("keyString", config.getKeyContent());
|
|
|
|
|
paramMap.put("apiv2", config.getMchKey());
|
|
|
|
|
paramMap.put("body",body);
|
|
|
|
|
String json = HttpRequest.post("http://alipay.huamar.com/pay/order/parseOrderNotifyResult")
|
|
|
|
|
.body(paramMap.toJSONString())
|
|
|
|
|
.execute().body();
|
|
|
|
|
WxPayOrderNotifyResult response = JSONObject.parseObject(JSONObject.parseObject(json).getString("data"), WxPayOrderNotifyResult.class);
|
|
|
|
|
|
|
|
|
|
// 2. 构建结果
|
|
|
|
|
// V2 微信支付的回调,只有 SUCCESS 支付成功、CLOSED 支付失败两种情况,无需像支付宝一样解析的比较复杂
|
|
|
|
|
Integer status = Objects.equals(response.getResultCode(), "SUCCESS") ?
|
|
|
|
@ -353,7 +366,19 @@ public abstract class AbstractWxPayClient extends AbstractPayClient<WxPayClientC
|
|
|
|
|
|
|
|
|
|
private PayRefundRespDTO doParseRefundNotifyV2(String body) throws WxPayException {
|
|
|
|
|
// 1. 解析回调
|
|
|
|
|
WxPayRefundNotifyResult response = client.parseRefundNotifyResult(body);
|
|
|
|
|
// WxPayRefundNotifyResult response = client.parseRefundNotifyResult(body);
|
|
|
|
|
|
|
|
|
|
JSONObject paramMap = new JSONObject();
|
|
|
|
|
paramMap.put("appid", config.getAppId());
|
|
|
|
|
paramMap.put("mchid", config.getMchId());
|
|
|
|
|
paramMap.put("keyString", config.getKeyContent());
|
|
|
|
|
paramMap.put("apiv2", config.getMchKey());
|
|
|
|
|
paramMap.put("body",body);
|
|
|
|
|
String json = HttpRequest.post("http://alipay.huamar.com/pay/order/parseRefundNotifyResult")
|
|
|
|
|
.body(paramMap.toJSONString())
|
|
|
|
|
.execute().body();
|
|
|
|
|
WxPayRefundNotifyResult response = JSONObject.parseObject(JSONObject.parseObject(json).getString("data"), WxPayRefundNotifyResult.class);
|
|
|
|
|
|
|
|
|
|
WxPayRefundNotifyResult.ReqInfo result = response.getReqInfo();
|
|
|
|
|
// 2. 构建结果
|
|
|
|
|
if (Objects.equals("SUCCESS", result.getRefundStatus())) {
|
|
|
|
|