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

@@ -16,6 +16,7 @@ export class PlaidBankingController extends BaseController {
router.post('/link-token', this.linkToken.bind(this));
router.post('/exchange-token', this.exchangeToken.bind(this));
router.post('/webhooks', this.webhooks.bind(this));
return router;
}
@@ -50,4 +51,21 @@ export class PlaidBankingController extends BaseController {
});
return res.status(200).send({});
}
public async webhooks(req: Request, res: Response) {
const { tenantId } = req;
const {
webhook_type: webhookType,
webhook_code: webhookCode,
item_id: plaidItemId,
} = req.body;
await this.plaidApp.webhooks(
tenantId,
webhookType,
plaidItemId,
webhookCode
);
return res.status(200).send({ code: 200, message: 'ok' });
}
}