Skip to content

Commit 064d5fb

Browse files
authored
Merge pull request #1516 from Adyen/generate-management-api
OpenGenerator v7: Generate Management API
2 parents d89a1c9 + ff95e95 commit 064d5fb

File tree

233 files changed

+6426
-3630
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+6426
-3630
lines changed

src/__tests__/terminalSettings.spec.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ describe("TerminalSettings properties", () => {
77
terminalSettings = new TerminalSettings();
88
});
99

10-
test("should allow properties to be null", () => {
11-
terminalSettings.cardholderReceipt = null;
12-
terminalSettings.connectivity = null;
13-
terminalSettings.gratuities = null;
14-
terminalSettings.hardware = null;
15-
16-
expect(terminalSettings.cardholderReceipt).toBeNull();
17-
expect(terminalSettings.connectivity).toBeNull();
18-
expect(terminalSettings.gratuities).toBeNull();
19-
expect(terminalSettings.hardware).toBeNull();
20-
});
10+
// TMP: commented out to decide if attributes should be nullable (even when OpenAPI spec does not allow it)
11+
// https://github.com/Adyen/adyen-node-api-library/issues/1351
12+
//
13+
// test("should allow properties to be null", () => {
14+
// terminalSettings.cardholderReceipt = null;
15+
// terminalSettings.connectivity = null;
16+
// terminalSettings.gratuities = null;
17+
// terminalSettings.hardware = null;
18+
19+
// expect(terminalSettings.cardholderReceipt).toBeNull();
20+
// expect(terminalSettings.connectivity).toBeNull();
21+
// expect(terminalSettings.gratuities).toBeNull();
22+
// expect(terminalSettings.hardware).toBeNull();
23+
// });
2124

2225
test("should allow properties to be undefined", () => {
2326
terminalSettings.cardholderReceipt = undefined;

src/services/management/aPICredentialsCompanyLevelApi.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,23 @@
77
* Do not edit this class manually.
88
*/
99

10+
1011
import getJsonResponse from "../../helpers/getJsonResponse";
1112
import Service from "../../service";
1213
import Client from "../../client";
13-
import {
14-
CompanyApiCredential,
15-
CreateCompanyApiCredentialRequest,
16-
CreateCompanyApiCredentialResponse,
17-
ListCompanyApiCredentialsResponse,
18-
UpdateCompanyApiCredentialRequest,
19-
ObjectSerializer
20-
} from "../../typings/management/models";
2114
import { IRequest } from "../../typings/requestOptions";
2215
import Resource from "../resource";
2316

17+
import { ObjectSerializer } from "../../typings/management/objectSerializer";
18+
import { CompanyApiCredential } from "../../typings/management/models";
19+
import { CreateCompanyApiCredentialRequest } from "../../typings/management/models";
20+
import { CreateCompanyApiCredentialResponse } from "../../typings/management/models";
21+
import { ListCompanyApiCredentialsResponse } from "../../typings/management/models";
22+
import { UpdateCompanyApiCredentialRequest } from "../../typings/management/models";
23+
24+
/**
25+
* API handler for APICredentialsCompanyLevelApi
26+
*/
2427
export class APICredentialsCompanyLevelApi extends Service {
2528

2629
private readonly API_BASEPATH: string = "https://management-test.adyen.com/v3";
@@ -42,12 +45,14 @@ export class APICredentialsCompanyLevelApi extends Service {
4245
const endpoint = `${this.baseUrl}/companies/{companyId}/apiCredentials`
4346
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)));
4447
const resource = new Resource(this, endpoint);
48+
4549
const request: CreateCompanyApiCredentialRequest = ObjectSerializer.serialize(createCompanyApiCredentialRequest, "CreateCompanyApiCredentialRequest");
4650
const response = await getJsonResponse<CreateCompanyApiCredentialRequest, CreateCompanyApiCredentialResponse>(
4751
resource,
4852
request,
4953
{ ...requestOptions, method: "POST" }
5054
);
55+
5156
return ObjectSerializer.deserialize(response, "CreateCompanyApiCredentialResponse");
5257
}
5358

