Skip to content

Commit c51499a

Browse files
committed
支付宝新增自定义URL
1 parent 84cf034 commit c51499a

3 files changed

Lines changed: 30 additions & 1 deletion

File tree

pay-java-ali/src/main/java/com/egzosn/pay/ali/api/AliPayService.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,21 @@
6565
public class AliPayService extends BasePayService<AliPayConfigStorage> implements AliPayServiceInf {
6666

6767

68+
/**
69+
* api服务地址,默认为国内
70+
*/
71+
private String apiServerUrl;
72+
6873
/**
6974
* 获取对应的请求地址
7075
*
7176
* @return 请求地址
7277
*/
7378
@Override
7479
public String getReqUrl(TransactionType transactionType) {
80+
if (StringUtils.isNotEmpty(apiServerUrl)) {
81+
return apiServerUrl;
82+
}
7583
return payConfigStorage.isTest() ? AliPayConst.DEV_REQ_URL : HTTPS_REQ_URL;
7684
}
7785

@@ -850,5 +858,17 @@ public String refundDepositBackCompleted(RefundOrder refundOrder) {
850858
return null;
851859
}
852860

861+
/**
862+
* 设置api服务器地址
863+
*
864+
* @param apiServerUrl api服务器地址
865+
* @return 自身
866+
*/
867+
@Override
868+
public AliPayServiceInf setApiServerUrl(String apiServerUrl) {
869+
this.apiServerUrl = apiServerUrl;
870+
return this;
871+
}
872+
853873

854874
}

pay-java-ali/src/main/java/com/egzosn/pay/ali/api/AliPayServiceInf.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,13 @@ public interface AliPayServiceInf {
1919
* @return fail 消息获取失败 是 success 消息获取成功 否
2020
*/
2121
String refundDepositBackCompleted(RefundOrder refundOrder);
22+
23+
24+
/**
25+
* 设置api服务器地址
26+
*
27+
* @param apiServerUrl api服务器地址
28+
* @return 自身
29+
*/
30+
AliPayServiceInf setApiServerUrl(String apiServerUrl);
2231
}

pay-java-ali/src/main/java/com/egzosn/pay/ali/bean/AliPayConst.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ private AliPayConst() {
2020
/**
2121
* 沙箱测试环境账号
2222
*/
23-
public static final String DEV_REQ_URL = "https://openapi.alipaydev.com/gateway.do";
23+
public static final String DEV_REQ_URL = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
2424

2525
public static final String SIGN = "sign";
2626

0 commit comments

Comments
 (0)