feat(server): Plaid webhooks

This commit is contained in:
Ahmed Bouhuolia
2024-02-08 20:18:52 +02:00
parent 00d9bc537c
commit 706a324121
3 changed files with 195 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ import { Inject, Service } from 'typedi';
import { PlaidLinkTokenService } from './PlaidLinkToken';
import { PlaidItemService } from './PlaidItem';
import { PlaidItemDTO } from '@/interfaces';
import { PlaidWebooks } from './PlaidWebhooks';
@Service()
export class PlaidApplication {
@@ -11,6 +12,9 @@ export class PlaidApplication {
@Inject()
private plaidItemService: PlaidItemService;
@Inject()
private plaidWebhooks: PlaidWebooks;
/**
* Retrieves the Plaid link token.
* @param {number} tenantId
@@ -30,4 +34,26 @@ export class PlaidApplication {
public exchangeToken(tenantId: number, itemDTO: PlaidItemDTO): Promise<void> {
return this.plaidItemService.item(tenantId, itemDTO);
}
/**
* Listens to Plaid webhooks
* @param {number} tenantId
* @param {string} webhookType
* @param {string} plaidItemId
* @param {string} webhookCode
* @returns
*/
public webhooks(
tenantId: number,
webhookType: string,
plaidItemId: string,
webhookCode: string
) {
return this.plaidWebhooks.webhooks(
tenantId,
webhookType,
plaidItemId,
webhookCode
);
}
}