Skip to content

Code generation: update services and models #1523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 10, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/services/balancePlatform/accountHoldersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,21 @@ export class AccountHoldersApi extends Service {
* @param requestOptions {@link IRequest.Options }
* @param formType {@link 'US1099k' | 'US1099nec' } (Required) The type of tax form you want to retrieve. Accepted values are **US1099k** and **US1099nec**
* @param year {@link number } (Required) The tax year in YYYY format for the tax form you want to retrieve
* @param legalEntityId {@link string } The legal entity reference whose tax form you want to retrieve
* @return {@link GetTaxFormResponse }
*/
public async getTaxForm(id: string, formType: "US1099k" | "US1099nec", year: number, requestOptions?: IRequest.Options): Promise<GetTaxFormResponse> {
public async getTaxForm(id: string, formType: "US1099k" | "US1099nec", year: number, legalEntityId?: string, requestOptions?: IRequest.Options): Promise<GetTaxFormResponse> {
const endpoint = `${this.baseUrl}/accountHolders/{id}/taxForms`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);

const hasDefinedQueryParams = formType ?? year;
const hasDefinedQueryParams = formType ?? year ?? legalEntityId;
if(hasDefinedQueryParams) {
if(!requestOptions) requestOptions = {};
if(!requestOptions.params) requestOptions.params = {};
if(formType) requestOptions.params["formType"] = formType;
if(year) requestOptions.params["year"] = year;
if(legalEntityId) requestOptions.params["legalEntityId"] = legalEntityId;
}
const response = await getJsonResponse<string, GetTaxFormResponse>(
resource,
Expand Down
111 changes: 111 additions & 0 deletions src/services/balancePlatform/authorizedCardUsersApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* The version of the OpenAPI document: v2
*
*
* 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 { IRequest } from "../../typings/requestOptions";
import Resource from "../resource";

import { ObjectSerializer } from "../../typings/balancePlatform/objectSerializer";
import { AuthorisedCardUsers } from "../../typings/balancePlatform/models";

/**
* API handler for AuthorizedCardUsersApi
*/
export class AuthorizedCardUsersApi extends Service {

private readonly API_BASEPATH: string = "https://balanceplatform-api-test.adyen.com/bcl/v2";
private baseUrl: string;

public constructor(client: Client){
super(client);
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
}

/**
* @summary Create authorized users for a card.
* @param paymentInstrumentId {@link string }
* @param authorisedCardUsers {@link AuthorisedCardUsers }
* @param requestOptions {@link IRequest.Options }
* @return {@link void }
*/
public async createAuthorisedCardUsers(paymentInstrumentId: string, authorisedCardUsers: AuthorisedCardUsers, requestOptions?: IRequest.Options): Promise<void> {
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
const resource = new Resource(this, endpoint);

const request: AuthorisedCardUsers = ObjectSerializer.serialize(authorisedCardUsers, "AuthorisedCardUsers");
await getJsonResponse<AuthorisedCardUsers, void>(
resource,
request,
{ ...requestOptions, method: "POST" }
);
}

/**
* @summary Delete the authorized users for a card.
* @param paymentInstrumentId {@link string }
* @param requestOptions {@link IRequest.Options }
* @return {@link void }
*/
public async deleteAuthorisedCardUsers(paymentInstrumentId: string, requestOptions?: IRequest.Options): Promise<void> {
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
const resource = new Resource(this, endpoint);

await getJsonResponse<string, void>(
resource,
"",
{ ...requestOptions, method: "DELETE" }
);
}

/**
* @summary Get authorized users for a card.
* @param paymentInstrumentId {@link string }
* @param requestOptions {@link IRequest.Options }
* @return {@link AuthorisedCardUsers }
*/
public async getAllAuthorisedCardUsers(paymentInstrumentId: string, requestOptions?: IRequest.Options): Promise<AuthorisedCardUsers> {
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
const resource = new Resource(this, endpoint);

const response = await getJsonResponse<string, AuthorisedCardUsers>(
resource,
"",
{ ...requestOptions, method: "GET" }
);

return ObjectSerializer.deserialize(response, "AuthorisedCardUsers");
}

/**
* @summary Update the authorized users for a card.
* @param paymentInstrumentId {@link string }
* @param authorisedCardUsers {@link AuthorisedCardUsers }
* @param requestOptions {@link IRequest.Options }
* @return {@link void }
*/
public async updateAuthorisedCardUsers(paymentInstrumentId: string, authorisedCardUsers: AuthorisedCardUsers, requestOptions?: IRequest.Options): Promise<void> {
const endpoint = `${this.baseUrl}/paymentInstruments/{paymentInstrumentId}/authorisedCardUsers`
.replace("{" + "paymentInstrumentId" + "}", encodeURIComponent(String(paymentInstrumentId)));
const resource = new Resource(this, endpoint);

const request: AuthorisedCardUsers = ObjectSerializer.serialize(authorisedCardUsers, "AuthorisedCardUsers");
await getJsonResponse<AuthorisedCardUsers, void>(
resource,
request,
{ ...requestOptions, method: "PATCH" }
);
}

}
5 changes: 5 additions & 0 deletions src/services/balancePlatform/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

import { AccountHoldersApi } from "./accountHoldersApi";
import { AuthorizedCardUsersApi } from "./authorizedCardUsersApi";
import { BalanceAccountsApi } from "./balanceAccountsApi";
import { BalancesApi } from "./balancesApi";
import { BankAccountValidationApi } from "./bankAccountValidationApi";
Expand Down Expand Up @@ -36,6 +37,10 @@ export default class BalancePlatformAPI extends Service {
return new AccountHoldersApi(this.client);
}

public get AuthorizedCardUsersApi() {
return new AuthorizedCardUsersApi(this.client);
}

public get BalanceAccountsApi() {
return new BalanceAccountsApi(this.client);
}
Expand Down
44 changes: 44 additions & 0 deletions src/services/balancePlatform/paymentInstrumentsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import Resource from "../resource";

import { ObjectSerializer } from "../../typings/balancePlatform/objectSerializer";
import { ListNetworkTokensResponse } from "../../typings/balancePlatform/models";
import { NetworkTokenActivationDataRequest } from "../../typings/balancePlatform/models";
import { NetworkTokenActivationDataResponse } from "../../typings/balancePlatform/models";
import { PaymentInstrument } from "../../typings/balancePlatform/models";
import { PaymentInstrumentInfo } from "../../typings/balancePlatform/models";
import { PaymentInstrumentRevealInfo } from "../../typings/balancePlatform/models";
Expand All @@ -38,6 +40,28 @@ export class PaymentInstrumentsApi extends Service {
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
}

/**
* @summary Create network token activation data
* @param id {@link string } The unique identifier of the payment instrument.
* @param networkTokenActivationDataRequest {@link NetworkTokenActivationDataRequest }
* @param requestOptions {@link IRequest.Options }
* @return {@link NetworkTokenActivationDataResponse }
*/
public async createNetworkTokenActivationData(id: string, networkTokenActivationDataRequest: NetworkTokenActivationDataRequest, requestOptions?: IRequest.Options): Promise<NetworkTokenActivationDataResponse> {
const endpoint = `${this.baseUrl}/paymentInstruments/{id}/networkTokenActivationData`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);

const request: NetworkTokenActivationDataRequest = ObjectSerializer.serialize(networkTokenActivationDataRequest, "NetworkTokenActivationDataRequest");
const response = await getJsonResponse<NetworkTokenActivationDataRequest, NetworkTokenActivationDataResponse>(
resource,
request,
{ ...requestOptions, method: "POST" }
);

return ObjectSerializer.deserialize(response, "NetworkTokenActivationDataResponse");
}

/**
* @summary Create a payment instrument
* @param paymentInstrumentInfo {@link PaymentInstrumentInfo }
Expand Down Expand Up @@ -78,6 +102,26 @@ export class PaymentInstrumentsApi extends Service {
return ObjectSerializer.deserialize(response, "TransactionRulesResponse");
}

/**
* @summary Get network token activation data
* @param id {@link string } The unique identifier of the payment instrument.
* @param requestOptions {@link IRequest.Options }
* @return {@link NetworkTokenActivationDataResponse }
*/
public async getNetworkTokenActivationData(id: string, requestOptions?: IRequest.Options): Promise<NetworkTokenActivationDataResponse> {
const endpoint = `${this.baseUrl}/paymentInstruments/{id}/networkTokenActivationData`
.replace("{" + "id" + "}", encodeURIComponent(String(id)));
const resource = new Resource(this, endpoint);

const response = await getJsonResponse<string, NetworkTokenActivationDataResponse>(
resource,
"",
{ ...requestOptions, method: "GET" }
);

return ObjectSerializer.deserialize(response, "NetworkTokenActivationDataResponse");
}

/**
* @summary Get the PAN of a payment instrument
* @param id {@link string } The unique identifier of the payment instrument.
Expand Down
6 changes: 4 additions & 2 deletions src/services/transfers/transactionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,15 @@ export class TransactionsApi extends Service {
* @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;.
* @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;.
* @param cursor {@link string } The &#x60;cursor&#x60; returned in the links of the previous response.
* @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.
* @param limit {@link number } The number of items returned per page, maximum of 100 items. By default, the response returns 10 items per page.
* @return {@link TransactionSearchResponse }
*/
public async getAllTransactions(createdSince: Date, createdUntil: Date, balancePlatform?: string, paymentInstrumentId?: string, accountHolderId?: string, balanceAccountId?: string, cursor?: string, limit?: number, requestOptions?: IRequest.Options): Promise<TransactionSearchResponse> {
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> {
const endpoint = `${this.baseUrl}/transactions`;
const resource = new Resource(this, endpoint);

const hasDefinedQueryParams = balancePlatform ?? paymentInstrumentId ?? accountHolderId ?? balanceAccountId ?? cursor ?? createdSince ?? createdUntil ?? limit;
const hasDefinedQueryParams = balancePlatform ?? paymentInstrumentId ?? accountHolderId ?? balanceAccountId ?? cursor ?? createdSince ?? createdUntil ?? sortOrder ?? limit;
if(hasDefinedQueryParams) {
if(!requestOptions) requestOptions = {};
if(!requestOptions.params) requestOptions.params = {};
Expand All @@ -59,6 +60,7 @@ export class TransactionsApi extends Service {
if(cursor) requestOptions.params["cursor"] = cursor;
if(createdSince) requestOptions.params["createdSince"] = createdSince.toISOString();
if(createdUntil) requestOptions.params["createdUntil"] = createdUntil.toISOString();
if(sortOrder) requestOptions.params["sortOrder"] = sortOrder;
if(limit) requestOptions.params["limit"] = limit;
}
const response = await getJsonResponse<string, TransactionSearchResponse>(
Expand Down
6 changes: 4 additions & 2 deletions src/services/transfers/transfersApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ export class TransfersApi extends Service {
* @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.
* @param reference {@link string } The reference you provided in the POST [/transfers](https://docs.adyen.com/api-explorer/transfers/latest/post/transfers) request
* @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.
* @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.
* @param cursor {@link string } The &#x60;cursor&#x60; returned in the links of the previous response.
* @param limit {@link number } The number of items returned per page, maximum of 100 items. By default, the response returns 10 items per page.
* @return {@link FindTransfersResponse }
*/
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> {
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> {
const endpoint = `${this.baseUrl}/transfers`;
const resource = new Resource(this, endpoint);

const hasDefinedQueryParams = balancePlatform ?? accountHolderId ?? balanceAccountId ?? paymentInstrumentId ?? reference ?? category ?? createdSince ?? createdUntil ?? cursor ?? limit;
const hasDefinedQueryParams = balancePlatform ?? accountHolderId ?? balanceAccountId ?? paymentInstrumentId ?? reference ?? category ?? createdSince ?? createdUntil ?? sortOrder ?? cursor ?? limit;
if(hasDefinedQueryParams) {
if(!requestOptions) requestOptions = {};
if(!requestOptions.params) requestOptions.params = {};
Expand All @@ -104,6 +105,7 @@ export class TransfersApi extends Service {
if(category) requestOptions.params["category"] = category;
if(createdSince) requestOptions.params["createdSince"] = createdSince.toISOString();
if(createdUntil) requestOptions.params["createdUntil"] = createdUntil.toISOString();
if(sortOrder) requestOptions.params["sortOrder"] = sortOrder;
if(cursor) requestOptions.params["cursor"] = cursor;
if(limit) requestOptions.params["limit"] = limit;
}
Expand Down
8 changes: 1 addition & 7 deletions src/typings/acsWebhooks/acsWebhooksHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,7 @@ export class AcsWebhooksHandler {
return this.getAuthenticationNotificationRequest();
}

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

Expand Down
1 change: 1 addition & 0 deletions src/typings/acsWebhooks/objectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ let enumsMap: Set<string> = new Set<string>([
"AuthenticationNotificationRequest.TypeEnum",
"ChallengeInfo.ChallengeCancelEnum",
"ChallengeInfo.FlowEnum",
"RelayedAuthenticationRequest.TypeEnum",
]);

let typeMap: {[index: string]: any} = {
Expand Down
Loading
Loading