Skip to content

Commit f654498

Browse files
authored
Merge pull request #1523 from Adyen/sdk-automation/models
Code generation: update services and models
2 parents 8b36f0a + c60df53 commit f654498

File tree

142 files changed

+1359
-483
lines changed

Some content is hidden

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

142 files changed

+1359
-483
lines changed

.github/workflows/format.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ jobs:
2525
git config user.name AdyenAutomationBot
2626
git config user.email "${{ secrets.ADYEN_AUTOMATION_BOT_EMAIL }}"
2727
git add .
28-
git commit -m "style(fmt): code formatted"
28+
git commit -m "style(fmt): code formatted" || echo "No changes to commit"
2929
git push

src/services/balancePlatform/accountHoldersApi.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,21 @@ export class AccountHoldersApi extends Service {
130130
* @param requestOptions {@link IRequest.Options }
131131
* @param formType {@link 'US1099k' | 'US1099nec' } (Required) The type of tax form you want to retrieve. Accepted values are **US1099k** and **US1099nec**
132132
* @param year {@link number } (Required) The tax year in YYYY format for the tax form you want to retrieve
133+
* @param legalEntityId {@link string } The legal entity reference whose tax form you want to retrieve
133134
* @return {@link GetTaxFormResponse }
134135
*/
135-
public async getTaxForm(id: string, formType: "US1099k" | "US1099nec", year: number, requestOptions?: IRequest.Options): Promise<GetTaxFormResponse> {
136+
public async getTaxForm(id: string, formType: "US1099k" | "US1099nec", year: number, legalEntityId?: string, requestOptions?: IRequest.Options): Promise<GetTaxFormResponse> {
136137
const endpoint = `${this.baseUrl}/accountHolders/{id}/taxForms`
137138
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
138139
const resource = new Resource(this, endpoint);
139140

140-
const hasDefinedQueryParams = formType ?? year;
141+
const hasDefinedQueryParams = formType ?? year ?? legalEntityId;
141142
if(hasDefinedQueryParams) {
142143
if(!requestOptions) requestOptions = {};
143144
if(!requestOptions.params) requestOptions.params = {};
144145
if(formType) requestOptions.params["formType"] = formType;
145146
if(year) requestOptions.params["year"] = year;
147+
if(legalEntityId) requestOptions.params["legalEntityId"] = legalEntityId;
146148
}
147149
const response = await getJsonResponse<string, GetTaxFormResponse>(
148150
resource,
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
/*
2+
* The version of the OpenAPI document: v2
3+
*
4+
*
5+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
6+
* https://openapi-generator.tech
7+
* Do not edit this class manually.
8+
*/
9+
10+
11+
import getJsonResponse from "../../helpers/getJsonResponse";
12+
import Service from "../../service";
13+
import Client from "../../client";
14+
import { IRequest } from "../../typings/requestOptions";
15+
import Resource from "../resource";
16+
17+
import { ObjectSerializer } from "../../typings/balancePlatform/objectSerializer";
18+
import { AuthorisedCardUsers } from "../../typings/balancePlatform/models";
19+
20+
/**
21+
* API handler for AuthorizedCardUsersApi
22+
*/
23+
export class AuthorizedCardUsersApi extends Service {
24+
25+
private readonly API_BASEPATH: string = "https://balanceplatform-api-test.adyen.com/bcl/v2";
26+
private baseUrl: string;
27+
28+
public constructor(client: Client){
29+
super(client);
30+
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
31+
}
32+
33+
/**
34+
* @summary Create authorized users for a card.
35+
* @param paymentInstrumentId {@link string }
36+
* @param authorisedCardUsers {@link AuthorisedCardUsers }
37+
* @param requestOptions {@link IRequest.Options }
38+
* @return {@link void }
39+
*/
40+
public async createAuthorisedCardUsers(paymentInstrumentId: string, authorisedCardUsers: AuthorisedCardUsers, requestOptions?: IRequest.Options): Promise<void> {
41+
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
42+
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
43+
const resource = new Resource(this, endpoint);
44+
45+
const request: AuthorisedCardUsers = ObjectSerializer.serialize(authorisedCardUsers, "AuthorisedCardUsers");
46+
await getJsonResponse<AuthorisedCardUsers, void>(
47+
resource,
48+
request,
49+
{ ...requestOptions, method: "POST" }
50+
);
51+
}
52+
53+
/**
54+
* @summary Delete the authorized users for a card.
55+
* @param paymentInstrumentId {@link string }
56+
* @param requestOptions {@link IRequest.Options }
57+
* @return {@link void }
58+
*/
59+
public async deleteAuthorisedCardUsers(paymentInstrumentId: string, requestOptions?: IRequest.Options): Promise<void> {
60+
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
61+
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
62+
const resource = new Resource(this, endpoint);
63+
64+
await getJsonResponse<string, void>(
65+
resource,
66+
"",
67+
{ ...requestOptions, method: "DELETE" }
68+
);
69+
}
70+
71+
/**
72+
* @summary Get authorized users for a card.
73+
* @param paymentInstrumentId {@link string }
74+
* @param requestOptions {@link IRequest.Options }
75+
* @return {@link AuthorisedCardUsers }
76+
*/
77+
public async getAllAuthorisedCardUsers(paymentInstrumentId: string, requestOptions?: IRequest.Options): Promise<AuthorisedCardUsers> {
78+
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
79+
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
80+
const resource = new Resource(this, endpoint);
81+
82+
const response = await getJsonResponse<string, AuthorisedCardUsers>(
83+
resource,
84+
"",
85+
{ ...requestOptions, method: "GET" }
86+
);
87+
88+
return ObjectSerializer.deserialize(response, "AuthorisedCardUsers");
89+
}
90+
91+
/**
92+
* @summary Update the authorized users for a card.
93+
* @param paymentInstrumentId {@link string }
94+
* @param authorisedCardUsers {@link AuthorisedCardUsers }
95+
* @param requestOptions {@link IRequest.Options }
96+
* @return {@link void }
97+
*/
98+
public async updateAuthorisedCardUsers(paymentInstrumentId: string, authorisedCardUsers: AuthorisedCardUsers, requestOptions?: IRequest.Options): Promise<void> {
99+
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
100+
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
101+
const resource = new Resource(this, endpoint);
102+
103+
const request: AuthorisedCardUsers = ObjectSerializer.serialize(authorisedCardUsers, "AuthorisedCardUsers");
104+
await getJsonResponse<AuthorisedCardUsers, void>(
105+
resource,
106+
request,
107+
{ ...requestOptions, method: "PATCH" }
108+
);
109+
}
110+
111+
}

src/services/balancePlatform/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
import { AccountHoldersApi } from "./accountHoldersApi";
11+
import { AuthorizedCardUsersApi } from "./authorizedCardUsersApi";
1112
import { BalanceAccountsApi } from "./balanceAccountsApi";
1213
import { BalancesApi } from "./balancesApi";
1314
import { BankAccountValidationApi } from "./bankAccountValidationApi";
@@ -36,6 +37,10 @@ export default class BalancePlatformAPI extends Service {
3637
return new AccountHoldersApi(this.client);
3738
}
3839

40+
public get AuthorizedCardUsersApi() {
41+
return new AuthorizedCardUsersApi(this.client);
42+
}
43+
3944
public get BalanceAccountsApi() {
4045
return new BalanceAccountsApi(this.client);
4146
}

src/services/balancePlatform/paymentInstrumentsApi.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import Resource from "../resource";
1616

1717
import { ObjectSerializer } from "../../typings/balancePlatform/objectSerializer";
1818
import { ListNetworkTokensResponse } from "../../typings/balancePlatform/models";
19+
import { NetworkTokenActivationDataRequest } from "../../typings/balancePlatform/models";
20+
import { NetworkTokenActivationDataResponse } from "../../typings/balancePlatform/models";
1921
import { PaymentInstrument } from "../../typings/balancePlatform/models";
2022
import { PaymentInstrumentInfo } from "../../typings/balancePlatform/models";
2123
import { PaymentInstrumentRevealInfo } from "../../typings/balancePlatform/models";
@@ -38,6 +40,28 @@ export class PaymentInstrumentsApi extends Service {
3840
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
3941
}
4042

43+
/**
44+
* @summary Create network token activation data
45+
* @param id {@link string } The unique identifier of the payment instrument.
46+
* @param networkTokenActivationDataRequest {@link NetworkTokenActivationDataRequest }
47+
* @param requestOptions {@link IRequest.Options }
48+
* @return {@link NetworkTokenActivationDataResponse }
49+
*/
50+
public async createNetworkTokenActivationData(id: string, networkTokenActivationDataRequest: NetworkTokenActivationDataRequest, requestOptions?: IRequest.Options): Promise<NetworkTokenActivationDataResponse> {
51+
const endpoint = `${this.baseUrl}/paymentInstruments/{id}/networkTokenActivationData`
52+
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
53+
const resource = new Resource(this, endpoint);
54+
55+
const request: NetworkTokenActivationDataRequest = ObjectSerializer.serialize(networkTokenActivationDataRequest, "NetworkTokenActivationDataRequest");
56+
const response = await getJsonResponse<NetworkTokenActivationDataRequest, NetworkTokenActivationDataResponse>(
57+
resource,
58+
request,
59+
{ ...requestOptions, method: "POST" }
60+
);
61+
62+
return ObjectSerializer.deserialize(response, "NetworkTokenActivationDataResponse");
63+
}
64+
4165
/**
4266
* @summary Create a payment instrument
4367
* @param paymentInstrumentInfo {@link PaymentInstrumentInfo }
@@ -78,6 +102,26 @@ export class PaymentInstrumentsApi extends Service {
78102
return ObjectSerializer.deserialize(response, "TransactionRulesResponse");
79103
}
80104

105+
/**
106+
* @summary Get network token activation data
107+
* @param id {@link string } The unique identifier of the payment instrument.
108+
* @param requestOptions {@link IRequest.Options }
109+
* @return {@link NetworkTokenActivationDataResponse }
110+
*/
111+
public async getNetworkTokenActivationData(id: string, requestOptions?: IRequest.Options): Promise<NetworkTokenActivationDataResponse> {
112+
const endpoint = `${this.baseUrl}/paymentInstruments/{id}/networkTokenActivationData`
113+
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
114+
const resource = new Resource(this, endpoint);
115+
116+
const response = await getJsonResponse<string, NetworkTokenActivationDataResponse>(
117+
resource,
118+
"",
119+
{ ...requestOptions, method: "GET" }
120+
);
121+
122+
return ObjectSerializer.deserialize(response, "NetworkTokenActivationDataResponse");
123+
}
124+
81125
/**
82126
* @summary Get the PAN of a payment instrument
83127
* @param id {@link string } The unique identifier of the payment instrument.

src/services/transfers/transactionsApi.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,15 @@ export class TransactionsApi extends Service {
4141
* @param accountHolderId {@link string } The unique identifier of the [account holder](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/accountHolders/{id}__queryParam_id). Required if you don\&#39;t provide a &#x60;balanceAccountId&#x60; or &#x60;balancePlatform&#x60;. If you provide a &#x60;balanceAccountId&#x60;, the &#x60;accountHolderId&#x60; must be related to the &#x60;balanceAccountId&#x60;.
4242
* @param balanceAccountId {@link string } The unique identifier of the [balance account](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balanceAccounts/{id}__queryParam_id). Required if you don\&#39;t provide an &#x60;accountHolderId&#x60; or &#x60;balancePlatform&#x60;. If you provide an &#x60;accountHolderId&#x60;, the &#x60;balanceAccountId&#x60; must be related to the &#x60;accountHolderId&#x60;.
4343
* @param cursor {@link string } The &#x60;cursor&#x60; returned in the links of the previous response.
44+
* @param sortOrder {@link &#39;asc&#39; | &#39;desc&#39; } The transactions sorting order. Possible values: - **asc**: Ascending order, from older to most recent. - **desc**: Descending order, from most recent to older.
4445
* @param limit {@link number } The number of items returned per page, maximum of 100 items. By default, the response returns 10 items per page.
4546
* @return {@link TransactionSearchResponse }
4647
*/
47-
public async getAllTransactions(createdSince: Date, createdUntil: Date, balancePlatform?: string, paymentInstrumentId?: string, accountHolderId?: string, balanceAccountId?: string, cursor?: string, limit?: number, requestOptions?: IRequest.Options): Promise<TransactionSearchResponse> {
48+
public async getAllTransactions(createdSince: Date, createdUntil: Date, balancePlatform?: string, paymentInstrumentId?: string, accountHolderId?: string, balanceAccountId?: string, cursor?: string, sortOrder?: "asc" | "desc", limit?: number, requestOptions?: IRequest.Options): Promise<TransactionSearchResponse> {
4849
const endpoint = `${this.baseUrl}/transactions`;
4950
const resource = new Resource(this, endpoint);
5051

51-
const hasDefinedQueryParams = balancePlatform ?? paymentInstrumentId ?? accountHolderId ?? balanceAccountId ?? cursor ?? createdSince ?? createdUntil ?? limit;
52+
const hasDefinedQueryParams = balancePlatform ?? paymentInstrumentId ?? accountHolderId ?? balanceAccountId ?? cursor ?? createdSince ?? createdUntil ?? sortOrder ?? limit;
5253
if(hasDefinedQueryParams) {
5354
if(!requestOptions) requestOptions = {};
5455
if(!requestOptions.params) requestOptions.params = {};
@@ -59,6 +60,7 @@ export class TransactionsApi extends Service {
5960
if(cursor) requestOptions.params["cursor"] = cursor;
6061
if(createdSince) requestOptions.params["createdSince"] = createdSince.toISOString();
6162
if(createdUntil) requestOptions.params["createdUntil"] = createdUntil.toISOString();
63+
if(sortOrder) requestOptions.params["sortOrder"] = sortOrder;
6264
if(limit) requestOptions.params["limit"] = limit;
6365
}
6466
const response = await getJsonResponse<string, TransactionSearchResponse>(

src/services/transfers/transfersApi.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,16 @@ export class TransfersApi extends Service {
8484
* @param paymentInstrumentId {@link string } The unique identifier of the [payment instrument](https://docs.adyen.com/api-explorer/balanceplatform/latest/get/paymentInstruments/_id_). To use this parameter, you must also provide a &#x60;balanceAccountId&#x60;, &#x60;accountHolderId&#x60;, or &#x60;balancePlatform&#x60;. The &#x60;paymentInstrumentId&#x60; must be related to the &#x60;balanceAccountId&#x60; or &#x60;accountHolderId&#x60; that you provide.
8585
* @param reference {@link string } The reference you provided in the POST [/transfers](https://docs.adyen.com/api-explorer/transfers/latest/post/transfers) request
8686
* @param category {@link &#39;bank&#39; | &#39;card&#39; | &#39;grants&#39; | &#39;interest&#39; | &#39;internal&#39; | &#39;issuedCard&#39; | &#39;migration&#39; | &#39;platformPayment&#39; | &#39;topUp&#39; | &#39;upgrade&#39; } The type of transfer. Possible values: - **bank**: Transfer to a [transfer instrument](https://docs.adyen.com/api-explorer/#/legalentity/latest/post/transferInstruments__resParam_id) or a bank account. - **internal**: Transfer to another [balance account](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/post/balanceAccounts__resParam_id) within your platform. - **issuedCard**: Transfer initiated by a Adyen-issued card. - **platformPayment**: Fund movements related to payments that are acquired for your users.
87+
* @param sortOrder {@link &#39;asc&#39; | &#39;desc&#39; } The transfers sorting order. Possible values: - **asc**: Ascending order, from older to most recent. - **desc**: Descending order, from most recent to older.
8788
* @param cursor {@link string } The &#x60;cursor&#x60; returned in the links of the previous response.
8889
* @param limit {@link number } The number of items returned per page, maximum of 100 items. By default, the response returns 10 items per page.
8990
* @return {@link FindTransfersResponse }
9091
*/
91-
public async getAllTransfers(createdSince: Date, createdUntil: Date, balancePlatform?: string, accountHolderId?: string, balanceAccountId?: string, paymentInstrumentId?: string, reference?: string, category?: "bank" | "card" | "grants" | "interest" | "internal" | "issuedCard" | "migration" | "platformPayment" | "topUp" | "upgrade", cursor?: string, limit?: number, requestOptions?: IRequest.Options): Promise<FindTransfersResponse> {
92+
public async getAllTransfers(createdSince: Date, createdUntil: Date, balancePlatform?: string, accountHolderId?: string, balanceAccountId?: string, paymentInstrumentId?: string, reference?: string, category?: "bank" | "card" | "grants" | "interest" | "internal" | "issuedCard" | "migration" | "platformPayment" | "topUp" | "upgrade", sortOrder?: "asc" | "desc", cursor?: string, limit?: number, requestOptions?: IRequest.Options): Promise<FindTransfersResponse> {
9293
const endpoint = `${this.baseUrl}/transfers`;
9394
const resource = new Resource(this, endpoint);
9495

95-
const hasDefinedQueryParams = balancePlatform ?? accountHolderId ?? balanceAccountId ?? paymentInstrumentId ?? reference ?? category ?? createdSince ?? createdUntil ?? cursor ?? limit;
96+
const hasDefinedQueryParams = balancePlatform ?? accountHolderId ?? balanceAccountId ?? paymentInstrumentId ?? reference ?? category ?? createdSince ?? createdUntil ?? sortOrder ?? cursor ?? limit;
9697
if(hasDefinedQueryParams) {
9798
if(!requestOptions) requestOptions = {};
9899
if(!requestOptions.params) requestOptions.params = {};
@@ -104,6 +105,7 @@ export class TransfersApi extends Service {
104105
if(category) requestOptions.params["category"] = category;
105106
if(createdSince) requestOptions.params["createdSince"] = createdSince.toISOString();
106107
if(createdUntil) requestOptions.params["createdUntil"] = createdUntil.toISOString();
108+
if(sortOrder) requestOptions.params["sortOrder"] = sortOrder;
107109
if(cursor) requestOptions.params["cursor"] = cursor;
108110
if(limit) requestOptions.params["limit"] = limit;
109111
}

src/typings/acsWebhooks/acsWebhooksHandler.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,7 @@ export class AcsWebhooksHandler {
4444
return this.getAuthenticationNotificationRequest();
4545
}
4646

47-
// manually commented out: RelayedAuthenticationRequest has no TypeEnum
48-
// if(Object.values(acsWebhooks.RelayedAuthenticationRequest.TypeEnum).includes(type)) {
49-
// return this.getRelayedAuthenticationRequest();
50-
// }
51-
if(!type && this.payload["paymentInstrumentId"]){
52-
// ad-hoc fix for the relayed authentication request
53-
// if type is undefined but paymentInstrumentId is present then it is a relayedAuthenticationRequest
47+
if(Object.values(acsWebhooks.RelayedAuthenticationRequest.TypeEnum).includes(type)) {
5448
return this.getRelayedAuthenticationRequest();
5549
}
5650

src/typings/acsWebhooks/objectSerializer.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ let enumsMap: Set<string> = new Set<string>([
3939
"AuthenticationNotificationRequest.TypeEnum",
4040
"ChallengeInfo.ChallengeCancelEnum",
4141
"ChallengeInfo.FlowEnum",
42+
"RelayedAuthenticationRequest.TypeEnum",
4243
]);
4344

4445
let typeMap: {[index: string]: any} = {

0 commit comments

Comments
 (0)