taxtank-core 0.13.3 → 0.13.6

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.
@@ -1354,7 +1354,8 @@
1354
1354
  return this.items.find(function (item) { return get__default["default"](item, path) === value; });
1355
1355
  };
1356
1356
  Collection.prototype.findIndexBy = function (path, value) {
1357
- return this.items.findIndex(function (item) { return get__default["default"](item, path) === value; });
1357
+ var _a;
1358
+ return (_a = this.items.findIndex(function (item) { return get__default["default"](item, path) === value; })) !== null && _a !== void 0 ? _a : null;
1358
1359
  };
1359
1360
  /**
1360
1361
  * Get total sum of items by field
@@ -3263,7 +3264,7 @@
3263
3264
  ServiceProductStatusEnum[ServiceProductStatusEnum["ACTIVE"] = 1] = "ACTIVE";
3264
3265
  })(exports.ServiceProductStatusEnum || (exports.ServiceProductStatusEnum = {}));
3265
3266
 
3266
- var ServiceProductIdEnum;
3267
+ exports.ServiceProductIdEnum = void 0;
3267
3268
  (function (ServiceProductIdEnum) {
3268
3269
  ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK_OLD"] = 1] = "WORK_TANK_OLD";
3269
3270
  ServiceProductIdEnum[ServiceProductIdEnum["PROPERTY_OLD"] = 2] = "PROPERTY_OLD";
@@ -3271,7 +3272,7 @@
3271
3272
  ServiceProductIdEnum[ServiceProductIdEnum["WORK_TANK"] = 4] = "WORK_TANK";
3272
3273
  ServiceProductIdEnum[ServiceProductIdEnum["PROPERTIES"] = 5] = "PROPERTIES";
3273
3274
  ServiceProductIdEnum[ServiceProductIdEnum["SOLE_TANK"] = 6] = "SOLE_TANK";
3274
- })(ServiceProductIdEnum || (ServiceProductIdEnum = {}));
3275
+ })(exports.ServiceProductIdEnum || (exports.ServiceProductIdEnum = {}));
3275
3276
 
3276
3277
  var ServiceProduct = /** @class */ (function (_super) {
3277
3278
  __extends(ServiceProduct, _super);
@@ -3279,13 +3280,13 @@
3279
3280
  return _super !== null && _super.apply(this, arguments) || this;
3280
3281
  }
3281
3282
  ServiceProduct.prototype.isProperties = function () {
3282
- return [ServiceProductIdEnum.PROPERTY_OLD, ServiceProductIdEnum.PROPERTIES].includes(this.id);
3283
+ return [exports.ServiceProductIdEnum.PROPERTY_OLD, exports.ServiceProductIdEnum.PROPERTIES].includes(this.id);
3283
3284
  };
3284
3285
  ServiceProduct.prototype.isWorkTank = function () {
3285
- return [ServiceProductIdEnum.WORK_TANK_OLD, ServiceProductIdEnum.WORK_TANK].includes(this.id);
3286
+ return [exports.ServiceProductIdEnum.WORK_TANK_OLD, exports.ServiceProductIdEnum.WORK_TANK].includes(this.id);
3286
3287
  };
3287
3288
  ServiceProduct.prototype.isSoleTank = function () {
3288
- return this.id === ServiceProductIdEnum.SOLE_TANK;
3289
+ return this.id === exports.ServiceProductIdEnum.SOLE_TANK;
3289
3290
  };
3290
3291
  ServiceProduct.prototype.isArchived = function () {
3291
3292
  return this.status === exports.ServiceProductStatusEnum.ARCHIVED;
@@ -3298,17 +3299,15 @@
3298
3299
  function ServicePrice() {
3299
3300
  return _super !== null && _super.apply(this, arguments) || this;
3300
3301
  }
3302
+ ServicePrice.prototype.toSubscriptionItem = function () {
3303
+ return classTransformer.plainToClass(ServiceSubscriptionItem, { price: this, quantity: this.product.minQty });
3304
+ };
3301
3305
  return ServicePrice;
3302
3306
  }(ServicePrice$1));
