Skip to content

Transfers API: method signature with required query parameters #1515

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
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
46 changes: 43 additions & 3 deletions src/__tests__/transfers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,45 @@ describe("Transfers", (): void => {
expect(response.id).toEqual("1W1UG35U8A9J5ZLG");
});

test("should get transfer", async (): Promise<void> => {
scope.get("/transfers/123")
.reply(200, transfersSuccess);
const response: transfers.TransferData = await transfersAPI.TransfersApi.getTransfer("123",);
expect(response.id).toEqual("1W1UG35U8A9J5ZLG");
});

test("should list transfers", async (): Promise<void> => {
const createdSince = new Date(Date.UTC(2023, 11, 12, 0, 0, 0)); // 12-12-2023 December is month 11
const createdUntil = new Date(Date.UTC(2023, 11, 13, 0, 0, 0)); // 13-12-2023 December is month 11

scope
.get("/transfers")
.query({
balancePlatform: "platform",
createdSince: createdSince.toISOString(),
createdUntil: createdUntil.toISOString(),
})
.reply(200, listTransactionsSuccess);

const response: transfers.FindTransfersResponse = await transfersAPI.TransfersApi.getAllTransfers(
createdSince,
createdUntil,
"platform",
undefined,
undefined,
undefined,
undefined
);

expect(response.data?.length).toEqual(3);
if (response.data && response.data.length > 0) {
expect(response.data[0].id).toEqual("1VVF0D5U66PIUIVP");
} else {
fail();
}
});


test("should get transaction", async (): Promise<void> => {
scope.get("/transactions/123")
.reply(200, getTransactionSuccess);
Expand All @@ -68,13 +107,13 @@ describe("Transfers", (): void => {
.reply(200, listTransactionsSuccess);

const response: transfers.TransactionSearchResponse = await transfersAPI.TransactionsApi.getAllTransactions(
createdSince,
createdUntil,
"platform",
undefined,
undefined,
undefined,
undefined,
createdSince,
createdUntil
undefined
);

expect(response.data?.length).toEqual(3);
Expand All @@ -84,4 +123,5 @@ describe("Transfers", (): void => {
fail();
}
});

});
10 changes: 5 additions & 5 deletions src/services/transfers/capitalApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class CapitalApi extends Service {
/**
* @summary Get a capital account
* @param requestOptions {@link IRequest.Options }
* @param counterpartyAccountHolderId {@link string } The counterparty account holder id.
* @param counterpartyAccountHolderId {@link string } The counterparty account holder id.
* @return {@link CapitalGrants }
*
* @deprecated since Transfers API v4
Expand All @@ -57,7 +57,7 @@ export class CapitalApi extends Service {
{ ...requestOptions, method: "GET" }
);

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

/**
Expand All @@ -80,7 +80,7 @@ export class CapitalApi extends Service {
{ ...requestOptions, method: "GET" }
);

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

/**
Expand All @@ -96,14 +96,14 @@ export class CapitalApi extends Service {
const endpoint = `${this.baseUrl}/grants`;
const resource = new Resource(this, endpoint);

const request: CapitalGrantInfo = ObjectSerializer.serialize(capitalGrantInfo, "CapitalGrantInfo", "");
const request: CapitalGrantInfo = ObjectSerializer.serialize(capitalGrantInfo, "CapitalGrantInfo");
const response = await getJsonResponse<CapitalGrantInfo, CapitalGrant>(
resource,
request,
{ ...requestOptions, method: "POST" }
);

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

}
22 changes: 11 additions & 11 deletions src/services/transfers/transactionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,17 @@ export class TransactionsApi extends Service {
/**
* @summary Get all transactions
* @param requestOptions {@link IRequest.Options }
* @param balancePlatform {@link string } The unique identifier of the [balance platform](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balancePlatforms/{id}__queryParam_id). Required if you don\&#39;t provide a &#x60;balanceAccountId&#x60; or &#x60;accountHolderId&#x60;.
* @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 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 createdSince {@link Date } Only include transactions that have been created on or after this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
* @param createdUntil {@link Date } Only include transactions that have been created on or before this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
* @param limit {@link number } The number of items returned per page, maximum of 100 items. By default, the response returns 10 items per page.
* @param createdSince {@link Date } (Required) Only include transactions that have been created on or after this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
* @param createdUntil {@link Date } (Required) Only include transactions that have been created on or before this point in time. The value must be in ISO 8601 format. For example, **2021-05-30T15:07:40Z**.
* @param balancePlatform {@link string } The unique identifier of the [balance platform](https://docs.adyen.com/api-explorer/#/balanceplatform/latest/get/balancePlatforms/{id}__queryParam_id). Required if you don\&#39;t provide a &#x60;balanceAccountId&#x60; or &#x60;accountHolderId&#x60;.
* @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 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 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(balancePlatform?: string, paymentInstrumentId?: string, accountHolderId?: string, balanceAccountId?: string, cursor?: string, createdSince?: Date, createdUntil?: Date, limit?: number, requestOptions?: IRequest.Options): Promise<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> {
const endpoint = `${this.baseUrl}/transactions`;
const resource = new Resource(this, endpoint);

Expand All @@ -67,7 +67,7 @@ export class TransactionsApi extends Service {
{ ...requestOptions, method: "GET" }
);

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

/**
Expand All @@ -87,7 +87,7 @@ export class TransactionsApi extends Service {
{ ...requestOptions, method: "GET" }
);

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

}
Loading