UNPKG

@adyen/api-library

Version:

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

87 lines 5.35 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.TerminalsTerminalLevelApi = 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 TerminalsTerminalLevelApi */ class TerminalsTerminalLevelApi 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 Get a list of terminals * @param requestOptions {@link IRequest.Options } * @param searchQuery {@link string } Returns terminals with an ID that contains the specified string. If present, other query parameters are ignored. * @param otpQuery {@link string } Returns one or more terminals associated with the one-time passwords specified in the request. If this query parameter is used, other query parameters are ignored. * @param countries {@link string } Returns terminals located in the countries specified by their [two-letter country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). * @param merchantIds {@link string } Returns terminals that belong to the merchant accounts specified by their unique merchant account ID. * @param storeIds {@link string } Returns terminals that are assigned to the [stores](https://docs.adyen.com/api-explorer/#/ManagementService/latest/get/stores) specified by their unique store ID. * @param brandModels {@link string } Returns terminals of the [models](https://docs.adyen.com/api-explorer/#/ManagementService/latest/get/companies/{companyId}/terminalModels) specified in the format *brand.model*. * @param pageNumber {@link number } The number of the page to fetch. * @param pageSize {@link number } The number of items to have on a page, maximum 100. The default is 20 items on a page. * @return {@link ListTerminalsResponse } */ async listTerminals(searchQuery, otpQuery, countries, merchantIds, storeIds, brandModels, pageNumber, pageSize, requestOptions) { var _a, _b, _c, _d, _e, _f; const endpoint = `${this.baseUrl}/terminals`; const resource = new resource_1.default(this, endpoint); const hasDefinedQueryParams = (_f = (_e = (_d = (_c = (_b = (_a = searchQuery !== null && searchQuery !== void 0 ? searchQuery : otpQuery) !== null && _a !== void 0 ? _a : countries) !== null && _b !== void 0 ? _b : merchantIds) !== null && _c !== void 0 ? _c : storeIds) !== null && _d !== void 0 ? _d : brandModels) !== null && _e !== void 0 ? _e : pageNumber) !== null && _f !== void 0 ? _f : pageSize; if (hasDefinedQueryParams) { if (!requestOptions) requestOptions = {}; if (!requestOptions.params) requestOptions.params = {}; if (searchQuery) requestOptions.params["searchQuery"] = searchQuery; if (otpQuery) requestOptions.params["otpQuery"] = otpQuery; if (countries) requestOptions.params["countries"] = countries; if (merchantIds) requestOptions.params["merchantIds"] = merchantIds; if (storeIds) requestOptions.params["storeIds"] = storeIds; if (brandModels) requestOptions.params["brandModels"] = brandModels; if (pageNumber) requestOptions.params["pageNumber"] = pageNumber; if (pageSize) requestOptions.params["pageSize"] = pageSize; } const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "ListTerminalsResponse"); } /** * @summary Reassign a terminal * @param terminalId {@link string } The unique identifier of the payment terminal. * @param terminalReassignmentRequest {@link TerminalReassignmentRequest } * @param requestOptions {@link IRequest.Options } * @return {@link void } */ async reassignTerminal(terminalId, terminalReassignmentRequest, requestOptions) { const endpoint = `${this.baseUrl}/terminals/{terminalId}/reassign` .replace("{" + "terminalId" + "}", encodeURIComponent(String(terminalId))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(terminalReassignmentRequest, "TerminalReassignmentRequest"); await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" }); } } exports.TerminalsTerminalLevelApi = TerminalsTerminalLevelApi; //# sourceMappingURL=terminalsTerminalLevelApi.js.map