mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 02:28:25 +08:00 
			
		
		
		
	#555 修复微信支付服务商模式支付验证签名失败的问题
This commit is contained in:
		| @ -20,7 +20,7 @@ public class WxPayMpOrderResult { | |||||||
|   private String timeStamp; |   private String timeStamp; | ||||||
|   private String nonceStr; |   private String nonceStr; | ||||||
|   /** |   /** | ||||||
|    * 由于package为java保留关键字,因此改为packageValue |    * 由于package为java保留关键字,因此改为packageValue. | ||||||
|    */ |    */ | ||||||
|   @XStreamAlias("package") |   @XStreamAlias("package") | ||||||
|   private String packageValue; |   private String packageValue; | ||||||
|  | |||||||
| @ -311,8 +311,12 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { | |||||||
|  |  | ||||||
|       case TradeType.APP: { |       case TradeType.APP: { | ||||||
|         // APP支付绑定的是微信开放平台上的账号,APPID为开放平台上绑定APP后发放的参数 |         // APP支付绑定的是微信开放平台上的账号,APPID为开放平台上绑定APP后发放的参数 | ||||||
|         String appId = this.getConfig().getAppId(); |         String appId = unifiedOrderResult.getAppid(); | ||||||
|         Map<String, String> configMap = new HashMap<>(); |         if (StringUtils.isNotEmpty(unifiedOrderResult.getSubAppId())) { | ||||||
|  |           appId = unifiedOrderResult.getSubAppId(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         Map<String, String> configMap = new HashMap<>(8); | ||||||
|         // 此map用于参与调起sdk支付的二次签名,格式全小写,timestamp只能是10位,格式固定,切勿修改 |         // 此map用于参与调起sdk支付的二次签名,格式全小写,timestamp只能是10位,格式固定,切勿修改 | ||||||
|         String partnerId = getConfig().getMchId(); |         String partnerId = getConfig().getMchId(); | ||||||
|         configMap.put("prepayid", prepayId); |         configMap.put("prepayid", prepayId); | ||||||
| @ -336,21 +340,20 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { | |||||||
|  |  | ||||||
|       case TradeType.JSAPI: { |       case TradeType.JSAPI: { | ||||||
|         String signType = SignType.MD5; |         String signType = SignType.MD5; | ||||||
|  |         String appid = unifiedOrderResult.getAppid(); | ||||||
|  |         if (StringUtils.isNotEmpty(this.getConfig().getSubAppId())) { | ||||||
|  |           appid = this.getConfig().getSubAppId(); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         WxPayMpOrderResult payResult = WxPayMpOrderResult.builder() |         WxPayMpOrderResult payResult = WxPayMpOrderResult.builder() | ||||||
|           .appId(unifiedOrderResult.getAppid()) |           .appId(appid) | ||||||
|           .timeStamp(timestamp) |           .timeStamp(timestamp) | ||||||
|           .nonceStr(nonceStr) |           .nonceStr(nonceStr) | ||||||
|           .packageValue("prepay_id=" + prepayId) |           .packageValue("prepay_id=" + prepayId) | ||||||
|           .signType(signType) |           .signType(signType) | ||||||
|           .build(); |           .build(); | ||||||
|  |  | ||||||
|         payResult.setPaySign( |         payResult.setPaySign(SignUtils.createSign(payResult, signType, this.getConfig().getMchKey(), false)); | ||||||
|           SignUtils.createSign( |  | ||||||
|             payResult, |  | ||||||
|             signType, |  | ||||||
|             this.getConfig().getMchKey(), |  | ||||||
|             false) |  | ||||||
|         ); |  | ||||||
|         return (T) payResult; |         return (T) payResult; | ||||||
|       } |       } | ||||||
|  |  | ||||||
| @ -534,7 +537,7 @@ public abstract class BaseWxPayServiceImpl implements WxPayService { | |||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     } catch (Exception e) { |     } catch (Exception e) { | ||||||
|       this.log.error("解析对账单文件时出错",e); |       this.log.error("解析对账单文件时出错", e); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     return null; |     return null; | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang