UNPKG

@adyen/api-library

Version:

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

138 lines 7.95 kB
"use strict"; /* * The version of the OpenAPI document: v1 * * * 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.PaymentsAppApi = 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/paymentsApp/objectSerializer"); /** * API handler for PaymentsAppApi */ class PaymentsAppApi extends service_1.default { constructor(client) { super(client); this.API_BASEPATH = "https://management-live.adyen.com/v1"; this.baseUrl = this.createBaseUrl(this.API_BASEPATH); } /** * @summary Create a boarding token - merchant level * @param merchantId {@link string } The unique identifier of the merchant account. * @param boardingTokenRequest {@link BoardingTokenRequest } * @param requestOptions {@link IRequest.Options } * @return {@link BoardingTokenResponse } */ async generatePaymentsAppBoardingTokenForMerchant(merchantId, boardingTokenRequest, requestOptions) { const endpoint = `${this.baseUrl}/merchants/{merchantId}/generatePaymentsAppBoardingToken` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(boardingTokenRequest, "BoardingTokenRequest"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "BoardingTokenResponse"); } /** * @summary Create a boarding token - store level * @param merchantId {@link string } The unique identifier of the merchant account. * @param storeId {@link string } The unique identifier of the store. * @param boardingTokenRequest {@link BoardingTokenRequest } * @param requestOptions {@link IRequest.Options } * @return {@link BoardingTokenResponse } */ async generatePaymentsAppBoardingTokenForStore(merchantId, storeId, boardingTokenRequest, requestOptions) { const endpoint = `${this.baseUrl}/merchants/{merchantId}/stores/{storeId}/generatePaymentsAppBoardingToken` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))) .replace("{" + "storeId" + "}", encodeURIComponent(String(storeId))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(boardingTokenRequest, "BoardingTokenRequest"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "BoardingTokenResponse"); } /** * @summary Get a list of Payments Apps - merchant level * @param merchantId {@link string } The unique identifier of the merchant account. * @param requestOptions {@link IRequest.Options } * @param statuses {@link string } The status of the Payments App. Comma-separated list of one or more values. If no value is provided, the list returns all statuses. Possible values: * **BOARDING** * **BOARDED** * **REVOKED** * @param limit {@link number } The number of items to return. * @param offset {@link number } The number of items to skip. * @return {@link PaymentsAppResponse } */ async listPaymentsAppForMerchant(merchantId, statuses, limit, offset, requestOptions) { var _a; const endpoint = `${this.baseUrl}/merchants/{merchantId}/paymentsApps` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))); const resource = new resource_1.default(this, endpoint); const hasDefinedQueryParams = (_a = statuses !== null && statuses !== void 0 ? statuses : limit) !== null && _a !== void 0 ? _a : offset; if (hasDefinedQueryParams) { if (!requestOptions) requestOptions = {}; if (!requestOptions.params) requestOptions.params = {}; if (statuses) requestOptions.params["statuses"] = statuses; if (limit) requestOptions.params["limit"] = limit; if (offset) requestOptions.params["offset"] = offset; } const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "PaymentsAppResponse"); } /** * @summary Get a list of Payments Apps - store level * @param merchantId {@link string } The unique identifier of the merchant account. * @param storeId {@link string } The unique identifier of the store. * @param requestOptions {@link IRequest.Options } * @param statuses {@link string } The status of the Payments App. Comma-separated list of one or more values. If no value is provided, the list returns all statuses. Possible values: * **BOARDING** * **BOARDED** * **REVOKED** * @param limit {@link number } The number of items to return. * @param offset {@link number } The number of items to skip. * @return {@link PaymentsAppResponse } */ async listPaymentsAppForStore(merchantId, storeId, statuses, limit, offset, requestOptions) { var _a; const endpoint = `${this.baseUrl}/merchants/{merchantId}/stores/{storeId}/paymentsApps` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))) .replace("{" + "storeId" + "}", encodeURIComponent(String(storeId))); const resource = new resource_1.default(this, endpoint); const hasDefinedQueryParams = (_a = statuses !== null && statuses !== void 0 ? statuses : limit) !== null && _a !== void 0 ? _a : offset; if (hasDefinedQueryParams) { if (!requestOptions) requestOptions = {}; if (!requestOptions.params) requestOptions.params = {}; if (statuses) requestOptions.params["statuses"] = statuses; if (limit) requestOptions.params["limit"] = limit; if (offset) requestOptions.params["offset"] = offset; } const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "PaymentsAppResponse"); } /** * @summary Revoke Payments App instance authentication * @param merchantId {@link string } The unique identifier of the merchant account. * @param installationId {@link string } The unique identifier of the Payments App instance on a device. * @param requestOptions {@link IRequest.Options } * @return {@link void } */ async revokePaymentsApp(merchantId, installationId, requestOptions) { const endpoint = `${this.baseUrl}/merchants/{merchantId}/paymentsApps/{installationId}/revoke` .replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId))) .replace("{" + "installationId" + "}", encodeURIComponent(String(installationId))); const resource = new resource_1.default(this, endpoint); await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "POST" }); } } exports.PaymentsAppApi = PaymentsAppApi; //# sourceMappingURL=paymentsAppApi.js.map