-
Notifications
You must be signed in to change notification settings - Fork 74
/
Copy pathhostedOnboardingApi.ts
87 lines (80 loc) · 3.32 KB
/
hostedOnboardingApi.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
/*
* 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 {
OnboardingLink,
OnboardingLinkInfo,
OnboardingTheme,
OnboardingThemes,
ServiceError,
ObjectSerializer
} from "../../typings/legalEntityManagement/models";
import { IRequest } from "../../typings/requestOptions";
import Resource from "../resource";
export class HostedOnboardingApi 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 Get a link to an Adyen-hosted onboarding page
* @param id {@link string } The unique identifier of the legal entity
* @param onboardingLinkInfo {@link OnboardingLinkInfo }
* @param requestOptions {@link IRequest.Options }
* @return {@link OnboardingLink }
*/
public async getLinkToAdyenhostedOnboardingPage(id: string, onboardingLinkInfo: OnboardingLinkInfo, requestOptions?: IRequest.Options): Promise<OnboardingLink> {
const endpoint = `${this.baseUrl}/legalEntities/{id}/onboardingLinks`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);
const request: OnboardingLinkInfo = ObjectSerializer.serialize(onboardingLinkInfo, "OnboardingLinkInfo");
const response = await getJsonResponse<OnboardingLinkInfo, OnboardingLink>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
return ObjectSerializer.deserialize(response, "OnboardingLink");
}
/**
* @summary Get an onboarding link theme
* @param id {@link string } The unique identifier of the theme
* @param requestOptions {@link IRequest.Options }
* @return {@link OnboardingTheme }
*/
public async getOnboardingLinkTheme(id: string, requestOptions?: IRequest.Options): Promise<OnboardingTheme> {
const endpoint = `${this.baseUrl}/themes/{id}`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);
const response = await getJsonResponse<string, OnboardingTheme>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "OnboardingTheme");
}
/**
* @summary Get a list of hosted onboarding page themes
* @param requestOptions {@link IRequest.Options }
* @return {@link OnboardingThemes }
*/
public async listHostedOnboardingPageThemes(requestOptions?: IRequest.Options): Promise<OnboardingThemes> {
const endpoint = `${this.baseUrl}/themes`;
const resource = new Resource(this, endpoint);
const response = await getJsonResponse<string, OnboardingThemes>(
resource,
"",
{ ...requestOptions, method: "GET" }
);
return ObjectSerializer.deserialize(response, "OnboardingThemes");
}
}