|
@@ -213,14 +213,13 @@ public abstract class WxPayServiceAbstractImpl implements WxPayService { |
|
|
|
|
|
|
|
|
String timestamp = String.valueOf(System.currentTimeMillis() / 1000); |
|
|
String timestamp = String.valueOf(System.currentTimeMillis() / 1000); |
|
|
String nonceStr = String.valueOf(System.currentTimeMillis()); |
|
|
String nonceStr = String.valueOf(System.currentTimeMillis()); |
|
|
Object payResult = null; |
|
|
|
|
|
switch (request.getTradeType()) { |
|
|
switch (request.getTradeType()) { |
|
|
case TradeType.NATIVE: { |
|
|
case TradeType.NATIVE: { |
|
|
payResult = WxPayNativeOrderResult.builder() |
|
|
|
|
|
|
|
|
return (T) WxPayNativeOrderResult.builder() |
|
|
.codeUrl(unifiedOrderResult.getCodeURL()) |
|
|
.codeUrl(unifiedOrderResult.getCodeURL()) |
|
|
.build(); |
|
|
.build(); |
|
|
break; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
case TradeType.APP: { |
|
|
case TradeType.APP: { |
|
|
// APP支付绑定的是微信开放平台上的账号,APPID为开放平台上绑定APP后发放的参数 |
|
|
// APP支付绑定的是微信开放平台上的账号,APPID为开放平台上绑定APP后发放的参数 |
|
|
String appId = this.getConfig().getAppId(); |
|
|
String appId = this.getConfig().getAppId(); |
|
@@ -235,7 +234,7 @@ public abstract class WxPayServiceAbstractImpl implements WxPayService { |
|
|
configMap.put("noncestr", nonceStr); |
|
|
configMap.put("noncestr", nonceStr); |
|
|
configMap.put("appid", appId); |
|
|
configMap.put("appid", appId); |
|
|
|
|
|
|
|
|
payResult = WxPayAppOrderResult.builder() |
|
|
|
|
|
|
|
|
return (T) WxPayAppOrderResult.builder() |
|
|
.sign(SignUtils.createSign(configMap, null, this.getConfig().getMchKey(), false)) |
|
|
.sign(SignUtils.createSign(configMap, null, this.getConfig().getMchKey(), false)) |
|
|
.prepayId(prepayId) |
|
|
.prepayId(prepayId) |
|
|
.partnerId(partnerId) |
|
|
.partnerId(partnerId) |
|
@@ -244,26 +243,33 @@ public abstract class WxPayServiceAbstractImpl implements WxPayService { |
|
|
.timeStamp(timestamp) |
|
|
.timeStamp(timestamp) |
|
|
.nonceStr(nonceStr) |
|
|
.nonceStr(nonceStr) |
|
|
.build(); |
|
|
.build(); |
|
|
break; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
case TradeType.JSAPI: { |
|
|
case TradeType.JSAPI: { |
|
|
payResult = WxPayMpOrderResult.builder() |
|
|
|
|
|
|
|
|
String signType = SignType.MD5; |
|
|
|
|
|
WxPayMpOrderResult payResult = WxPayMpOrderResult.builder() |
|
|
.appId(unifiedOrderResult.getAppid()) |
|
|
.appId(unifiedOrderResult.getAppid()) |
|
|
.timeStamp(timestamp) |
|
|
.timeStamp(timestamp) |
|
|
.nonceStr(nonceStr) |
|
|
.nonceStr(nonceStr) |
|
|
.packageValue("prepay_id=" + prepayId) |
|
|
.packageValue("prepay_id=" + prepayId) |
|
|
.signType(SignType.MD5) |
|
|
|
|
|
|
|
|
.signType(signType) |
|
|
.build(); |
|
|
.build(); |
|
|
((WxPayMpOrderResult) payResult) |
|
|
|
|
|
.setPaySign(SignUtils.createSign(payResult, null, this.getConfig().getMchKey(), false)); |
|
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
payResult.setPaySign( |
|
|
|
|
|
SignUtils.createSign( |
|
|
|
|
|
payResult, |
|
|
|
|
|
signType, |
|
|
|
|
|
this.getConfig().getMchKey(), |
|
|
|
|
|
false) |
|
|
|
|
|
); |
|
|
|
|
|
return (T) payResult; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
default: { |
|
|
default: { |
|
|
throw new WxPayException("该交易类型暂不支持"); |
|
|
throw new WxPayException("该交易类型暂不支持"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return (T) payResult; |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|