Skip to content

Commit 228b379

Browse files
committed
#247 统一下单接口支持H5支付,并去掉交易类型trade_type的校验
1 parent 563302e commit 228b379

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/request/WxPayUnifiedOrderRequest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
*/
2828
@XStreamAlias("xml")
2929
public class WxPayUnifiedOrderRequest extends WxPayBaseRequest {
30-
private static final String[] TRADE_TYPES = new String[]{"JSAPI", "NATIVE", "APP"};
30+
private static final String[] TRADE_TYPES = new String[]{"JSAPI", "NATIVE", "APP","MWEB"};
3131

3232
/**
3333
* <pre>
@@ -443,10 +443,10 @@ public void setOpenid(String openid) {
443443

444444
@Override
445445
protected void checkConstraints() {
446-
if (!ArrayUtils.contains(TRADE_TYPES, this.getTradeType())) {
447-
throw new IllegalArgumentException(String.format("trade_type目前必须为%s其中之一,实际值:%s",
448-
Arrays.toString(TRADE_TYPES), this.getTradeType()));
449-
}
446+
// if (!ArrayUtils.contains(TRADE_TYPES, this.getTradeType())) {
447+
// throw new IllegalArgumentException(String.format("trade_type目前必须为%s其中之一,实际值:%s",
448+
// Arrays.toString(TRADE_TYPES), this.getTradeType()));
449+
// }
450450

451451
if ("JSAPI".equals(this.getTradeType()) && this.getOpenid() == null) {
452452
throw new IllegalArgumentException("当 trade_type是'JSAPI'时未指定openid");

weixin-java-pay/src/main/java/com/github/binarywang/wxpay/bean/result/WxPayUnifiedOrderResult.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ public class WxPayUnifiedOrderResult extends WxPayBaseResult {
2525
@XStreamAlias("trade_type")
2626
private String tradeType;
2727

28+
/**
29+
* mweb_url 支付跳转链接
30+
*/
31+
@XStreamAlias("mweb_url")
32+
private String mwebUrl;
33+
2834
/**
2935
* trade_type为NATIVE时有返回,用于生成二维码,展示给用户进行扫码支付
3036
*/
@@ -54,4 +60,12 @@ public String getCodeURL() {
5460
public void setCodeURL(String codeURL) {
5561
this.codeURL = codeURL;
5662
}
63+
64+
public String getMwebUrl() {
65+
return mwebUrl;
66+
}
67+
68+
public void setMwebUrl(String mwebUrl) {
69+
this.mwebUrl = mwebUrl;
70+
}
5771
}

0 commit comments

Comments
 (0)