UNPKG

@adyen/api-library

Version:

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

141 lines 8.41 kB
"use strict"; /* * The version of the OpenAPI document: v3 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit this class manually. */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.PaymentMethodsMerchantLevelApi = void 0; const getJsonResponse_1 = __importDefault(require("../../helpers/getJsonResponse")); const service_1 = __importDefault(require("../../service")); const resource_1 = __importDefault(require("../resource")); const objectSerializer_1 = require("../../typings/management/objectSerializer"); /** * API handler for PaymentMethodsMerchantLevelApi */ class PaymentMethodsMerchantLevelApi extends service_1.default { constructor(client) { super(client); this.API_BASEPATH = "https://management-test.adyen.com/v3"; this.baseUrl = this.createBaseUrl(this.API_BASEPATH); } /** * @summary Add an Apple Pay domain * @param merchantId {@link string } The unique identifier of the merchant account. * @param paymentMethodId {@link string } The unique identifier of the payment method. * @param applePayInfo {@link ApplePayInfo } * @param requestOptions {@link IRequest.Options } * @return {@link void } */ async addApplePayDomain(merchantId, paymentMethodId, applePayInfo, requestOptions) { const endpoint = `${this.baseUrl}/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}/addApplePayDomains` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))) .replace("{" + "paymentMethodId" + "}", encodeURIComponent(String(paymentMethodId))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(applePayInfo, "ApplePayInfo"); await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" }); } /** * @summary Get all payment methods * @param merchantId {@link string } The unique identifier of the merchant account. * @param requestOptions {@link IRequest.Options } * @param storeId {@link string } The unique identifier of the store for which to return the payment methods. * @param businessLineId {@link string } The unique identifier of the Business Line for which to return the payment methods. * @param pageSize {@link number } The number of items to have on a page, maximum 100. The default is 10 items on a page. * @param pageNumber {@link number } The number of the page to fetch. * @return {@link PaymentMethodResponse } */ async getAllPaymentMethods(merchantId, storeId, businessLineId, pageSize, pageNumber, requestOptions) { var _a, _b; const endpoint = `${this.baseUrl}/merchants/{merchantId}/paymentMethodSettings` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))); const resource = new resource_1.default(this, endpoint); const hasDefinedQueryParams = (_b = (_a = storeId !== null && storeId !== void 0 ? storeId : businessLineId) !== null && _a !== void 0 ? _a : pageSize) !== null && _b !== void 0 ? _b : pageNumber; if (hasDefinedQueryParams) { if (!requestOptions) requestOptions = {}; if (!requestOptions.params) requestOptions.params = {}; if (storeId) requestOptions.params["storeId"] = storeId; if (businessLineId) requestOptions.params["businessLineId"] = businessLineId; if (pageSize) requestOptions.params["pageSize"] = pageSize; if (pageNumber) requestOptions.params["pageNumber"] = pageNumber; } const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "PaymentMethodResponse"); } /** * @summary Get Apple Pay domains * @param merchantId {@link string } The unique identifier of the merchant account. * @param paymentMethodId {@link string } The unique identifier of the payment method. * @param requestOptions {@link IRequest.Options } * @return {@link ApplePayInfo } */ async getApplePayDomains(merchantId, paymentMethodId, requestOptions) { const endpoint = `${this.baseUrl}/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}/getApplePayDomains` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))) .replace("{" + "paymentMethodId" + "}", encodeURIComponent(String(paymentMethodId))); const resource = new resource_1.default(this, endpoint); const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "ApplePayInfo"); } /** * @summary Get payment method details * @param merchantId {@link string } The unique identifier of the merchant account. * @param paymentMethodId {@link string } The unique identifier of the payment method. * @param requestOptions {@link IRequest.Options } * @return {@link PaymentMethod } */ async getPaymentMethodDetails(merchantId, paymentMethodId, requestOptions) { const endpoint = `${this.baseUrl}/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))) .replace("{" + "paymentMethodId" + "}", encodeURIComponent(String(paymentMethodId))); const resource = new resource_1.default(this, endpoint); const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "PaymentMethod"); } /** * @summary Request a payment method * @param merchantId {@link string } The unique identifier of the merchant account. * @param paymentMethodSetupInfo {@link PaymentMethodSetupInfo } * @param requestOptions {@link IRequest.Options } * @return {@link PaymentMethod } */ async requestPaymentMethod(merchantId, paymentMethodSetupInfo, requestOptions) { const endpoint = `${this.baseUrl}/merchants/{merchantId}/paymentMethodSettings` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(paymentMethodSetupInfo, "PaymentMethodSetupInfo"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "PaymentMethod"); } /** * @summary Update a payment method * @param merchantId {@link string } The unique identifier of the merchant account. * @param paymentMethodId {@link string } The unique identifier of the payment method. * @param updatePaymentMethodInfo {@link UpdatePaymentMethodInfo } * @param requestOptions {@link IRequest.Options } * @return {@link PaymentMethod } */ async updatePaymentMethod(merchantId, paymentMethodId, updatePaymentMethodInfo, requestOptions) { const endpoint = `${this.baseUrl}/merchants/{merchantId}/paymentMethodSettings/{paymentMethodId}` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))) .replace("{" + "paymentMethodId" + "}", encodeURIComponent(String(paymentMethodId))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(updatePaymentMethodInfo, "UpdatePaymentMethodInfo"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "PATCH" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "PaymentMethod"); } } exports.PaymentMethodsMerchantLevelApi = PaymentMethodsMerchantLevelApi; //# sourceMappingURL=paymentMethodsMerchantLevelApi.js.map