Skip to content

Commit 290f232

Browse files
committed
Fix SessionAuthentication base url
1 parent 4241c9f commit 290f232

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/__tests__/service.spec.ts

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,31 @@ describe("Service", () => {
131131
const url = "https://some-test.adyen.com/api/";
132132
expect(service.testCreateBaseUrl(url)).toBe("https://some-live.adyen.com/api/");
133133
});
134-
});
134+
135+
it("should build TEST url for SessionAuthentication", () => {
136+
const config = new Config({
137+
apiKey: "test_key",
138+
environment: EnvironmentEnum.TEST,
139+
liveEndpointUrlPrefix: "mycompany"
140+
});
141+
client = new Client(config);
142+
143+
const service = new TestService(client);
144+
const url = "https://test.adyen.com/authe/api/v1";
145+
expect(service.testCreateBaseUrl(url)).toBe("https://test.adyen.com/authe/api/v1");
146+
});
147+
148+
it("should build LIVE url for SessionAuthentication", () => {
149+
const config = new Config({
150+
apiKey: "test_key",
151+
environment: EnvironmentEnum.LIVE,
152+
liveEndpointUrlPrefix: "mycompany"
153+
});
154+
client = new Client(config);
155+
156+
const service = new TestService(client);
157+
const url = "https://test.adyen.com/authe/api/v1";
158+
expect(service.testCreateBaseUrl(url)).toBe("https://authe-live.adyen.com/authe/api/v1");
159+
});
160+
161+
});

src/service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ class Service {
5858
}
5959
}
6060

61+
if (url.includes("/authe/")) {
62+
return url.replace("https://test.adyen.com/", "https://authe-live.adyen.com/");
63+
}
64+
6165
if (url.includes("pal-")) {
6266
return url.replace("https://pal-test.adyen.com/pal/servlet/",
6367
`https://${this.client.config.liveEndpointUrlPrefix}-pal-live.adyenpayments.com/pal/servlet/`);

0 commit comments

Comments
 (0)