|
2 | 2 |
|
3 | 3 | import java.io.IOException; |
4 | 4 | import java.io.InputStream; |
5 | | -import java.net.URLEncoder; |
6 | 5 | import java.security.PrivateKey; |
7 | 6 | import java.security.cert.Certificate; |
8 | 7 | import java.util.Collections; |
|
16 | 15 | import org.apache.http.HttpEntity; |
17 | 16 |
|
18 | 17 | import static com.egzosn.pay.wx.api.WxConst.OUT_TRADE_NO; |
19 | | -import static com.egzosn.pay.wx.api.WxConst.RETURN_CODE; |
20 | | -import static com.egzosn.pay.wx.api.WxConst.RETURN_MSG_CODE; |
21 | 18 | import static com.egzosn.pay.wx.api.WxConst.SANDBOXNEW; |
22 | | -import static com.egzosn.pay.wx.api.WxConst.SUCCESS; |
23 | 19 | import static com.egzosn.pay.wx.v3.utils.WxConst.FAILURE; |
24 | 20 |
|
25 | 21 | import com.alibaba.fastjson.JSON; |
|
51 | 47 | import com.egzosn.pay.common.util.sign.encrypt.RSA2; |
52 | 48 | import com.egzosn.pay.common.util.str.StringUtils; |
53 | 49 | import com.egzosn.pay.wx.bean.WxPayError; |
54 | | -import com.egzosn.pay.wx.v3.bean.response.WxPayMessage; |
55 | 50 | import com.egzosn.pay.wx.bean.WxTransferType; |
56 | 51 | import com.egzosn.pay.wx.v3.bean.WxAccountType; |
57 | 52 | import com.egzosn.pay.wx.v3.bean.WxBillType; |
|
60 | 55 | import com.egzosn.pay.wx.v3.bean.order.RefundAmount; |
61 | 56 | import com.egzosn.pay.wx.v3.bean.response.Resource; |
62 | 57 | import com.egzosn.pay.wx.v3.bean.response.WxNoticeParams; |
| 58 | +import com.egzosn.pay.wx.v3.bean.response.WxPayMessage; |
63 | 59 | import com.egzosn.pay.wx.v3.bean.response.WxRefundResult; |
64 | 60 | import com.egzosn.pay.wx.v3.utils.AntCertificationUtil; |
65 | 61 | import com.egzosn.pay.wx.v3.utils.WxConst; |
@@ -402,14 +398,8 @@ public PayOutMessage successPayOutMessage(PayMessage payMessage) { |
402 | 398 | */ |
403 | 399 | @Override |
404 | 400 | public String buildRequest(Map<String, Object> orderInfo, MethodType method) { |
405 | | - if (!SUCCESS.equals(orderInfo.get(RETURN_CODE))) { |
406 | | - throw new PayErrorException(new WxPayError((String) orderInfo.get(RETURN_CODE), (String) orderInfo.get(RETURN_MSG_CODE))); |
407 | | - } |
408 | | - if (WxTransactionType.H5.name().equals(orderInfo.get("trade_type"))) { |
409 | | - return String.format("<script type=\"text/javascript\">location.href=\"%s%s\"</script>", orderInfo.get("mweb_url"), StringUtils.isEmpty(payConfigStorage.getReturnUrl()) ? "" : "&redirect_url=" + URLEncoder.encode(payConfigStorage.getReturnUrl())); |
410 | | - } |
411 | | - throw new UnsupportedOperationException(); |
412 | | - |
| 401 | + String redirectUrl = StringUtils.isEmpty(payConfigStorage.getReturnUrl()) ? "" : "&redirect_url=" + UriVariables.urlEncoder(payConfigStorage.getReturnUrl()); |
| 402 | + return String.format("<script type=\"text/javascript\">location.href=\"%s%s\"</script>", orderInfo.get("h5_url"), redirectUrl); |
413 | 403 | } |
414 | 404 |
|
415 | 405 | /** |
|
0 commit comments