taxtank-core 0.31.13 → 0.31.15

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.
@@ -6548,9 +6548,14 @@ class TransactionCollection extends ExportableCollection {
6548
6548
  getByAllocations(allocations) {
6549
6549
  return new TransactionCollection(this.items.filter((transaction) => allocations.hasTransaction(transaction)));
6550
6550
  }
6551
- setAllocatedClaimAmount(allocations) {
6551
+ setAllocatedClaimAmount(allocations, invoices) {
6552
6552
  const allocationsByTransaction = allocations.groupBy('transaction.id');
6553
+ const paidCacheTransactionsIds = invoices.getPaidCash().getTransactionsIds();
6553
6554
  this.items.forEach((transaction) => {
6555
+ // for paidCash invoices we haven't allocations and should use just claim amount
6556
+ if (paidCacheTransactionsIds.includes(transaction.id)) {
6557
+ return;
6558
+ }
6554
6559
  transaction.claimAmount = transaction.getAllocatedClaimAmount(allocationsByTransaction.get(transaction.id));
6555
6560
  });
6556
6561
  return this;
@@ -7936,6 +7941,9 @@ class SoleInvoiceCollection extends Collection {
7936
7941
  getPaid() {
7937
7942
  return this.filter((invoice) => invoice.isPaid());
7938
7943
  }
7944
+ getPaidCash() {
7945
+ return this.filter((invoice) => invoice.isPaidCash());
7946
+ }
7939
7947
  getPending() {
7940
7948
  return this.filter((invoice) => invoice.isPending());
7941
7949
  }
@@ -8392,7 +8400,7 @@ class BankAccountCollection extends Collection {
8392
8400
  return new BankAccountCollection(this.getByType(TYPE_LOAN));
8393
8401
  }
8394
8402
  get loans() {
8395
- return new LoanCollection(this.getLoanAccounts().map((bankAccount) => bankAccount.loan));
8403
+ return new LoanCollection(this.filterBy('type', BankAccountTypeEnum.LOAN).map((bankAccount) => bankAccount.loan));
8396
8404
  }
8397
8405
  getSavingsAccounts() {
8398
8406
  return new BankAccountCollection(this.getByType(TYPE_LOAN, true));
@@ -9245,7 +9253,7 @@ class BankAccount extends BankAccount$1 {
9245
9253
  return this.currentBalance * this.getPropertyPercentage(propertyId);
9246
9254
  }
9247
9255
  getMonthlyRepaymentAmount(propertyId) {
9248
- return this.loan.monthlyRepaymentAmount * this.getPropertyPercentage(propertyId);
9256
+ return this.loan ? this.loan.monthlyRepaymentAmount * this.getPropertyPercentage(propertyId) : 0;
9249
9257
  }
9250
9258
  /**
9251
9259
  * Check if bank account is active (has 'active' status or hasn't been paid out/refinanced)
@@ -9443,6 +9451,9 @@ var BankTransactionSummaryFieldsEnum;
9443
9451
  BankTransactionSummaryFieldsEnum["ALLOCATED_AMOUNT"] = "allocatedAmount";
9444
9452
  })(BankTransactionSummaryFieldsEnum || (BankTransactionSummaryFieldsEnum = {}));
9445
9453
 
9454
+ /**
9455
+ * @TODO credit card has nothing to do with loan
9456
+ */
9446
9457
  const TYPE_LOAN = [
9447
9458
  BankAccountTypeEnum.CREDIT_CARD,
9448
9459
  BankAccountTypeEnum.LOAN
@@ -11153,6 +11164,12 @@ class ChatService extends RestService$1 {
11153
11164
  this.listenChats();
11154
11165
  this.listenMessages();
11155
11166
  }
11167
+ /**
11168
+ * We don't need chats with taxtank employees
11169
+ */
11170
+ setCache(data, next = false) {
11171
+ super.setCache(data.filter((data) => data.employee.email !== this.environment.ttAccountant && data.employee.email !== this.environment.ttAdvisor), next);
11172
+ }
11156
11173
  /**
11157
11174
  * Listen chats events
11158
11175
  */