-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathtermsOfServiceApi.ts
141 lines (132 loc) · 8.02 KB
/
termsOfServiceApi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/*
* 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.
*/
import getJsonResponse from "../../helpers/getJsonResponse";
import Service from "../../service";
import Client from "../../client";
import {
AcceptTermsOfServiceRequest,
AcceptTermsOfServiceResponse,
CalculateTermsOfServiceStatusResponse,
GetAcceptedTermsOfServiceDocumentResponse,
GetTermsOfServiceAcceptanceInfosResponse,
GetTermsOfServiceDocumentRequest,
GetTermsOfServiceDocumentResponse,
ServiceError,
ObjectSerializer
} from "../../typings/legalEntityManagement/models";
import { IRequest } from "../../typings/requestOptions";
import Resource from "../resource";
export class TermsOfServiceApi extends Service {
private readonly API_BASEPATH: string = "https://kyc-test.adyen.com/lem/v3";
private baseUrl: string;
public constructor(client: Client){
super(client);
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 }
*/
public async acceptTermsOfService(id: string, termsofservicedocumentid: string, acceptTermsOfServiceRequest: AcceptTermsOfServiceRequest, requestOptions?: IRequest.Options): Promise<AcceptTermsOfServiceResponse> {
const endpoint = `${this.baseUrl}/legalEntities/{id}/termsOfService/{termsofservicedocumentid}`
.replace("{" + "id" + "}", encodeURIComponent(String(id)))
.replace("{" + "termsofservicedocumentid" + "}", encodeURIComponent(String(termsofservicedocumentid)));
const resource = new Resource(this, endpoint);
const request: AcceptTermsOfServiceRequest = ObjectSerializer.serialize(acceptTermsOfServiceRequest, "AcceptTermsOfServiceRequest");
const response = await getJsonResponse<AcceptTermsOfServiceRequest, AcceptTermsOfServiceResponse>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
return 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 }
*/
public async getAcceptedTermsOfServiceDocument(id: string, termsofserviceacceptancereference: string, termsOfServiceDocumentFormat?: string, requestOptions?: IRequest.Options): Promise<GetAcceptedTermsOfServiceDocumentResponse> {
const endpoint = `${this.baseUrl}/legalEntities/{id}/acceptedTermsOfServiceDocument/{termsofserviceacceptancereference}`
.replace("{" + "id" + "}", encodeURIComponent(String(id)))
.replace("{" + "termsofserviceacceptancereference" + "}", encodeURIComponent(String(termsofserviceacceptancereference)));
const resource = new Resource(this, endpoint);
const hasDefinedQueryParams = termsOfServiceDocumentFormat;
if(hasDefinedQueryParams) {
if(!requestOptions) requestOptions = {};
if(!requestOptions.params) requestOptions.params = {};
if(termsOfServiceDocumentFormat) requestOptions.params["termsOfServiceDocumentFormat"] = termsOfServiceDocumentFormat;
}
const response = await getJsonResponse<string, GetAcceptedTermsOfServiceDocumentResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return 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 }
*/
public async getTermsOfServiceDocument(id: string, getTermsOfServiceDocumentRequest: GetTermsOfServiceDocumentRequest, requestOptions?: IRequest.Options): Promise<GetTermsOfServiceDocumentResponse> {
const endpoint = `${this.baseUrl}/legalEntities/{id}/termsOfService`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);
const request: GetTermsOfServiceDocumentRequest = ObjectSerializer.serialize(getTermsOfServiceDocumentRequest, "GetTermsOfServiceDocumentRequest");
const response = await getJsonResponse<GetTermsOfServiceDocumentRequest, GetTermsOfServiceDocumentResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return 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 }
*/
public async getTermsOfServiceInformationForLegalEntity(id: string, requestOptions?: IRequest.Options): Promise<GetTermsOfServiceAcceptanceInfosResponse> {
const endpoint = `${this.baseUrl}/legalEntities/{id}/termsOfServiceAcceptanceInfos`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);
const response = await getJsonResponse<string, GetTermsOfServiceAcceptanceInfosResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return 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 }
*/
public async getTermsOfServiceStatus(id: string, requestOptions?: IRequest.Options): Promise<CalculateTermsOfServiceStatusResponse> {
const endpoint = `${this.baseUrl}/legalEntities/{id}/termsOfServiceStatus`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);
const response = await getJsonResponse<string, CalculateTermsOfServiceStatusResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "CalculateTermsOfServiceStatusResponse");
}
}