Skip to content

Commit 7159525

Browse files
committed
Address PR feedback
1 parent d2bbd16 commit 7159525

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/__tests__/service.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ describe("Service", () => {
299299
expect(service.testCreateBaseUrl(url)).toBe("https://mycompany-pal-live.adyenpayments.com/pal/servlet/BinLookup/v54");
300300
});
301301

302-
it("should throw error if liveEndpointUrlPrefix is empty for Payout", () => {
302+
it("should throw error if liveEndpointUrlPrefix is empty for BinLookup", () => {
303303
// create Client for TEST environment without liveEndpointUrlPrefix
304304
const config = new Config({
305305
apiKey: "test_key",

src/service.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,19 @@ class Service {
4848
throw new Error("Endpoint URL must be provided.");
4949
}
5050

51+
// handle TEST urls
5152
if (config.environment !== EnvironmentEnum.LIVE) {
5253
return url.replace("-live", "-test");
5354
}
5455

56+
// handle LIVE urls
5557
if (url.includes("/authe/")) {
5658
return url.replace("https://test.adyen.com/", "https://authe-live.adyen.com/");
5759
}
5860

5961
if (url.includes("pal-")) {
6062
// LIVE pal URL must provide prefix
61-
if(config.environment === EnvironmentEnum.LIVE && !config.liveEndpointUrlPrefix) {
63+
if(!config.liveEndpointUrlPrefix) {
6264
throw new Error("Live endpoint URL prefix must be provided for LIVE environment.");
6365
}
6466
return url.replace("https://pal-test.adyen.com/pal/servlet/",
@@ -67,7 +69,7 @@ class Service {
6769

6870
if (url.includes("checkout-")) {
6971
// LIVE checkout URL must provide prefix
70-
if(config.environment === EnvironmentEnum.LIVE && !config.liveEndpointUrlPrefix) {
72+
if(!config.liveEndpointUrlPrefix) {
7173
throw new Error("Live endpoint URL prefix must be provided for LIVE environment.");
7274
}
7375
if (url.includes("/possdk/v68")) {

0 commit comments

Comments
 (0)