@adyen/api-library
Version:
The Adyen API Library for NodeJS enables you to work with Adyen APIs.
83 lines • 4.33 kB
JavaScript
;
/*
* 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.AuthorizedCardUsersApi = 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 AuthorizedCardUsersApi
*/
class AuthorizedCardUsersApi 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 authorized users for a card.
* @param paymentInstrumentId {@link string }
* @param authorisedCardUsers {@link AuthorisedCardUsers }
* @param requestOptions {@link IRequest.Options }
* @return {@link void }
*/
async createAuthorisedCardUsers(paymentInstrumentId, authorisedCardUsers, requestOptions) {
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
const resource = new resource_1.default(this, endpoint);
const request = objectSerializer_1.ObjectSerializer.serialize(authorisedCardUsers, "AuthorisedCardUsers");
await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" });
}
/**
* @summary Delete the authorized users for a card.
* @param paymentInstrumentId {@link string }
* @param requestOptions {@link IRequest.Options }
* @return {@link void }
*/
async deleteAuthorisedCardUsers(paymentInstrumentId, requestOptions) {
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
const resource = new resource_1.default(this, endpoint);
await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "DELETE" });
}
/**
* @summary Get authorized users for a card.
* @param paymentInstrumentId {@link string }
* @param requestOptions {@link IRequest.Options }
* @return {@link AuthorisedCardUsers }
*/
async getAllAuthorisedCardUsers(paymentInstrumentId, requestOptions) {
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
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, "AuthorisedCardUsers");
}
/**
* @summary Update the authorized users for a card.
* @param paymentInstrumentId {@link string }
* @param authorisedCardUsers {@link AuthorisedCardUsers }
* @param requestOptions {@link IRequest.Options }
* @return {@link void }
*/
async updateAuthorisedCardUsers(paymentInstrumentId, authorisedCardUsers, requestOptions) {
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
const resource = new resource_1.default(this, endpoint);
const request = objectSerializer_1.ObjectSerializer.serialize(authorisedCardUsers, "AuthorisedCardUsers");
await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "PATCH" });
}
}
exports.AuthorizedCardUsersApi = AuthorizedCardUsersApi;
//# sourceMappingURL=authorizedCardUsersApi.js.map