mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-13 19:30:30 +00:00
feat: match bank transaction
This commit is contained in:
@@ -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.',
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ExcludeBankTransactionsApplication } from '@/services/Banking/Exclude/E
|
||||
@Service()
|
||||
export class ExcludeBankTransactionsController extends BaseController {
|
||||
@Inject()
|
||||
prviate excludeBankTransactionApp: ExcludeBankTransactionsApplication;
|
||||
private excludeBankTransactionApp: ExcludeBankTransactionsApplication;
|
||||
|
||||
/**
|
||||
* Router constructor.
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import { body } from 'express-validator';
|
||||
import BaseController from '../BaseController';
|
||||
import { Router } from 'express';
|
||||
import { Service } from 'typedi';
|
||||
|
||||
@Service()
|
||||
export class BankReconcileController extends BaseController {
|
||||
/**
|
||||
* Router constructor.
|
||||
*/
|
||||
public router() {
|
||||
const router = Router();
|
||||
|
||||
router.post(
|
||||
'/',
|
||||
[
|
||||
body('amount').exists(),
|
||||
body('date').exists(),
|
||||
body('fromAccountId').exists(),
|
||||
body('toAccountId').exists(),
|
||||
body('reference').optional({ nullable: true }),
|
||||
],
|
||||
this.validationResult,
|
||||
this.createBankReconcileTransaction.bind(this)
|
||||
);
|
||||
return router;
|
||||
}
|
||||
|
||||
createBankReconcileTransaction() {}
|
||||
}
|
||||
Reference in New Issue
Block a user