taxtank-core 0.30.25 → 0.30.28

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.
@@ -1492,6 +1492,10 @@ class ServicePrice extends ServicePrice$1 {
1492
1492
  isAnnual() {
1493
1493
  return [ServicePriceTypeEnum.YEARLY, ServicePriceTypeEnum.YEARLY_PACKAGE].includes(this.type);
1494
1494
  }
1495
+ discountPrice(stripePromoCode) {
1496
+ const discountAmount = this.amount - this.amount * (stripePromoCode.percentOff / 100);
1497
+ return discountAmount;
1498
+ }
1495
1499
  }
1496
1500
  __decorate([
1497
1501
  Type(() => ServiceProduct)
@@ -5999,10 +6003,11 @@ class ServicePriceCollection extends Collection {
5999
6003
  get monthlyPackage() {
6000
6004
  return this.filterBy('type', ServicePriceTypeEnum.MONTHLY_PACKAGE);
6001
6005
  }
6002
- get monthlyPackageSum() {
6006
+ getMonthlyPackageSum(propertyQuantity) {
6003
6007
  const property = this.monthlyPackage.findBy('product.id', ServiceProductIdEnum.PROPERTIES);
6004
6008
  // @TODO move to const
6005
- return this.monthlyPackage.sumBy('amount') + property.amount * 4;
6009
+ // default number of properties should be 5
6010
+ return this.monthlyPackage.sumBy('amount') + property.amount * (propertyQuantity - 1);
6006
6011
  }
6007
6012
  get annual() {
6008
6013
  return this.filterBy('type', ServicePriceTypeEnum.YEARLY);
@@ -6010,10 +6015,11 @@ class ServicePriceCollection extends Collection {
6010
6015
  get annualPackage() {
6011
6016
  return this.filterBy('type', ServicePriceTypeEnum.YEARLY_PACKAGE);
6012
6017
  }
6013
- get annualPackageSum() {
6018
+ getAnnualPackageSum(propertyQuantity) {
6014
6019
  const property = this.annualPackage.findBy('product.id', ServiceProductIdEnum.PROPERTIES);
6015
6020
  // @TODO move to const
6016
- return this.annualPackage.sumBy('amount') + property.amount * 4;
6021
+ // the default number of properties should be 5.
6022
+ return this.annualPackage.sumBy('amount') + property.amount * (propertyQuantity - 1);
6017
6023
  }
6018
6024
  getProperty(isAnnual, isPackage) {
6019
6025
  let type;
@@ -7019,6 +7025,13 @@ class ServiceSubscription extends ServiceSubscription$1 {
7019
7025
  get isPaid() {
7020
7026
  return !!this.stripeId;
7021
7027
  }
7028
+ get initialPrice() {
7029
+ let price = this.items.reduce((sum, item) => sum + item.total, 0);
7030
+ return price;
7031
+ }
7032
+ get discountAmount() {
7033
+ return this.initialPrice - this.price;
7034
+ }
7022
7035
  get price() {
7023
7036
  let price = this.items.reduce((sum, item) => sum + item.total, 0);
7024
7037
  if (!!this.stripePromoCode) {
@@ -19184,6 +19197,7 @@ class AllocationRuleTransactionForm extends AbstractForm {
19184
19197
  */
19185
19198
  listenTankTypeChanges() {
19186
19199
  this.get('tankType').valueChanges.subscribe(() => {
19200
+ this.get('chartAccounts').reset();
19187
19201
  this.childTransactionsArray.reset();
19188
19202
  });
19189
19203
  }