UNPKG

@adyen/api-library

Version:

The Adyen API Library for NodeJS enables you to work with Adyen APIs.

50 lines 2.42 kB
"use strict"; /* * ###### * ###### * ############ ####( ###### #####. ###### ############ ############ * ############# #####( ###### #####. ###### ############# ############# * ###### #####( ###### #####. ###### ##### ###### ##### ###### * ###### ###### #####( ###### #####. ###### ##### ##### ##### ###### * ###### ###### #####( ###### #####. ###### ##### ##### ###### * ############# ############# ############# ############# ##### ###### * ############ ############ ############# ############ ##### ###### * ###### * ############# * ############ * Adyen NodeJS API Library * Copyright (c) 2020 Adyen B.V. * This file is open source and available under the MIT license. * See the LICENSE file for more info. */ Object.defineProperty(exports, "__esModule", { value: true }); class Service { constructor(client) { this.apiKeyRequired = false; this.client = client; } createBaseUrl(url) { const config = this.client.config; if (config.environment !== "LIVE") { return url.replace("-live", "-test"); } if (url.includes("pal-")) { if (this.client.liveEndpointUrlPrefix === "") { throw new Error("Please provide your unique live url prefix on the setEnvironment() call on the Client."); } return url.replace("https://pal-test.adyen.com/pal/servlet/", `https://${this.client.liveEndpointUrlPrefix}-pal-live.adyenpayments.com/pal/servlet/`); } if (url.includes("checkout-")) { if (this.client.liveEndpointUrlPrefix === "") { throw new Error("Please provide your unique live url prefix on the setEnvironment() call on the Client."); } if (url.includes("/possdk/v68")) { return url.replace("https://checkout-test.adyen.com/", `https://${this.client.liveEndpointUrlPrefix}-checkout-live.adyenpayments.com/`); } return url.replace("https://checkout-test.adyen.com/", `https://${this.client.liveEndpointUrlPrefix}-checkout-live.adyenpayments.com/checkout/`); } return url.replace("-test", "-live"); } } exports.default = Service; //# sourceMappingURL=service.js.map