@@ -63,11 +68,13 @@ export class APICredentialsCompanyLevelApi extends Service {
6368
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
6469
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
6570
const resource = new Resource(this, endpoint);
71+
6672
const response = await getJsonResponse<string, CompanyApiCredential>(
6773
resource,
6874
"",
6975
{ ...requestOptions, method: "GET" }
7076
);
77+
7178
return ObjectSerializer.deserialize(response, "CompanyApiCredential");
7279
}
7380

@@ -83,6 +90,7 @@ export class APICredentialsCompanyLevelApi extends Service {
8390
const endpoint = `${this.baseUrl}/companies/{companyId}/apiCredentials`
8491
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)));
8592
const resource = new Resource(this, endpoint);
93+
8694
const hasDefinedQueryParams = pageNumber ?? pageSize;
8795
if(hasDefinedQueryParams) {
8896
if(!requestOptions) requestOptions = {};
@@ -95,6 +103,7 @@ export class APICredentialsCompanyLevelApi extends Service {
95103
"",
96104
{ ...requestOptions, method: "GET" }
97105
);
106+
98107
return ObjectSerializer.deserialize(response, "ListCompanyApiCredentialsResponse");
99108
}
100109

@@ -111,12 +120,15 @@ export class APICredentialsCompanyLevelApi extends Service {
111120
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
112121
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
113122
const resource = new Resource(this, endpoint);
123+
114124
const request: UpdateCompanyApiCredentialRequest = ObjectSerializer.serialize(updateCompanyApiCredentialRequest, "UpdateCompanyApiCredentialRequest");
115125
const response = await getJsonResponse<UpdateCompanyApiCredentialRequest, CompanyApiCredential>(
116126
resource,
117127
request,
118128
{ ...requestOptions, method: "PATCH" }
119129
);
130+
120131
return ObjectSerializer.deserialize(response, "CompanyApiCredential");
121132
}
133+
122134
}

src/services/management/aPICredentialsMerchantLevelApi.ts

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,23 @@
77
* Do not edit this class manually.
88
*/
99

10+
1011
import getJsonResponse from "../../helpers/getJsonResponse";
1112
import Service from "../../service";
1213
import Client from "../../client";
13-
import {
14-
ApiCredential,
15-
CreateApiCredentialResponse,
16-
CreateMerchantApiCredentialRequest,
17-
ListMerchantApiCredentialsResponse,
18-
UpdateMerchantApiCredentialRequest,
19-
ObjectSerializer
20-
} from "../../typings/management/models";
2114
import { IRequest } from "../../typings/requestOptions";
2215
import Resource from "../resource";
2316

17+
import { ObjectSerializer } from "../../typings/management/objectSerializer";
18+
import { ApiCredential } from "../../typings/management/models";
19+
import { CreateApiCredentialResponse } from "../../typings/management/models";
20+
import { CreateMerchantApiCredentialRequest } from "../../typings/management/models";
21+
import { ListMerchantApiCredentialsResponse } from "../../typings/management/models";
22+
import { UpdateMerchantApiCredentialRequest } from "../../typings/management/models";
23+
24+
/**
25+
* API handler for APICredentialsMerchantLevelApi
26+
*/
2427
export class APICredentialsMerchantLevelApi extends Service {
2528

2629
private readonly API_BASEPATH: string = "https://management-test.adyen.com/v3";
@@ -42,12 +45,14 @@ export class APICredentialsMerchantLevelApi extends Service {
4245
const endpoint = `${this.baseUrl}/merchants/{merchantId}/apiCredentials`
4346
.replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId)));
4447
const resource = new Resource(this, endpoint);
48+
4549
const request: CreateMerchantApiCredentialRequest = ObjectSerializer.serialize(createMerchantApiCredentialRequest, "CreateMerchantApiCredentialRequest");
4650
const response = await getJsonResponse<CreateMerchantApiCredentialRequest, CreateApiCredentialResponse>(
4751
resource,
4852
request,
4953
{ ...requestOptions, method: "POST" }
5054
);
55+
5156
return ObjectSerializer.deserialize(response, "CreateApiCredentialResponse");
5257
}
5358

