mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
feat(server): wip syncing Plaid transactions
This commit is contained in:
@@ -15,10 +15,17 @@ export class PlaidBankingController extends BaseController {
|
||||
const router = Router();
|
||||
|
||||
router.post('/link-token', this.linkToken.bind(this));
|
||||
router.post('/exchange-token', this.exchangeToken.bind(this));
|
||||
|
||||
return router;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the Plaid link token.
|
||||
* @param {Request} req
|
||||
* @param {response} res
|
||||
* @returns {Response}
|
||||
*/
|
||||
private async linkToken(req: Request, res: Response) {
|
||||
const { tenantId } = req;
|
||||
|
||||
@@ -26,4 +33,21 @@ export class PlaidBankingController extends BaseController {
|
||||
|
||||
return res.status(200).send(linkToken);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {Request} req
|
||||
* @param {response} res
|
||||
* @returns {Response}
|
||||
*/
|
||||
public async exchangeToken(req: Request, res: Response) {
|
||||
const { tenantId } = req;
|
||||
const { public_token, institution_id } = req.body;
|
||||
|
||||
await this.plaidApp.exchangeToken(tenantId, {
|
||||
institutionId: institution_id,
|
||||
publicToken: public_token,
|
||||
});
|
||||
return res.status(200).send({});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user