|
@@ -202,7 +202,6 @@ public class WxPayService extends PayBaseService {
|
|
|
|
|
|
private ResultMap miniAppPay(ProductPayParamBO product) {
|
|
|
try {
|
|
|
- Map<Object, Object> miniMap = new HashMap<>(5);
|
|
|
//获取用户openId
|
|
|
String openId = wxApiService.getMpOpenId(product.getCode(), config.getAppId(), config.getAppSecret());
|
|
|
//下单
|
|
@@ -222,24 +221,29 @@ public class WxPayService extends PayBaseService {
|
|
|
map.put("signType", config.getSignType());
|
|
|
// 再次签名sign,这个签名用于小程序端调用支付方法
|
|
|
String sign = WxPayUtil.generateSignature(map, config.getApiKey());
|
|
|
- //组装返回结果
|
|
|
- miniMap.put("paySign", sign);
|
|
|
- miniMap.put("signType", config.getSignType());
|
|
|
- miniMap.put("timeStamp", createTime);
|
|
|
- miniMap.put("nonceStr", nonceStr);
|
|
|
- miniMap.put("package", successMap);
|
|
|
+ //组装支付参数
|
|
|
+ Map<Object, Object> payParamMap = new HashMap<>(5);
|
|
|
+ payParamMap.put("paySign", sign);
|
|
|
+ payParamMap.put("signType", config.getSignType());
|
|
|
+ payParamMap.put("timeStamp", createTime);
|
|
|
+ payParamMap.put("nonceStr", nonceStr);
|
|
|
+ payParamMap.put("package", successMap);
|
|
|
//保存订单支付参数
|
|
|
orderPayParamService.save(OrderPayParam.builder()
|
|
|
.orderId(product.getOutTradeNo())
|
|
|
.amount(new BigDecimal(product.getTotalFee()))
|
|
|
.appId(config.getAppId())
|
|
|
- .payParam(JsonUtil.toString(miniMap))
|
|
|
+ .payParam(JsonUtil.toString(payParamMap))
|
|
|
.isDelete(DeleteEnum.NO.getCode())
|
|
|
.createTime(LocalDateTime.now())
|
|
|
.updateTime(LocalDateTime.now())
|
|
|
.build());
|
|
|
//返回
|
|
|
- return ResultMap.ok(miniMap);
|
|
|
+ Map<Object, Object> resultMap = new HashMap<>(3);
|
|
|
+ resultMap.put("appId", config.getAppId());
|
|
|
+ resultMap.put("path", "pages/gamePay/index");
|
|
|
+ resultMap.put("orderId", product.getOutTradeNo());
|
|
|
+ return ResultMap.ok(resultMap);
|
|
|
} catch (Exception e) {
|
|
|
log.error("微信小程序支付通信异常, 订单号:{}, e : {}", product.getOutTradeNo(), e.getMessage());
|
|
|
return ResultMap.error();
|