taxtank-core 0.28.7 → 0.28.8-1

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.
@@ -2623,6 +2623,25 @@
2623
2623
  ServiceSubscription.prototype.isPastDue = function () {
2624
2624
  return this.status === exports.ServiceSubscriptionStatusEnum.PAST_DUE;
2625
2625
  };
2626
+ /**
2627
+ * Check if current subscription has provided subscription item
2628
+ */
2629
+ ServiceSubscription.prototype.hasItem = function (itemToCheck) {
2630
+ return !!this.items.find(function (item) { return item.price.id === itemToCheck.price.id; });
2631
+ };
2632
+ /**
2633
+ * Recommended number of properties to buy,
2634
+ * based on the property service product and the number of properties the user has
2635
+ */
2636
+ ServiceSubscription.prototype.getRecommendedPropertiesQty = function (propertyItem, propertiesQty) {
2637
+ var max = propertyItem.price.product.maxQty;
2638
+ var min = propertyItem.price.product.minQty;
2639
+ // if user has property subscription and number of properties doesn't exceed the maximum in the service product - return one more
2640
+ if (this.hasItem(propertyItem)) {
2641
+ propertiesQty = propertiesQty < max ? propertiesQty + 1 : max;
2642
+ }
2643
+ return Math.max(min, propertiesQty);
2644
+ };
2626
2645
  return ServiceSubscription;
2627
2646
  }(ServiceSubscription$1));
2628
2647
  __decorate([
@@ -9897,7 +9916,8 @@
9897
9916
  }());
9898
9917
 
9899
9918
  /**
9900
- * Enum with maximum number of payments, depending on the frequency
9919
+ * Enum with maximum number of payments, depending on the frequency.
9920
+ * Used only for vehicle loans
9901
9921
  */
9902
9922
  exports.LoanMaxNumberOfPaymentsEnum = void 0;
9903
9923
  (function (LoanMaxNumberOfPaymentsEnum) {
@@ -16927,6 +16947,10 @@
16927
16947
  * For vehicle loans term has a maximum value depended of repayment frequency
16928
16948
  */
16929
16949
  LoanForm.prototype.updateTermValidation = function () {
16950
+ // no need terms for bank loans
16951
+ if (!!this.loan.bankAccount) {
16952
+ return;
16953
+ }
16930
16954
  var currentRepaymentFrequency = this.get('repaymentFrequency').value;
16931
16955
  // term validation depends on selected repayment frequency, so can not validate when frequency is empty
16932
16956
  // repaymentType is required field, so we don't need to clear validation
@@ -17469,7 +17493,7 @@
17469
17493
  if (bankAccount.isLoan()) {
17470
17494
  // Attach bank account to loan for LoanForm's logic
17471
17495
  // @TODO Alex/Vik: we should use separated API for bank accounts and loans
17472
- var loan = classTransformer.plainToClass(Loan, Object.assign(bankAccount.loan, { bankAccount: Object.assign(bankAccount, { loan: null }) }));
17496
+ var loan = classTransformer.plainToClass(Loan, Object.assign(bankAccount.loan, { bankAccount: { accountId: bankAccount.accountId } }));
17473
17497
  _this.addControl('loan', new LoanForm(loan));
17474
17498
  }
17475
17499
  // basiq account import form should be disabled (unchecked) by default