File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 152152 <dependency >
153153 <groupId >org.apache.commons</groupId >
154154 <artifactId >commons-lang3</artifactId >
155- <version >3.6 </version >
155+ <version >3.5 </version >
156156 </dependency >
157157 <dependency >
158158 <groupId >org.slf4j</groupId >
Original file line number Diff line number Diff line change @@ -333,12 +333,18 @@ public void setTradeType(String tradeType) {
333333
334334 @ Override
335335 protected void checkConstraints () throws WxPayException {
336- if (TradeType .JSAPI .equals (this .getTradeType ()) && this .getOpenid () == null && this .getSubOpenid () == null ) {
337- throw new WxPayException ("当 trade_type是'JSAPI'时未指定openid或sub_openid" );
336+ if (TradeType .JSAPI .equals (this .getTradeType ())) {
337+ if (StringUtils .isBlank (this .getSubAppId ()) && StringUtils .isBlank (this .getOpenid ())) {
338+ throw new WxPayException ("当trade_type是'JSAPI'时,需指定非空的openid值" );
339+ }
340+
341+ if (StringUtils .isNotBlank (this .getSubAppId ()) && StringUtils .isBlank (this .getSubOpenid ())) {
342+ throw new WxPayException ("在服务商模式下,当trade_type是'JSAPI'时,需指定非空的sub_openid值" );
343+ }
338344 }
339345
340- if (TradeType .NATIVE .equals (this .getTradeType ()) && this .getProductId () == null ) {
341- throw new WxPayException ("当 trade_type是 'NATIVE'时未指定product_id " );
346+ if (TradeType .NATIVE .equals (this .getTradeType ()) && StringUtils . isBlank ( this .getProductId ()) ) {
347+ throw new WxPayException ("当trade_type是 'NATIVE'时,需指定非空的product_id值 " );
342348 }
343349 }
344350
You can’t perform that action at this time.
0 commit comments