|
|
|
@ -39,18 +39,14 @@ public class WeChatPayProcessor extends IChannelPayService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, String> prepay(PaymentChannelOrder paymentChannelOrder, |
|
|
|
List<ThirdPartyField> fieldList, |
|
|
|
Long appFrom) { |
|
|
|
// 获取账号 |
|
|
|
String jsCode = ThirdPartyField.findFiledValueByKey(ThirdPartyField.JS_CODE, fieldList); |
|
|
|
GetWechatSessionDto sessionDto = new GetWechatSessionDto(jsCode, appFrom); |
|
|
|
WeChatAppletUserSessionVo sessionVo = uecServerApplicationService.getWechatSession(sessionDto); |
|
|
|
String platformAppId, |
|
|
|
String openId) { |
|
|
|
|
|
|
|
try { |
|
|
|
Map<String, Object> reqParams = new HashMap<>(); |
|
|
|
reqParams.put("mchid", mchId); |
|
|
|
reqParams.put("out_trade_no", paymentChannelOrder.getId().toString()); |
|
|
|
reqParams.put("appid", sessionVo.getPlatformAppId()); |
|
|
|
reqParams.put("appid", platformAppId); |
|
|
|
reqParams.put("description", paymentChannelOrder.getComment()); |
|
|
|
reqParams.put("notify_url", notifyUrl); |
|
|
|
reqParams.put("amount", new HashMap<String, Object>() { |
|
|
|
@ -61,7 +57,7 @@ public class WeChatPayProcessor extends IChannelPayService { |
|
|
|
}); |
|
|
|
reqParams.put("payer", new HashMap<String, Object>() { |
|
|
|
{ |
|
|
|
put("openid", sessionVo.getOpenid()); |
|
|
|
put("openid", openId); |
|
|
|
} |
|
|
|
}); |
|
|
|
JSONObject result = wxPayV3Util.doPostWeiXinV3(WXPayV3Util.api_v3_placeAnOrder_url, JSONUtil.toJsonStr(reqParams)); |
|
|
|
@ -75,14 +71,14 @@ public class WeChatPayProcessor extends IChannelPayService { |
|
|
|
long timestamp = System.currentTimeMillis() / 1000; |
|
|
|
String sign; |
|
|
|
try { |
|
|
|
sign = wxPayV3Util.sign(sessionVo.getPlatformAppId(), timestamp, nonceStr, "prepay_id=" + prepayId); |
|
|
|
sign = wxPayV3Util.sign(platformAppId, timestamp, nonceStr, "prepay_id=" + prepayId); |
|
|
|
} catch (Exception e) { |
|
|
|
log.error(" sign fail AppV3PayStrategyImpl {}", e.getMessage(), e); |
|
|
|
throw new BizException("生成签名错误:" + e.getMessage()); |
|
|
|
} |
|
|
|
log.info("sign____________________" + sign); |
|
|
|
Map<String, String> returnMap = new HashMap<>(); |
|
|
|
returnMap.put("appId", sessionVo.getPlatformAppId()); |
|
|
|
returnMap.put("appId", platformAppId); |
|
|
|
returnMap.put("nonceStr", nonceStr); |
|
|
|
returnMap.put("timeStamp", String.valueOf(timestamp)); |
|
|
|
returnMap.put("packages", "prepay_id=" + prepayId); |
|
|
|
|