支持http
This commit is contained in:
1 parent
77eece5e90
commit
ceb8807273
1 file changed
+6
-4
+6
-4
@@ -117,9 +117,9 @@ public class SysUsdtDemoController {
|
||||
params.put("walletUserName", normalizeWalletUserName(walletUserName));
|
||||
params.put("amount", paymentAmount.toPlainString());
|
||||
params.put("notify_url", normalizeCallbackUrl(notifyUrl, optionalEnv("PAYMENT_NOTIFY_URL",
|
||||
contextPath + "/system/demoUsdt/notify"), "异步回调地址"));
|
||||
contextPath + "/system/demoUsdt/notify"), "异步回调地址", true));
|
||||
params.put("redirect_url", normalizeCallbackUrl(redirectUrl, optionalEnv("PAYMENT_REDIRECT_URL",
|
||||
contextPath + "/system/demoUsdt/redirect"), "跳转地址"));
|
||||
contextPath + "/system/demoUsdt/redirect"), "跳转地址", true));
|
||||
|
||||
return AjaxResult.success(sendEncryptedRequest(apiUrl, params, "创建支付订单失败"));
|
||||
} catch (RestClientResponseException ex) {
|
||||
@@ -259,10 +259,12 @@ public class SysUsdtDemoController {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private String normalizeCallbackUrl(String value, String defaultValue, String label) {
|
||||
private String normalizeCallbackUrl(String value, String defaultValue, String label,
|
||||
boolean allowHttp) {
|
||||
if (StringUtils.isBlank(value)) return defaultValue;
|
||||
String normalized = value.trim();
|
||||
if (normalized.length() > 512 || !(normalized.startsWith("https://")
|
||||
if (normalized.length() > 512 || !((allowHttp && normalized.startsWith("http://"))
|
||||
|| normalized.startsWith("https://")
|
||||
|| normalized.startsWith("http://localhost")
|
||||
|| normalized.startsWith("http://127.0.0.1"))) {
|
||||
throw new CustomException(label + "必须使用HTTPS");
|
||||
|
||||
Reference in new issue
Block a user