taxtank-core 0.28.8 → 0.28.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6838,7 +6838,7 @@
6838
6838
  /**
6839
6839
  * Get collection of unallocated bankTransactions
6840
6840
  */
6841
- BankTransactionCollection.prototype.getUnallocatedBankTransactions = function (allocations) {
6841
+ BankTransactionCollection.prototype.getUnallocated = function (allocations) {
6842
6842
  return new BankTransactionCollection(this.items.filter(function (bankTransaction) { return !bankTransaction.isAllocated(allocations); }));
6843
6843
  };
6844
6844
  return BankTransactionCollection;
@@ -13472,7 +13472,7 @@
13472
13472
  * Get collection of unallocated bank transactions
13473
13473
  * @TODO Alex: consider to move to collection
13474
13474
  */
13475
- BankTransactionCalculationService.prototype.getUnallocatedBankTransactions = function (bankTransactions, allocations) {
13475
+ BankTransactionCalculationService.prototype.getUnallocated = function (bankTransactions, allocations) {
13476
13476
  var _this = this;
13477
13477
  return new BankTransactionCollection(bankTransactions.items.filter(function (bankTransaction) {
13478
13478
  return !_this.isAllocated(bankTransaction, allocations);
@@ -13509,8 +13509,12 @@
13509
13509
  * Sum of bank accounts opening balances and their bank transactions allocated amounts
13510
13510
  */
13511
13511
  BankAccountCalculationService.prototype.getTaxTankBalance = function (bankAccounts, bankTransactions, allocations) {
13512
- return bankAccounts.getOpeningBalance() +
13513
- this.bankTransactionCalculationService.getAllocatedAmount(bankTransactions.getByBankAccountsIds(bankAccounts.getIds()), allocations);
13512
+ // wrap in a collection if a single bank account was provided
13513
+ var bankAccountCollection = bankAccounts instanceof BankAccount ?
13514
+ new BankAccountCollection([bankAccounts]) :
13515
+ bankAccounts;
13516
+ return bankAccountCollection.getOpeningBalance() +
13517
+ this.bankTransactionCalculationService.getAllocatedAmount(bankTransactions.getByBankAccountsIds(bankAccountCollection.getIds()), allocations);
13514
13518
  };
13515
13519
  /**
13516
13520
  * get difference between total loans amount and total cash amount