ia-common 1.0.1-beta.21 → 1.0.1-beta.23

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.
package/build/@type.d.ts CHANGED
@@ -7,3 +7,4 @@ export * from "./interface/modify-entity.interface";
7
7
  export * from "./interface/modify.interface";
8
8
  export * from "./interface/update-user-info.interface";
9
9
  export * from "./interface/user-entity-without-password.interface";
10
+ export * from "./interface/pricing-plan-model.interface";
package/build/@type.js CHANGED
@@ -23,3 +23,4 @@ __exportStar(require("./interface/modify-entity.interface"), exports);
23
23
  __exportStar(require("./interface/modify.interface"), exports);
24
24
  __exportStar(require("./interface/update-user-info.interface"), exports);
25
25
  __exportStar(require("./interface/user-entity-without-password.interface"), exports);
26
+ __exportStar(require("./interface/pricing-plan-model.interface"), exports);
package/build/@utils.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./utils/string-to-date-conversion-methods";
2
2
  export * from "./utils/string-utils";
3
+ export * from "./utils/date-util";
package/build/@utils.js CHANGED
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./utils/string-to-date-conversion-methods"), exports);
18
18
  __exportStar(require("./utils/string-utils"), exports);
19
+ __exportStar(require("./utils/date-util"), exports);
@@ -0,0 +1,14 @@
1
+ export interface IPricingPlanModel {
2
+ id: number;
3
+ effectiveFromDate: number;
4
+ effectiveToDate: number;
5
+ basePrice: number;
6
+ billingCycle: {
7
+ [key: string]: {
8
+ noOfMonths: number;
9
+ discount: string;
10
+ name: string;
11
+ key: string;
12
+ };
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
1
  import { PricingPlanStatus } from "../@enum";
2
2
  import { IGetPricingPlanByDateResponse, IPricingPlanEntity } from "../@type";
3
- export declare class PricingPlanEntityModel {
3
+ export declare class PricingPlanEntityModel implements IPricingPlanEntity {
4
4
  id: number;
5
5
  effectiveFrom: number;
6
6
  effectiveTo: number;
@@ -25,41 +25,3 @@ export declare class BillingCycleModel {
25
25
  getDiscount(): number;
26
26
  getKey(): string;
27
27
  }
28
- export interface IPricingPlanModel {
29
- id: number;
30
- effectiveFromDate: number;
31
- effectiveToDate: number;
32
- basePrice: number;
33
- billingCycle: {
34
- [key: string]: {
35
- noOfMonths: number;
36
- discount: string;
37
- name: string;
38
- key: string;
39
- };
40
- };
41
- }
42
- export declare class PricingPlanModel implements IPricingPlanModel {
43
- id: number;
44
- effectiveFromDate: number;
45
- effectiveToDate: number;
46
- basePrice: number;
47
- billingCycle: {
48
- [key: string]: {
49
- noOfMonths: number;
50
- discount: string;
51
- name: string;
52
- key: string;
53
- };
54
- };
55
- constructor(data: IGetPricingPlanByDateResponse);
56
- getBillingCycleKeys(): string[];
57
- getNoOfSubscriptionDays(type: string): number;
58
- getBillCycleByKey(type: string): {
59
- noOfMonths: number;
60
- discount: string;
61
- name: string;
62
- key: string;
63
- };
64
- validateBillingCycleKey(key: string): void;
65
- }
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PricingPlanModel = exports.BillingCycleModel = exports.PricingPlanEntityModel = void 0;
4
- var app_badrequest_exception_1 = require("../exception/app-badrequest.exception");
3
+ exports.BillingCycleModel = exports.PricingPlanEntityModel = void 0;
5
4
  var PricingPlanEntityModel = /** @class */ (function () {
6
5
  function PricingPlanEntityModel(data) {
7
6
  Object.assign(this, data);
@@ -57,30 +56,63 @@ var BillingCycleModel = /** @class */ (function () {
57
56
  return BillingCycleModel;
58
57
  }());
59
58
  exports.BillingCycleModel = BillingCycleModel;
60
- var PricingPlanModel = /** @class */ (function () {
61
- function PricingPlanModel(data) {
62
- Object.assign(this, data);
63
- }
64
- PricingPlanModel.prototype.getBillingCycleKeys = function () {
65
- return Object.values(this.billingCycle).map(function (billingCycleObj) { return billingCycleObj.key; });
66
- };
67
- PricingPlanModel.prototype.getNoOfSubscriptionDays = function (type) {
68
- var billingCycleModel = this.getBillCycleByKey(type);
69
- return billingCycleModel.noOfMonths * 30 - 1;
70
- };
71
- PricingPlanModel.prototype.getBillCycleByKey = function (type) {
72
- return Object.values(this.billingCycle).filter(function (billingCycleObj) { return billingCycleObj.key === type; })[0];
73
- };
74
- PricingPlanModel.prototype.validateBillingCycleKey = function (key) {
75
- if (!this.getBillingCycleKeys().includes(key)) {
76
- throw new app_badrequest_exception_1.AppBadRequestException({
77
- key: "type",
78
- message: [
79
- "subscription with type:'".concat(key, "' is wrong,type should be one of the ").concat(this.getBillingCycleKeys()),
80
- ],
81
- });
82
- }
83
- };
84
- return PricingPlanModel;
85
- }());
86
- exports.PricingPlanModel = PricingPlanModel;
59
+ // export interface IPricingPlanModel {
60
+ // id: number;
61
+ // effectiveFromDate: number;
62
+ // effectiveToDate: number;
63
+ // basePrice: number;
64
+ // billingCycle: {
65
+ // [key: string]: {
66
+ // noOfMonths: number;
67
+ // discount: string;
68
+ // name: string;
69
+ // key: string;
70
+ // };
71
+ // };
72
+ // }
73
+ // export class PricingPlanModel implements IPricingPlanModel {
74
+ // id: number;
75
+ // effectiveFromDate: number;
76
+ // effectiveToDate: number;
77
+ // basePrice: number;
78
+ // billingCycle: {
79
+ // [key: string]: {
80
+ // noOfMonths: number;
81
+ // discount: string;
82
+ // name: string;
83
+ // key: string;
84
+ // };
85
+ // };
86
+ // constructor(data: IGetPricingPlanByDateResponse) {
87
+ // Object.assign(this, data);
88
+ // }
89
+ // getBillingCycleKeys(): string[] {
90
+ // return Object.values(this.billingCycle).map(
91
+ // (billingCycleObj) => billingCycleObj.key
92
+ // );
93
+ // }
94
+ // getNoOfSubscriptionDays(type: string): number {
95
+ // const billingCycleModel = this.getBillCycleByKey(type);
96
+ // return billingCycleModel!.noOfMonths * 30 - 1;
97
+ // }
98
+ // getBillCycleByKey(type: string): {
99
+ // noOfMonths: number;
100
+ // discount: string;
101
+ // name: string;
102
+ // key: string;
103
+ // } {
104
+ // return Object.values(this.billingCycle).filter(
105
+ // (billingCycleObj) => billingCycleObj.key === type
106
+ // )[0];
107
+ // }
108
+ // validateBillingCycleKey(key: string): void {
109
+ // if (!this.getBillingCycleKeys().includes(key)) {
110
+ // throw new AppBadRequestException({
111
+ // key: "type",
112
+ // message: [
113
+ // `subscription with type:'${key}' is wrong,type should be one of the ${this.getBillingCycleKeys()}`,
114
+ // ],
115
+ // });
116
+ // }
117
+ // }
118
+ // }
@@ -0,0 +1,25 @@
1
+ import { IGetPricingPlanByDateResponse, IPricingPlanModel } from "../@type";
2
+ export declare class PricingPlanModel implements IPricingPlanModel {
3
+ id: number;
4
+ effectiveFromDate: number;
5
+ effectiveToDate: number;
6
+ basePrice: number;
7
+ billingCycle: {
8
+ [key: string]: {
9
+ noOfMonths: number;
10
+ discount: string;
11
+ name: string;
12
+ key: string;
13
+ };
14
+ };
15
+ constructor(data: IGetPricingPlanByDateResponse);
16
+ getBillingCycleKeys(): string[];
17
+ getNoOfSubscriptionDays(type: string): number;
18
+ getBillCycleByKey(type: string): {
19
+ noOfMonths: number;
20
+ discount: string;
21
+ name: string;
22
+ key: string;
23
+ };
24
+ validateBillingCycleKey(key: string): void;
25
+ }
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PricingPlanModel = void 0;
4
+ var _model_1 = require("../@model");
5
+ var PricingPlanModel = /** @class */ (function () {
6
+ function PricingPlanModel(data) {
7
+ Object.assign(this, data);
8
+ }
9
+ PricingPlanModel.prototype.getBillingCycleKeys = function () {
10
+ return Object.values(this.billingCycle).map(function (billingCycleObj) { return billingCycleObj.key; });
11
+ };
12
+ PricingPlanModel.prototype.getNoOfSubscriptionDays = function (type) {
13
+ var billingCycleModel = this.getBillCycleByKey(type);
14
+ return billingCycleModel.noOfMonths * 30 - 1;
15
+ };
16
+ PricingPlanModel.prototype.getBillCycleByKey = function (type) {
17
+ return Object.values(this.billingCycle).filter(function (billingCycleObj) { return billingCycleObj.key === type; })[0];
18
+ };
19
+ PricingPlanModel.prototype.validateBillingCycleKey = function (key) {
20
+ if (!this.getBillingCycleKeys().includes(key)) {
21
+ throw new _model_1.AppBadRequestException({
22
+ key: "type",
23
+ message: [
24
+ "subscription with type:'".concat(key, "' is wrong,type should be one of the ").concat(this.getBillingCycleKeys()),
25
+ ],
26
+ });
27
+ }
28
+ };
29
+ return PricingPlanModel;
30
+ }());
31
+ exports.PricingPlanModel = PricingPlanModel;
@@ -1,4 +1,4 @@
1
- import { PricingPlanModel } from "./pricing-plan-entity-model";
1
+ import { PricingPlanModel } from "./pricing-plan-model";
2
2
  export declare class SubscribedPricingPlanModel extends PricingPlanModel {
3
3
  billingCycleKey: string;
4
4
  selectedBillingCycle: {
@@ -16,7 +16,7 @@ var __extends = (this && this.__extends) || (function () {
16
16
  })();
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.SubscribedPricingPlanModel = void 0;
19
- var pricing_plan_entity_model_1 = require("./pricing-plan-entity-model");
19
+ var pricing_plan_model_1 = require("./pricing-plan-model");
20
20
  var SubscribedPricingPlanModel = /** @class */ (function (_super) {
21
21
  __extends(SubscribedPricingPlanModel, _super);
22
22
  function SubscribedPricingPlanModel(data, billingCycleKey) {
@@ -59,5 +59,5 @@ var SubscribedPricingPlanModel = /** @class */ (function (_super) {
59
59
  return 0;
60
60
  };
61
61
  return SubscribedPricingPlanModel;
62
- }(pricing_plan_entity_model_1.PricingPlanModel));
62
+ }(pricing_plan_model_1.PricingPlanModel));
63
63
  exports.SubscribedPricingPlanModel = SubscribedPricingPlanModel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ia-common",
3
- "version": "1.0.1-beta.21",
3
+ "version": "1.0.1-beta.23",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",