Skip to content

Commit

Permalink
#247 统一下单接口支持H5支付,并去掉交易类型trade_type的校验
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Jun 10, 2017
1 parent 563302e commit 228b379
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
@XStreamAlias("xml")
public class WxPayUnifiedOrderRequest extends WxPayBaseRequest {
private static final String[] TRADE_TYPES = new String[]{"JSAPI", "NATIVE", "APP"};
private static final String[] TRADE_TYPES = new String[]{"JSAPI", "NATIVE", "APP","MWEB"};

/**
* <pre>
Expand Down Expand Up @@ -443,10 +443,10 @@ public void setOpenid(String openid) {

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

if ("JSAPI".equals(this.getTradeType()) && this.getOpenid() == null) {
throw new IllegalArgumentException("当 trade_type是'JSAPI'时未指定openid");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ public class WxPayUnifiedOrderResult extends WxPayBaseResult {
@XStreamAlias("trade_type")
private String tradeType;

/**
* mweb_url 支付跳转链接
*/
@XStreamAlias("mweb_url")
private String mwebUrl;

/**
* trade_type为NATIVE时有返回,用于生成二维码,展示给用户进行扫码支付
*/
Expand Down Expand Up @@ -54,4 +60,12 @@ public String getCodeURL() {
public void setCodeURL(String codeURL) {
this.codeURL = codeURL;
}

public String getMwebUrl() {
return mwebUrl;
}

public void setMwebUrl(String mwebUrl) {
this.mwebUrl = mwebUrl;
}
}

0 comments on commit 228b379

Please sign in to comment.