UNPKG

@adyen/api-library

Version:

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

151 lines 8.59 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.PaymentInstrumentsApi = 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 PaymentInstrumentsApi */ class PaymentInstrumentsApi 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 Create network token provisioning data * @param id {@link string } The unique identifier of the payment instrument. * @param networkTokenActivationDataRequest {@link NetworkTokenActivationDataRequest } * @param requestOptions {@link IRequest.Options } * @return {@link NetworkTokenActivationDataResponse } */ async createNetworkTokenProvisioningData(id, networkTokenActivationDataRequest, requestOptions) { const endpoint = `${this.baseUrl}/paymentInstruments/{id}/networkTokenActivationData` .replace("{" + "id" + "}", encodeURIComponent(String(id))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(networkTokenActivationDataRequest, "NetworkTokenActivationDataRequest"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "NetworkTokenActivationDataResponse"); } /** * @summary Create a payment instrument * @param paymentInstrumentInfo {@link PaymentInstrumentInfo } * @param requestOptions {@link IRequest.Options } * @return {@link PaymentInstrument } */ async createPaymentInstrument(paymentInstrumentInfo, requestOptions) { const endpoint = `${this.baseUrl}/paymentInstruments`; const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(paymentInstrumentInfo, "PaymentInstrumentInfo"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "PaymentInstrument"); } /** * @summary Get all transaction rules for a payment instrument * @param id {@link string } The unique identifier of the payment instrument. * @param requestOptions {@link IRequest.Options } * @return {@link TransactionRulesResponse } */ async getAllTransactionRulesForPaymentInstrument(id, requestOptions) { const endpoint = `${this.baseUrl}/paymentInstruments/{id}/transactionRules` .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, "TransactionRulesResponse"); } /** * @summary Get network token activation data * @param id {@link string } The unique identifier of the payment instrument. * @param requestOptions {@link IRequest.Options } * @return {@link NetworkTokenActivationDataResponse } */ async getNetworkTokenActivationData(id, requestOptions) { const endpoint = `${this.baseUrl}/paymentInstruments/{id}/networkTokenActivationData` .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, "NetworkTokenActivationDataResponse"); } /** * @summary Get the PAN of a payment instrument * @param id {@link string } The unique identifier of the payment instrument. * @param requestOptions {@link IRequest.Options } * @return {@link PaymentInstrumentRevealInfo } */ async getPanOfPaymentInstrument(id, requestOptions) { const endpoint = `${this.baseUrl}/paymentInstruments/{id}/reveal` .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, "PaymentInstrumentRevealInfo"); } /** * @summary Get a payment instrument * @param id {@link string } The unique identifier of the payment instrument. * @param requestOptions {@link IRequest.Options } * @return {@link PaymentInstrument } */ async getPaymentInstrument(id, requestOptions) { const endpoint = `${this.baseUrl}/paymentInstruments/{id}` .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, "PaymentInstrument"); } /** * @summary List network tokens * @param id {@link string } The unique identifier of the payment instrument. * @param requestOptions {@link IRequest.Options } * @return {@link ListNetworkTokensResponse } */ async listNetworkTokens(id, requestOptions) { const endpoint = `${this.baseUrl}/paymentInstruments/{id}/networkTokens` .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, "ListNetworkTokensResponse"); } /** * @summary Reveal the data of a payment instrument * @param paymentInstrumentRevealRequest {@link PaymentInstrumentRevealRequest } * @param requestOptions {@link IRequest.Options } * @return {@link PaymentInstrumentRevealResponse } */ async revealDataOfPaymentInstrument(paymentInstrumentRevealRequest, requestOptions) { const endpoint = `${this.baseUrl}/paymentInstruments/reveal`; const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(paymentInstrumentRevealRequest, "PaymentInstrumentRevealRequest"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "PaymentInstrumentRevealResponse"); } /** * @summary Update a payment instrument * @param id {@link string } The unique identifier of the payment instrument. * @param paymentInstrumentUpdateRequest {@link PaymentInstrumentUpdateRequest } * @param requestOptions {@link IRequest.Options } * @return {@link UpdatePaymentInstrument } */ async updatePaymentInstrument(id, paymentInstrumentUpdateRequest, requestOptions) { const endpoint = `${this.baseUrl}/paymentInstruments/{id}` .replace("{" + "id" + "}", encodeURIComponent(String(id))); const resource = new resource_1.default(this, endpoint); const request = objectSerializer_1.ObjectSerializer.serialize(paymentInstrumentUpdateRequest, "PaymentInstrumentUpdateRequest"); const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "PATCH" }); return objectSerializer_1.ObjectSerializer.deserialize(response, "UpdatePaymentInstrument"); } } exports.PaymentInstrumentsApi = PaymentInstrumentsApi; //# sourceMappingURL=paymentInstrumentsApi.js.map