Skip to content
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
69 changes: 51 additions & 18 deletions examples/node-nestjs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/node-nestjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"nestjs-pino": "4.4.0",
"pg": "8.14.1",
"pino-http": "10.4.0",
"pluggy-sdk": "0.70.0",
"pluggy-sdk": "0.85.3",
"reflect-metadata": "0.2.2",
"rxjs": "7.8.2",
"sequelize": "6.37.8",
Expand Down
11 changes: 5 additions & 6 deletions examples/node-nestjs/src/services/transaction.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export class TransactionService {
itemId: payload.itemId,
});

const { results: transactions } = await this.pluggyClient
const transactions = await this.pluggyClient
.instance()
.fetchTransactions(payload.accountId, {
.fetchAllTransactions(payload.accountId, {
createdAtFrom: payload.transactionsCreatedAtFrom,
});

Expand All @@ -42,12 +42,11 @@ export class TransactionService {
itemId: payload.itemId,
});

const { results: transactions } = await this.pluggyClient
const transactions = await this.pluggyClient
.instance()
.fetchTransactions(payload.accountId, {
// @ts-expect-error ids not exists
.fetchAllTransactions(payload.accountId, {
ids: payload.transactionIds,
});
} as any);

await this.saveTransactions(
payload.itemId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,9 @@ export async function handleTransactionsUpdated({transactionIds = [], accountId
try {
if (transactionIds.length === 0) return;

const transactions: Transaction[] = [];
let page = 1;
while (true) {
const response = await pluggyClient.fetchTransactions(accountId, {
ids: transactionIds,
page,
pageSize: 500,
});
transactions.push(...response.results);
if (response.results.length < 500) break;
page++;
}
const transactions = await pluggyClient.fetchAllTransactions(accountId, {
ids: transactionIds,
} as any);

if (transactions.length === 0) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public static void main(String[] args) throws IOException, InterruptedException
account.getBalance(), account.getNumber()));

try {
// TODO: migrate to cursor-based GET /v2/transactions once pluggy-java SDK adds support.
// pluggy-java 0.6.3 only exposes getTransactions() which calls the deprecated GET /transactions.
// Track: https://github.com/pluggyai/pluggy-java
List<Transaction> transactions = pluggyClient.service().getTransactions(accountId).execute().body()
.getResults();

Expand Down
Loading