turf-common 1.0.16-beta.13 → 1.0.16-beta.15
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/enums/pricing-plan-status.enum.d.ts +4 -0
- package/build/enums/pricing-plan-status.enum.js +8 -0
- package/build/interface/billing-cycle.interface.d.ts +7 -0
- package/build/interface/billing-cycle.interface.js +2 -0
- package/build/interface/get-pricing-plan-by-date-response.interface.d.ts +23 -0
- package/build/interface/get-pricing-plan-by-date-response.interface.js +2 -0
- package/build/interface/pitch-slab.interface.d.ts +5 -0
- package/build/interface/pitch-slab.interface.js +2 -0
- package/build/interface/pricing-plan-model.interface.d.ts +15 -0
- package/build/interface/pricing-plan-model.interface.js +2 -0
- package/build/interface/subscription-status.interface.d.ts +20 -0
- package/build/interface/subscription-status.interface.js +24 -0
- package/build/types/entity/pricing-plan-entity.d.ts +28 -0
- package/build/types/entity/pricing-plan-entity.js +2 -0
- package/build/types/entity/subscription-entity.type.d.ts +49 -0
- package/build/types/entity/subscription-entity.type.js +51 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PricingPlanStatus = void 0;
|
|
4
|
+
var PricingPlanStatus;
|
|
5
|
+
(function (PricingPlanStatus) {
|
|
6
|
+
PricingPlanStatus["ACTIVE"] = "active";
|
|
7
|
+
PricingPlanStatus["DEACTIVE"] = "deactive";
|
|
8
|
+
})(PricingPlanStatus || (exports.PricingPlanStatus = PricingPlanStatus = {}));
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface GetPricingPlanByDateResponse {
|
|
2
|
+
id: number;
|
|
3
|
+
effective_from_date: number;
|
|
4
|
+
effective_to_date: number;
|
|
5
|
+
base_price: number;
|
|
6
|
+
unit: string;
|
|
7
|
+
pitch_slab: {
|
|
8
|
+
[key: string]: {
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
discount: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
billing_cycle: {
|
|
15
|
+
[key: string]: {
|
|
16
|
+
from: number;
|
|
17
|
+
to: number;
|
|
18
|
+
discount: string;
|
|
19
|
+
name: string;
|
|
20
|
+
key: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IBillingCycle } from "./billing-cycle.interface";
|
|
2
|
+
import { IPitchSlab } from "./pitch-slab.interface";
|
|
3
|
+
export interface IPringPlanModel {
|
|
4
|
+
id: number;
|
|
5
|
+
effective_from_date: number;
|
|
6
|
+
effective_to_date: number;
|
|
7
|
+
base_price: number;
|
|
8
|
+
unit: string;
|
|
9
|
+
pitch_slab: {
|
|
10
|
+
[key: string]: IPitchSlab;
|
|
11
|
+
};
|
|
12
|
+
billing_cycle: {
|
|
13
|
+
[key: string]: IBillingCycle;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare enum SubscriptionStatus {
|
|
2
|
+
ACTIVE = "active",
|
|
3
|
+
DEACTIVE = "deactive",
|
|
4
|
+
SUSPENDED = "suspended",
|
|
5
|
+
ONHOLD = "onhold",
|
|
6
|
+
UPGRADE = "upgrade",
|
|
7
|
+
UPGRADED = "upgraded",
|
|
8
|
+
PAYMENT_DONE = "payment_done",
|
|
9
|
+
PAYMENT_PENDING = "payment_pending",
|
|
10
|
+
DEACTIVE_ACCOUNT_SUSPENDED = "deactive_account_suspended",
|
|
11
|
+
DEACTIVE_EXPIRED = "deactive_expired",
|
|
12
|
+
UPGRADE_PAYMENT_PENDING = "upgrade_payment_pending",
|
|
13
|
+
UPGRADE_PAYMENT_DONE = "upgrade_payment_done",
|
|
14
|
+
UPGRADE_RENEW_PAYMENT_PENDING = "upgrade_renew_payment_pending",
|
|
15
|
+
UPGRADE_RENEW_PAYMENT_DONE = "upgrade_renew_payment_done",
|
|
16
|
+
REJECT = "reject",
|
|
17
|
+
SETUP_INVALID = "setup_invalid",
|
|
18
|
+
PAYMENT_INVALID = "payment_invalid",
|
|
19
|
+
ACCOUNT_SUSPENDED = "account_suspended"
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionStatus = void 0;
|
|
4
|
+
var SubscriptionStatus;
|
|
5
|
+
(function (SubscriptionStatus) {
|
|
6
|
+
SubscriptionStatus["ACTIVE"] = "active";
|
|
7
|
+
SubscriptionStatus["DEACTIVE"] = "deactive";
|
|
8
|
+
SubscriptionStatus["SUSPENDED"] = "suspended";
|
|
9
|
+
SubscriptionStatus["ONHOLD"] = "onhold";
|
|
10
|
+
SubscriptionStatus["UPGRADE"] = "upgrade";
|
|
11
|
+
SubscriptionStatus["UPGRADED"] = "upgraded";
|
|
12
|
+
SubscriptionStatus["PAYMENT_DONE"] = "payment_done";
|
|
13
|
+
SubscriptionStatus["PAYMENT_PENDING"] = "payment_pending";
|
|
14
|
+
SubscriptionStatus["DEACTIVE_ACCOUNT_SUSPENDED"] = "deactive_account_suspended";
|
|
15
|
+
SubscriptionStatus["DEACTIVE_EXPIRED"] = "deactive_expired";
|
|
16
|
+
SubscriptionStatus["UPGRADE_PAYMENT_PENDING"] = "upgrade_payment_pending";
|
|
17
|
+
SubscriptionStatus["UPGRADE_PAYMENT_DONE"] = "upgrade_payment_done";
|
|
18
|
+
SubscriptionStatus["UPGRADE_RENEW_PAYMENT_PENDING"] = "upgrade_renew_payment_pending";
|
|
19
|
+
SubscriptionStatus["UPGRADE_RENEW_PAYMENT_DONE"] = "upgrade_renew_payment_done";
|
|
20
|
+
SubscriptionStatus["REJECT"] = "reject";
|
|
21
|
+
SubscriptionStatus["SETUP_INVALID"] = "setup_invalid";
|
|
22
|
+
SubscriptionStatus["PAYMENT_INVALID"] = "payment_invalid";
|
|
23
|
+
SubscriptionStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
|
|
24
|
+
})(SubscriptionStatus || (exports.SubscriptionStatus = SubscriptionStatus = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PricingPlanStatus } from "../../enums/pricing-plan-status.enum";
|
|
2
|
+
import { IBillingCycle } from "../../interface/billing-cycle.interface";
|
|
3
|
+
import { GetPricingPlanByDateResponse } from "../../interface/get-pricing-plan-by-date-response.interface";
|
|
4
|
+
import { IPitchSlab } from "../../interface/pitch-slab.interface";
|
|
5
|
+
import { IPringPlanModel } from "../../interface/pricing-plan-model.interface";
|
|
6
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
7
|
+
export interface IPricingPlanEntity extends IEntityAuditColumn {
|
|
8
|
+
id: number;
|
|
9
|
+
effectiveFrom: Date;
|
|
10
|
+
effectiveTo: Date;
|
|
11
|
+
costCode: string;
|
|
12
|
+
status: PricingPlanStatus;
|
|
13
|
+
createdBy: number;
|
|
14
|
+
createdOn: Date;
|
|
15
|
+
updatedBy: number;
|
|
16
|
+
updatedOn: Date;
|
|
17
|
+
basePrice: number;
|
|
18
|
+
billingCycle: string;
|
|
19
|
+
unit: string;
|
|
20
|
+
getBillingCycleKeys(): string[];
|
|
21
|
+
toModel(): IPringPlanModel;
|
|
22
|
+
arrayToIndexedObject<T>(arr: T[]): {
|
|
23
|
+
[key: string]: T;
|
|
24
|
+
};
|
|
25
|
+
toObject(): GetPricingPlanByDateResponse;
|
|
26
|
+
toPitchSlabs(): IPitchSlab[];
|
|
27
|
+
toBillingCycles(): IBillingCycle[];
|
|
28
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { SubscriptionStatus } from "../../interface/subscription-status.interface";
|
|
2
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
3
|
+
export interface ISubscriptionEntity extends IEntityAuditColumn {
|
|
4
|
+
id: number;
|
|
5
|
+
organizationId: number;
|
|
6
|
+
from: Date;
|
|
7
|
+
to: Date;
|
|
8
|
+
type: string;
|
|
9
|
+
grossAmount: number;
|
|
10
|
+
discount: string;
|
|
11
|
+
netAmount: number;
|
|
12
|
+
amountPaid: number;
|
|
13
|
+
status: SubscriptionStatus;
|
|
14
|
+
noOfPitches: number;
|
|
15
|
+
remarks: string;
|
|
16
|
+
registrationId: number;
|
|
17
|
+
pricingPlanId: number;
|
|
18
|
+
previousSubscriptionIds: string;
|
|
19
|
+
}
|
|
20
|
+
export interface ISubscriptionModel extends ISubscriptionEntity {
|
|
21
|
+
}
|
|
22
|
+
export declare class SubscriptionModel implements ISubscriptionModel {
|
|
23
|
+
id: number;
|
|
24
|
+
organizationId: number;
|
|
25
|
+
from: Date;
|
|
26
|
+
to: Date;
|
|
27
|
+
type: string;
|
|
28
|
+
grossAmount: number;
|
|
29
|
+
discount: string;
|
|
30
|
+
netAmount: number;
|
|
31
|
+
amountPaid: number;
|
|
32
|
+
status: SubscriptionStatus;
|
|
33
|
+
noOfPitches: number;
|
|
34
|
+
remarks: string;
|
|
35
|
+
registrationId: number;
|
|
36
|
+
pricingPlanId: number;
|
|
37
|
+
previousSubscriptionIds: string;
|
|
38
|
+
createdOn: Date;
|
|
39
|
+
updatedOn: Date;
|
|
40
|
+
createdBy: number;
|
|
41
|
+
updatedBy: number;
|
|
42
|
+
constructor(data: ISubscriptionEntity);
|
|
43
|
+
remainingSubscriptionDays(): number;
|
|
44
|
+
static updateStatus(subscriptionEntities: ISubscriptionEntity[], status: SubscriptionStatus, userId: number): ISubscriptionEntity[];
|
|
45
|
+
remainingAmount(): number;
|
|
46
|
+
isAmountFullyPaid(): boolean;
|
|
47
|
+
isAmountPaidGreater(): boolean;
|
|
48
|
+
updateStatusIfPaymentDone(): void;
|
|
49
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SubscriptionModel = void 0;
|
|
4
|
+
var subscription_status_interface_1 = require("../../interface/subscription-status.interface");
|
|
5
|
+
var SubscriptionModel = /** @class */ (function () {
|
|
6
|
+
function SubscriptionModel(data) {
|
|
7
|
+
Object.assign(this, data);
|
|
8
|
+
}
|
|
9
|
+
SubscriptionModel.prototype.remainingSubscriptionDays = function () {
|
|
10
|
+
var oneDay = 24 * 60 * 60 * 1000;
|
|
11
|
+
var dayDifference = Math.ceil((this.to.getTime() - new Date().getTime()) / oneDay);
|
|
12
|
+
return dayDifference - 1; //minus 1 day
|
|
13
|
+
};
|
|
14
|
+
SubscriptionModel.updateStatus = function (subscriptionEntities, status, userId) {
|
|
15
|
+
return subscriptionEntities.map(function (subscriptionEntity) {
|
|
16
|
+
subscriptionEntity.status = status;
|
|
17
|
+
subscriptionEntity.updatedBy = userId;
|
|
18
|
+
subscriptionEntity.updatedOn = new Date();
|
|
19
|
+
return subscriptionEntity;
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
SubscriptionModel.prototype.remainingAmount = function () {
|
|
23
|
+
return this.netAmount - this.amountPaid;
|
|
24
|
+
};
|
|
25
|
+
SubscriptionModel.prototype.isAmountFullyPaid = function () {
|
|
26
|
+
if (this.netAmount === this.amountPaid) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
};
|
|
31
|
+
SubscriptionModel.prototype.isAmountPaidGreater = function () {
|
|
32
|
+
if (this.amountPaid > this.netAmount) {
|
|
33
|
+
return true;
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
};
|
|
37
|
+
SubscriptionModel.prototype.updateStatusIfPaymentDone = function () {
|
|
38
|
+
if (this.isAmountFullyPaid()) {
|
|
39
|
+
this.status =
|
|
40
|
+
this.status === subscription_status_interface_1.SubscriptionStatus.UPGRADE_PAYMENT_PENDING
|
|
41
|
+
? subscription_status_interface_1.SubscriptionStatus.UPGRADE_PAYMENT_DONE
|
|
42
|
+
: this.status === subscription_status_interface_1.SubscriptionStatus.UPGRADE_RENEW_PAYMENT_PENDING
|
|
43
|
+
? subscription_status_interface_1.SubscriptionStatus.UPGRADE_RENEW_PAYMENT_DONE
|
|
44
|
+
: this.status === subscription_status_interface_1.SubscriptionStatus.PAYMENT_PENDING
|
|
45
|
+
? subscription_status_interface_1.SubscriptionStatus.PAYMENT_DONE
|
|
46
|
+
: this.status;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return SubscriptionModel;
|
|
50
|
+
}());
|
|
51
|
+
exports.SubscriptionModel = SubscriptionModel;
|