@@ -63,11 +68,13 @@ export class APICredentialsMerchantLevelApi extends Service {
6368
.replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId)))
6469
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
6570
const resource = new Resource(this, endpoint);
71+
6672
const response = await getJsonResponse<string, ApiCredential>(
6773
resource,
6874
"",
6975
{ ...requestOptions, method: "GET" }
7076
);
77+
7178
return ObjectSerializer.deserialize(response, "ApiCredential");
7279
}
7380

@@ -83,6 +90,7 @@ export class APICredentialsMerchantLevelApi extends Service {
8390
const endpoint = `${this.baseUrl}/merchants/{merchantId}/apiCredentials`
8491
.replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId)));
8592
const resource = new Resource(this, endpoint);
93+
8694
const hasDefinedQueryParams = pageNumber ?? pageSize;
8795
if(hasDefinedQueryParams) {
8896
if(!requestOptions) requestOptions = {};
@@ -95,6 +103,7 @@ export class APICredentialsMerchantLevelApi extends Service {
95103
"",
96104
{ ...requestOptions, method: "GET" }
97105
);
106+
98107
return ObjectSerializer.deserialize(response, "ListMerchantApiCredentialsResponse");
99108
}
100109

@@ -111,12 +120,15 @@ export class APICredentialsMerchantLevelApi extends Service {
111120
.replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId)))
112121
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
113122
const resource = new Resource(this, endpoint);
123+
114124
const request: UpdateMerchantApiCredentialRequest = ObjectSerializer.serialize(updateMerchantApiCredentialRequest, "UpdateMerchantApiCredentialRequest");
115125
const response = await getJsonResponse<UpdateMerchantApiCredentialRequest, ApiCredential>(
116126
resource,
117127
request,
118128
{ ...requestOptions, method: "PATCH" }
119129
);
130+
120131
return ObjectSerializer.deserialize(response, "ApiCredential");
121132
}
133+
122134
}

src/services/management/aPIKeyCompanyLevelApi.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
* Do not edit this class manually.
88
*/
99

10+
1011
import getJsonResponse from "../../helpers/getJsonResponse";
1112
import Service from "../../service";
1213
import Client from "../../client";
13-
import {
14-
GenerateApiKeyResponse,
15-
ObjectSerializer
16-
} from "../../typings/management/models";
1714
import { IRequest } from "../../typings/requestOptions";
1815
import Resource from "../resource";
1916

17+
import { ObjectSerializer } from "../../typings/management/objectSerializer";
18+
import { GenerateApiKeyResponse } from "../../typings/management/models";
19+
20+
/**
21+
* API handler for APIKeyCompanyLevelApi
22+
*/
2023
export class APIKeyCompanyLevelApi extends Service {
2124

2225
private readonly API_BASEPATH: string = "https://management-test.adyen.com/v3";
@@ -39,11 +42,14 @@ export class APIKeyCompanyLevelApi extends Service {
3942
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
4043
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
4144
const resource = new Resource(this, endpoint);
45+
4246
const response = await getJsonResponse<string, GenerateApiKeyResponse>(
4347
resource,
4448
"",
4549
{ ...requestOptions, method: "POST" }
4650
);
51+
4752
return ObjectSerializer.deserialize(response, "GenerateApiKeyResponse");
4853
}
54+
4955
}

src/services/management/aPIKeyMerchantLevelApi.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
* Do not edit this class manually.
88
*/
99

10+
1011
import getJsonResponse from "../../helpers/getJsonResponse";
1112
import Service from "../../service";
1213
import Client from "../../client";
13-
import {
14-
GenerateApiKeyResponse,
15-
ObjectSerializer
16-
} from "../../typings/management/models";
1714
import { IRequest } from "../../typings/requestOptions";
1815
import Resource from "../resource";
1916

