taxtank-core 0.30.24 → 0.30.27

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)
@@ -3143,6 +3147,9 @@ class AllocationRuleCondition extends AllocationRuleCondition$1 {
3143
3147
  return false;
3144
3148
  }
3145
3149
  }
3150
+ __decorate([
3151
+ Transform(({ value }) => value.toString(), { toPlainOnly: true })
3152
+ ], AllocationRuleCondition.prototype, "value", void 0);
3146
3153
 
3147
3154
  let AllocationRuleTransaction$1 = class AllocationRuleTransaction extends TransactionBase {
3148
3155
  };
@@ -4185,6 +4192,9 @@ class BankTransaction extends BankTransaction$1 {
4185
4192
  __decorate([
4186
4193
  Type(() => Date)
4187
4194
  ], BankTransaction.prototype, "date", void 0);
4195
+ __decorate([
4196
+ Type(() => Number)
4197
+ ], BankTransaction.prototype, "amount", void 0);
4188
4198
 
4189
4199
  class TransactionAllocation extends TransactionAllocation$1 {
4190
4200
  /**
@@ -5993,10 +6003,11 @@ class ServicePriceCollection extends Collection {
5993
6003
  get monthlyPackage() {
5994
6004
  return this.filterBy('type', ServicePriceTypeEnum.MONTHLY_PACKAGE);
5995
6005
  }
5996
- get monthlyPackageSum() {
6006
+ getMonthlyPackageSum(propertyQuantity) {
5997
6007
  const property = this.monthlyPackage.findBy('product.id', ServiceProductIdEnum.PROPERTIES);
5998
6008
  // @TODO move to const
5999
- 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);
6000
6011
  }
6001
6012
  get annual() {
6002
6013
  return this.filterBy('type', ServicePriceTypeEnum.YEARLY);
@@ -6004,10 +6015,11 @@ class ServicePriceCollection extends Collection {
6004
6015
  get annualPackage() {
6005
6016
  return this.filterBy('type', ServicePriceTypeEnum.YEARLY_PACKAGE);
6006
6017
  }
6007
- get annualPackageSum() {
6018
+ getAnnualPackageSum(propertyQuantity) {
6008
6019
  const property = this.annualPackage.findBy('product.id', ServiceProductIdEnum.PROPERTIES);
6009
6020
  // @TODO move to const
6010
- 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);
6011
6023
  }
6012
6024
  getProperty(isAnnual, isPackage) {
6013
6025
  let type;
@@ -7013,6 +7025,13 @@ class ServiceSubscription extends ServiceSubscription$1 {
7013
7025
  get isPaid() {
7014
7026
  return !!this.stripeId;
7015
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
+ }
7016
7035
  get price() {
7017
7036
  let price = this.items.reduce((sum, item) => sum + item.total, 0);
7018
7037
  if (!!this.stripePromoCode) {