UNPKG

@adyen/api-library

Version:

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

194 lines 12.5 kB
"use strict"; /* * The version of the OpenAPI document: v2 * * * 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.ManagedPayoutSchedulesApi = 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/balancePlatform/objectSerializer"); /** * API handler for ManagedPayoutSchedulesApi */ class ManagedPayoutSchedulesApi extends service_1.default { constructor(client) { super(client); this.API_BASEPATH = "https://balanceplatform-api-test.adyen.com/bcl/v2"; this.baseUrl = this.createBaseUrl(this.API_BASEPATH); } /** * @summary Apply a managed payout schedule to a balance account * @param balanceAccountId {@link string } The unique identifier of the balance account. * @param balanceAccountConfigurationRequest {@link BalanceAccountConfigurationRequest } * @param requestOptions {@link IRequest.Options } * @return {@link BalanceAccountConfiguration } */ async applyManagedSchedule(balanceAccountId, balanceAccountConfigurationRequest, requestOptions) { const endpoint = `${this.baseUrl}/balanceAccounts/{balanceAccountId}/payoutSchedules` .replace("{" + "balanceAccountId" + "}", encodeURIComponent(String(balanceAccountId))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(balanceAccountConfigurationRequest, "BalanceAccountConfigurationRequest"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "BalanceAccountConfiguration"); } /** * @summary Delete a managed payout schedule on a balance account * @param balanceAccountId {@link string } The unique identifier of the balance account. * @param id {@link string } The unique identifier of the payout schedule applied to the balance account. * @param requestOptions {@link IRequest.Options } * @return {@link void } */ async deleteBalanceAccountManagedSchedule(balanceAccountId, id, requestOptions) { const endpoint = `${this.baseUrl}/balanceAccounts/{balanceAccountId}/payoutSchedules/{id}` .replace("{" + "balanceAccountId" + "}", encodeURIComponent(String(balanceAccountId))) .replace("{" + "id" + "}", encodeURIComponent(String(id))); const resource = new resource_1.default(this, endpoint); await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "DELETE" }); } /** * @summary Get a specific managed payout schedule on a balance account * @param balanceAccountId {@link string } The unique identifier of the balance account. * @param id {@link string } The unique identifier of the payout schedule for the balance account. * @param requestOptions {@link IRequest.Options } * @return {@link BalanceAccountConfiguration } */ async getBalanceAccountManagedScheduleById(balanceAccountId, id, requestOptions) { const endpoint = `${this.baseUrl}/balanceAccounts/{balanceAccountId}/payoutSchedules/{id}` .replace("{" + "balanceAccountId" + "}", encodeURIComponent(String(balanceAccountId))) .replace("{" + "id" + "}", encodeURIComponent(String(id))); 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, "BalanceAccountConfiguration"); } /** * @summary Get all managed payout schedules on a balance account * @param balanceAccountId {@link string } The unique identifier of the balance account. * @param requestOptions {@link IRequest.Options } * @param currency {@link string } The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the currency used in the payout schedule. * @param cursor {@link string } The `cursor` returned in the links of the previous response. * @param limit {@link number } The number of items returned per page, maximum of 100 items. By default, the response returns 10 items per page. * @return {@link BalanceAccountConfigurations } */ async getBalanceAccountManagedSchedules(balanceAccountId, currency, cursor, limit, requestOptions) { var _a; const endpoint = `${this.baseUrl}/balanceAccounts/{balanceAccountId}/payoutSchedules` .replace("{" + "balanceAccountId" + "}", encodeURIComponent(String(balanceAccountId))); const resource = new resource_1.default(this, endpoint); const hasDefinedQueryParams = (_a = currency !== null && currency !== void 0 ? currency : cursor) !== null && _a !== void 0 ? _a : limit; if (hasDefinedQueryParams) { if (!requestOptions) requestOptions = {}; if (!requestOptions.params) requestOptions.params = {}; if (currency) requestOptions.params["currency"] = currency; if (cursor) requestOptions.params["cursor"] = cursor; if (limit) requestOptions.params["limit"] = limit; } const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "BalanceAccountConfigurations"); } /** * @summary Get a specific managed payout schedule on your balance platform * @param balancePlatformId {@link string } The unique identifier of the balance platform. * @param id {@link string } The unique identifier of the payout configuration for your balance platform. * @param requestOptions {@link IRequest.Options } * @return {@link BalancePlatformConfiguration } */ async getBalancePlatformManagedScheduleById(balancePlatformId, id, requestOptions) { const endpoint = `${this.baseUrl}/balancePlatforms/{balancePlatformId}/payoutSchedules/{id}` .replace("{" + "balancePlatformId" + "}", encodeURIComponent(String(balancePlatformId))) .replace("{" + "id" + "}", encodeURIComponent(String(id))); 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, "BalancePlatformConfiguration"); } /** * @summary Get all managed payout schedules on your balance platform * @param balancePlatformId {@link string } The unique identifier of the balance platform. * @param requestOptions {@link IRequest.Options } * @param countryCode {@link string } The two-letter [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country to which the payout configuration applies. * @param currency {@link string } The three-character [ISO currency code](https://docs.adyen.com/development-resources/currency-codes) of the currency used in the payout configuration. * @return {@link BalancePlatformConfigurations } */ async getBalancePlatformManagedSchedules(balancePlatformId, countryCode, currency, requestOptions) { const endpoint = `${this.baseUrl}/balancePlatforms/{balancePlatformId}/payoutSchedules` .replace("{" + "balancePlatformId" + "}", encodeURIComponent(String(balancePlatformId))); const resource = new resource_1.default(this, endpoint); const hasDefinedQueryParams = countryCode !== null && countryCode !== void 0 ? countryCode : currency; if (hasDefinedQueryParams) { if (!requestOptions) requestOptions = {}; if (!requestOptions.params) requestOptions.params = {}; if (countryCode) requestOptions.params["countryCode"] = countryCode; if (currency) requestOptions.params["currency"] = currency; } const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "BalancePlatformConfigurations"); } /** * @summary View executions of a managed payout schedule * @param balanceAccountId {@link string } The unique identifier of the balance account. * @param id {@link string } The unique identifier of the payout schedule on the balance account. * @param requestOptions {@link IRequest.Options } * @param offset {@link number } (Required) The page number to be returned. Default: **1** * @param results {@link Array<ExecutionResult> } Contains a list of payout statuses. If included, the response returns only executed payouts that currently have one of the specified statuses. Possible statuses: - **succeeded**: The payout was sent successfully. - **failed**: The payout was not sent due to an error. - **skipped**: The payout was not triggered as expected. * @param limit {@link number } The number of items returned per page. Default: **10** * @return {@link PayoutScheduleExecutions } */ async getPayoutScheduleExecutions(balanceAccountId, id, offset, results, limit, requestOptions) { var _a; const endpoint = `${this.baseUrl}/balanceAccounts/{balanceAccountId}/payoutSchedules/{id}/executions` .replace("{" + "balanceAccountId" + "}", encodeURIComponent(String(balanceAccountId))) .replace("{" + "id" + "}", encodeURIComponent(String(id))); const resource = new resource_1.default(this, endpoint); const hasDefinedQueryParams = (_a = results !== null && results !== void 0 ? results : limit) !== null && _a !== void 0 ? _a : offset; if (hasDefinedQueryParams) { if (!requestOptions) requestOptions = {}; if (!requestOptions.params) requestOptions.params = {}; if (results) requestOptions.params["results"] = results; 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, "PayoutScheduleExecutions"); } /** * @summary Update a managed payout schedule on a balance account * @param balanceAccountId {@link string } The unique identifier of the balance account. * @param id {@link string } The unique identifier of the payout schedule applied to the balance account. * @param balanceAccountConfigurationUpdate {@link BalanceAccountConfigurationUpdate } * @param requestOptions {@link IRequest.Options } * @return {@link BalanceAccountConfiguration } */ async updateBalanceAccountManagedSchedule(balanceAccountId, id, balanceAccountConfigurationUpdate, requestOptions) { const endpoint = `${this.baseUrl}/balanceAccounts/{balanceAccountId}/payoutSchedules/{id}` .replace("{" + "balanceAccountId" + "}", encodeURIComponent(String(balanceAccountId))) .replace("{" + "id" + "}", encodeURIComponent(String(id))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(balanceAccountConfigurationUpdate, "BalanceAccountConfigurationUpdate"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "PATCH" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "BalanceAccountConfiguration"); } } exports.ManagedPayoutSchedulesApi = ManagedPayoutSchedulesApi; //# sourceMappingURL=managedPayoutSchedulesApi.js.map