mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
feat: add bank balance column to account
This commit is contained in:
@@ -13,7 +13,7 @@ export class AccountTransformer extends Transformer {
|
||||
* @returns {Array}
|
||||
*/
|
||||
public includeAttributes = (): string[] => {
|
||||
return ['formattedAmount', 'flattenName'];
|
||||
return ['formattedAmount', 'flattenName', 'bankBalanceFormatted'];
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -41,6 +41,17 @@ export class AccountTransformer extends Transformer {
|
||||
return formatNumber(account.amount, { currencyCode: account.currencyCode });
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves the formatted bank balance.
|
||||
* @param {IAccount} account
|
||||
* @returns {string}
|
||||
*/
|
||||
protected bankBalanceFormatted = (account: IAccount): string => {
|
||||
return formatNumber(account.bankBalance, {
|
||||
currencyCode: account.currencyCode,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Transformes the accounts collection to flat or nested array.
|
||||
* @param {IAccount[]}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class PlaidApplication {
|
||||
* @param {PlaidItemDTO} itemDTO
|
||||
* @returns
|
||||
*/
|
||||
public exchangeToken(tenantId: number, itemDTO: PlaidItemDTO) {
|
||||
public exchangeToken(tenantId: number, itemDTO: PlaidItemDTO): Promise<void> {
|
||||
return this.plaidItemService.item(tenantId, itemDTO);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import * as R from 'ramda';
|
||||
import { IAccountCreateDTO, ICashflowNewCommandDTO } from '@/interfaces';
|
||||
import { PlaidAccount, PlaidTransaction } from './_types';
|
||||
import {
|
||||
IAccountCreateDTO,
|
||||
ICashflowNewCommandDTO,
|
||||
PlaidAccount,
|
||||
PlaidTransaction,
|
||||
} from '@/interfaces';
|
||||
|
||||
/**
|
||||
* Transformes the Plaid account to create cashflow account DTO.
|
||||
@@ -18,6 +22,8 @@ export const transformPlaidAccountToCreateAccount = (
|
||||
accountType: 'cash',
|
||||
active: true,
|
||||
plaidAccountId: plaidAccount.account_id,
|
||||
bankBalance: plaidAccount.balances.current,
|
||||
accountMask: plaidAccount.mask,
|
||||
};
|
||||
};
|
||||
|
||||
@@ -48,6 +54,7 @@ export const transformPlaidTrxsToCashflowCreate = R.curry(
|
||||
|
||||
// transactionNumber: string;
|
||||
// referenceNo: string;
|
||||
plaidTransactionId: plaidTranasction.transaction_id,
|
||||
publish: true,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ export default class NewCashflowTransactionService {
|
||||
'cashflowAccountId',
|
||||
'creditAccountId',
|
||||
'branchId',
|
||||
'plaidAccountId'
|
||||
'plaidTransactionId',
|
||||
]);
|
||||
// Retreive the next invoice number.
|
||||
const autoNextNumber =
|
||||
@@ -125,7 +125,7 @@ export default class NewCashflowTransactionService {
|
||||
public newCashflowTransaction = async (
|
||||
tenantId: number,
|
||||
newTransactionDTO: ICashflowNewCommandDTO,
|
||||
userId?: number
|
||||
userId?: number
|
||||
): Promise<{ cashflowTransaction: ICashflowTransaction }> => {
|
||||
const { CashflowTransaction, Account } = this.tenancy.models(tenantId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user