3303
3307
  __decorate([
3304
3308
  classTransformer.Type(function () { return ServiceProduct; })
3305
3309
  ], ServicePrice.prototype, "product", void 0);
3306
3310
 
3307
- var ServicePriceListEnum;
3308
- (function (ServicePriceListEnum) {
3309
- ServicePriceListEnum[ServicePriceListEnum["PROPERTIES"] = 5] = "PROPERTIES";
3310
- })(ServicePriceListEnum || (ServicePriceListEnum = {}));
3311
-
3312
3311
  /**
3313
3312
  * backend bd doesn't support dynamic prices, as far as we have just one product like that we keep it hardcoded
3314
3313
  */
@@ -3321,7 +3320,7 @@
3321
3320
  Object.defineProperty(ServiceSubscriptionItem.prototype, "total", {
3322
3321
  get: function () {
3323
3322
  var price = this.price.amount * this.quantity;
3324
- if (this.price.id === ServicePriceListEnum.PROPERTIES) {
3323
+ if (this.price.product.id === exports.ServiceProductIdEnum.PROPERTIES) {
3325
3324
  price += PROPERTY_TANK_PRICE;
3326
3325
  }
3327
3326
  return price;
@@ -3487,7 +3486,7 @@
3487
3486
  return this.daysRemain > 0 && this.daysRemain <= this.lastTrialDays;
3488
3487
  };
3489
3488
  ServiceSubscription.prototype.isRenewable = function () {
3490
- return !this.isTrial && !this.isArchived() && this.isActive;
3489
+ return !this.isTrial && this.isActive;
3491
3490
  };
3492
3491
  Object.defineProperty(ServiceSubscription.prototype, "workTankItem", {
3493
3492
  /**
@@ -3529,7 +3528,7 @@
3529
3528
  */
3530
3529
  ServiceSubscription.prototype.isArchived = function () {
3531
3530
  // subscription with at least one archived product considered as archived
3532
- return !!this.items.map(function (item) { return item.price.product.isArchived(); }).length;
3531
+ return !!this.items.filter(function (item) { return item.price.product.isArchived(); }).length;
3533
3532
  };
3534
3533
  return ServiceSubscription;
3535
3534
  }(ServiceSubscription$1));
@@ -3951,7 +3950,8 @@
3951
3950
  exports.PropertyCategoryListEnum = void 0;
3952
3951
  (function (PropertyCategoryListEnum) {
3953
3952
  PropertyCategoryListEnum[PropertyCategoryListEnum["OWNER_OCCUPIED"] = 3] = "OWNER_OCCUPIED";
3954
- PropertyCategoryListEnum[PropertyCategoryListEnum["VACANT_LAND"] = 5] = "VACANT_LAND";
3953
+ // @TODO prod use 5
3954
+ PropertyCategoryListEnum[PropertyCategoryListEnum["VACANT_LAND"] = 6] = "VACANT_LAND";
3955
3955
  })(exports.PropertyCategoryListEnum || (exports.PropertyCategoryListEnum = {}));
3956
3956
 
3957
3957
  exports.TaxExemptionMetadataEnum = void 0;
@@ -4154,7 +4154,7 @@
4154
4154
  if (marketValue) {
4155
4155
  return marketValue;
4156
4156
  }
4157
- return this.purchasePrice + this.capitalCostsTotalAmount + sale.structuralImprovementsWDV - sale.buildingAtCostClaimed;
4157
+ return this.purchasePrice + this.capitalCostsTotalAmount + sale.holdingCosts + sale.structuralImprovementsWDV - sale.buildingAtCostClaimed;
4158
4158
  };
4159
4159
  /**
4160
4160
  * gross capital gain tax: sale costs - cost base