turf-common 1.4.1-beta.6 → 1.4.1-beta.8

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.
@@ -99,6 +99,7 @@ var PricingPlanModelV2 = /** @class */ (function () {
99
99
  this.unit = data.unit;
100
100
  this.pitch_slab = {};
101
101
  this.billing_cycle = {};
102
+ this.billing_cost_code = data.billing_cost_code;
102
103
  Object.keys(data.pitch_slab).forEach(function (key) {
103
104
  _this.pitch_slab[key] = new pitch_slab_model_1.PitchSlabModelV2(data.pitch_slab[key]);
104
105
  });
@@ -167,8 +167,19 @@ var SubscribedPricingPlanModelV2 = /** @class */ (function (_super) {
167
167
  // return codes ? codes[0] : "";
168
168
  };
169
169
  SubscribedPricingPlanModelV2.prototype.getDiscount = function () {
170
- var codes = this.getCodeByPitchCountCycle();
171
- return codes === null || codes === void 0 ? void 0 : codes.split("#")[3];
170
+ var _this = this;
171
+ var codes = this.billing_cost_code.split(",");
172
+ // Filter by pitch count
173
+ codes = codes.filter(function (code) {
174
+ var _a = code.split("_"), from = _a[0], to = _a[1];
175
+ return _this.pitchCount >= parseInt(from) && _this.pitchCount <= parseInt(to);
176
+ });
177
+ codes.sort();
178
+ // Filter by billing cycle
179
+ codes = codes.filter(function (code) {
180
+ return _this.selectedBillingCycle.to === Number(code.split("#")[1]);
181
+ });
182
+ return codes ? codes[0].split("#")[3] : "";
172
183
  };
173
184
  SubscribedPricingPlanModelV2.prototype.getBasePriceByPitchSlab = function () {
174
185
  var _this = this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turf-common",
3
- "version": "1.4.1-beta.6",
3
+ "version": "1.4.1-beta.8",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",