@adyen/api-library
Version:
The Adyen API Library for NodeJS enables you to work with Adyen APIs.
113 lines • 7.47 kB
JavaScript
;
/*
* The version of the OpenAPI document: v4
*
*
* 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.TermsOfServiceApi = 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/legalEntityManagement/objectSerializer");
/**
* API handler for TermsOfServiceApi
*/
class TermsOfServiceApi extends service_1.default {
constructor(client) {
super(client);
this.API_BASEPATH = "https://kyc-test.adyen.com/lem/v4";
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
}
/**
* @summary Accept Terms of Service
* @param id {@link string } The unique identifier of the legal entity. For sole proprietorships, this is the individual legal entity ID of the owner. For organizations, this is the ID of the organization. For legal representatives of individuals, this is the ID of the individual.
* @param termsofservicedocumentid {@link string } The unique identifier of the Terms of Service document.
* @param acceptTermsOfServiceRequest {@link AcceptTermsOfServiceRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link AcceptTermsOfServiceResponse }
*/
async acceptTermsOfService(id, termsofservicedocumentid, acceptTermsOfServiceRequest, requestOptions) {
const endpoint = `${this.baseUrl}/legalEntities/{id}/termsOfService/{termsofservicedocumentid}`
.replace("{" + "id" + "}", encodeURIComponent(String(id)))
.replace("{" + "termsofservicedocumentid" + "}", encodeURIComponent(String(termsofservicedocumentid)));
const resource = new resource_1.default(this, endpoint);
const request = objectSerializer_1.ObjectSerializer.serialize(acceptTermsOfServiceRequest, "AcceptTermsOfServiceRequest");
const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "PATCH" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "AcceptTermsOfServiceResponse");
}
/**
* @summary Get accepted Terms of Service document
* @param id {@link string } The unique identifier of the legal entity. For sole proprietorship, this is the individual legal entity ID of the owner. For organizations, this is the ID of the organization.
* @param termsofserviceacceptancereference {@link string } An Adyen-generated reference for the accepted Terms of Service.
* @param requestOptions {@link IRequest.Options }
* @param termsOfServiceDocumentFormat {@link string } The format of the Terms of Service document. Possible values: **JSON**, **PDF**, or **TXT**
* @return {@link GetAcceptedTermsOfServiceDocumentResponse }
*/
async getAcceptedTermsOfServiceDocument(id, termsofserviceacceptancereference, termsOfServiceDocumentFormat, requestOptions) {
const endpoint = `${this.baseUrl}/legalEntities/{id}/acceptedTermsOfServiceDocument/{termsofserviceacceptancereference}`
.replace("{" + "id" + "}", encodeURIComponent(String(id)))
.replace("{" + "termsofserviceacceptancereference" + "}", encodeURIComponent(String(termsofserviceacceptancereference)));
const resource = new resource_1.default(this, endpoint);
const hasDefinedQueryParams = termsOfServiceDocumentFormat;
if (hasDefinedQueryParams) {
if (!requestOptions)
requestOptions = {};
if (!requestOptions.params)
requestOptions.params = {};
if (termsOfServiceDocumentFormat)
requestOptions.params["termsOfServiceDocumentFormat"] = termsOfServiceDocumentFormat;
}
const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "GetAcceptedTermsOfServiceDocumentResponse");
}
/**
* @summary Get Terms of Service document
* @param id {@link string } The unique identifier of the legal entity. For sole proprietorships, this is the individual legal entity ID of the owner. For organizations, this is the ID of the organization.
* @param getTermsOfServiceDocumentRequest {@link GetTermsOfServiceDocumentRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link GetTermsOfServiceDocumentResponse }
*/
async getTermsOfServiceDocument(id, getTermsOfServiceDocumentRequest, requestOptions) {
const endpoint = `${this.baseUrl}/legalEntities/{id}/termsOfService`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new resource_1.default(this, endpoint);
const request = objectSerializer_1.ObjectSerializer.serialize(getTermsOfServiceDocumentRequest, "GetTermsOfServiceDocumentRequest");
const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "GetTermsOfServiceDocumentResponse");
}
/**
* @summary Get Terms of Service information for a legal entity
* @param id {@link string } The unique identifier of the legal entity. For sole proprietorships, this is the individual legal entity ID of the owner. For organizations, this is the ID of the organization.
* @param requestOptions {@link IRequest.Options }
* @return {@link GetTermsOfServiceAcceptanceInfosResponse }
*/
async getTermsOfServiceInformationForLegalEntity(id, requestOptions) {
const endpoint = `${this.baseUrl}/legalEntities/{id}/termsOfServiceAcceptanceInfos`
.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, "GetTermsOfServiceAcceptanceInfosResponse");
}
/**
* @summary Get Terms of Service status
* @param id {@link string } The unique identifier of the legal entity. For sole proprietorships, this is the individual legal entity ID of the owner. For organizations, this is the ID of the organization.
* @param requestOptions {@link IRequest.Options }
* @return {@link CalculateTermsOfServiceStatusResponse }
*/
async getTermsOfServiceStatus(id, requestOptions) {
const endpoint = `${this.baseUrl}/legalEntities/{id}/termsOfServiceStatus`
.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, "CalculateTermsOfServiceStatusResponse");
}
}
exports.TermsOfServiceApi = TermsOfServiceApi;
//# sourceMappingURL=termsOfServiceApi.js.map