feat: match bank transaction

This commit is contained in:
Ahmed Bouhuolia
2024-06-20 23:31:46 +02:00
parent b37002bea6
commit 738a84bb4b
20 changed files with 492 additions and 55 deletions

View File

@@ -2,7 +2,7 @@ import { Inject, Service } from 'typedi';
import { NextFunction, Request, Response, Router } from 'express';
import BaseController from '@/api/controllers/BaseController';
import { MatchBankTransactionsApplication } from '@/services/Banking/Matching/MatchBankTransactionsApplication';
import { param } from 'express-validator';
import { body, param } from 'express-validator';
import {
GetMatchedTransactionsFilter,
IMatchTransactionDTO,
@@ -21,7 +21,14 @@ export class BankTransactionsMatchingController extends BaseController {
router.post(
'/:transactionId',
[param('transactionId').exists()],
[
param('transactionId').exists(),
body('matchedTransactions').isArray({ min: 1 }),
body('matchedTransactions.*.reference_type').exists(),
body('matchedTransactions.*.reference_id').isNumeric().toInt(),
body('matchedTransactions.*.amount').exists().isNumeric().toFloat(),
],
this.validationResult,
this.matchBankTransaction.bind(this)
);
@@ -60,7 +67,6 @@ export class BankTransactionsMatchingController extends BaseController {
transactionId,
matchTransactionDTO
);
return res.status(200).send({
message: 'The bank transaction has been matched.',
});