支付宝新增自定义URL

This commit is contained in:
egan
2023-09-12 22:33:49 +08:00
parent 84cf034338
commit c51499a646
3 changed files with 30 additions and 1 deletions

View File

@@ -65,6 +65,11 @@ import com.egzosn.pay.common.util.str.StringUtils;
public class AliPayService extends BasePayService<AliPayConfigStorage> implements AliPayServiceInf {
/**
* api服务地址默认为国内
*/
private String apiServerUrl;
/**
* 获取对应的请求地址
*
@@ -72,6 +77,9 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> implement
*/
@Override
public String getReqUrl(TransactionType transactionType) {
if (StringUtils.isNotEmpty(apiServerUrl)) {
return apiServerUrl;
}
return payConfigStorage.isTest() ? AliPayConst.DEV_REQ_URL : HTTPS_REQ_URL;
}
@@ -850,5 +858,17 @@ public class AliPayService extends BasePayService<AliPayConfigStorage> implement
return null;
}
/**
* 设置api服务器地址
*
* @param apiServerUrl api服务器地址
* @return 自身
*/
@Override
public AliPayServiceInf setApiServerUrl(String apiServerUrl) {
this.apiServerUrl = apiServerUrl;
return this;
}
}

View File

@@ -19,4 +19,13 @@ public interface AliPayServiceInf {
* @return fail 消息获取失败 是 success 消息获取成功 否
*/
String refundDepositBackCompleted(RefundOrder refundOrder);
/**
* 设置api服务器地址
*
* @param apiServerUrl api服务器地址
* @return 自身
*/
AliPayServiceInf setApiServerUrl(String apiServerUrl);
}

View File

@@ -20,7 +20,7 @@ public final class AliPayConst {
/**
* 沙箱测试环境账号
*/
public static final String DEV_REQ_URL = "https://openapi.alipaydev.com/gateway.do";
public static final String DEV_REQ_URL = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
public static final String SIGN = "sign";