17+
import { ObjectSerializer } from "../../typings/management/objectSerializer";
18+
import { GenerateApiKeyResponse } from "../../typings/management/models";
19+
20+
/**
21+
* API handler for APIKeyMerchantLevelApi
22+
*/
2023
export class APIKeyMerchantLevelApi extends Service {
2124

2225
private readonly API_BASEPATH: string = "https://management-test.adyen.com/v3";
@@ -39,11 +42,14 @@ export class APIKeyMerchantLevelApi extends Service {
3942
.replace("{" + "merchantId" + "}", encodeURIComponent(String(merchantId)))
4043
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
4144
const resource = new Resource(this, endpoint);
45+
4246
const response = await getJsonResponse<string, GenerateApiKeyResponse>(
4347
resource,
4448
"",
4549
{ ...requestOptions, method: "POST" }
4650
);
51+
4752
return ObjectSerializer.deserialize(response, "GenerateApiKeyResponse");
4853
}
54+
4955
}

src/services/management/accountCompanyLevelApi.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,21 @@
77
* Do not edit this class manually.
88
*/
99

10+
1011
import getJsonResponse from "../../helpers/getJsonResponse";
1112
import Service from "../../service";
1213
import Client from "../../client";
13-
import {
14-
Company,
15-
ListCompanyResponse,
16-
ListMerchantResponse,
17-
ObjectSerializer
18-
} from "../../typings/management/models";
1914
import { IRequest } from "../../typings/requestOptions";
2015
import Resource from "../resource";
2116

17+
import { ObjectSerializer } from "../../typings/management/objectSerializer";
18+
import { Company } from "../../typings/management/models";
19+
import { ListCompanyResponse } from "../../typings/management/models";
20+
import { ListMerchantResponse } from "../../typings/management/models";
21+
22+
/**
23+
* API handler for AccountCompanyLevelApi
24+
*/
2225
export class AccountCompanyLevelApi extends Service {
2326

2427
private readonly API_BASEPATH: string = "https://management-test.adyen.com/v3";
@@ -39,11 +42,13 @@ export class AccountCompanyLevelApi extends Service {
3942
const endpoint = `${this.baseUrl}/companies/{companyId}`
4043
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)));
4144
const resource = new Resource(this, endpoint);
45+
4246
const response = await getJsonResponse<string, Company>(
4347
resource,
4448
"",
4549
{ ...requestOptions, method: "GET" }
4650
);
51+
4752
return ObjectSerializer.deserialize(response, "Company");
4853
}
4954

@@ -57,6 +62,7 @@ export class AccountCompanyLevelApi extends Service {
5762
public async listCompanyAccounts(pageNumber?: number, pageSize?: number, requestOptions?: IRequest.Options): Promise<ListCompanyResponse> {
5863
const endpoint = `${this.baseUrl}/companies`;
5964
const resource = new Resource(this, endpoint);
65+
6066
const hasDefinedQueryParams = pageNumber ?? pageSize;
6167
if(hasDefinedQueryParams) {
6268
if(!requestOptions) requestOptions = {};
@@ -69,6 +75,7 @@ export class AccountCompanyLevelApi extends Service {
6975
"",
7076
{ ...requestOptions, method: "GET" }
7177
);
78+
7279
return ObjectSerializer.deserialize(response, "ListCompanyResponse");
7380
}
7481

@@ -84,6 +91,7 @@ export class AccountCompanyLevelApi extends Service {
8491
const endpoint = `${this.baseUrl}/companies/{companyId}/merchants`
8592
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)));
8693
const resource = new Resource(this, endpoint);
94+
8795
const hasDefinedQueryParams = pageNumber ?? pageSize;
8896
if(hasDefinedQueryParams) {
8997
if(!requestOptions) requestOptions = {};
@@ -96,6 +104,8 @@ export class AccountCompanyLevelApi extends Service {
96104
"",
97105
{ ...requestOptions, method: "GET" }
98106
);
107+
99108
return ObjectSerializer.deserialize(response, "ListMerchantResponse");
100109
}
110+
101111
}

0 commit comments

Comments
 (0)