ia-common 1.0.1-beta.3 → 1.0.1-beta.30
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/@enum.d.ts +2 -0
- package/build/@enum.js +2 -0
- package/build/@model.d.ts +3 -0
- package/build/@model.js +19 -0
- package/build/@type.d.ts +2 -0
- package/build/@type.js +3 -0
- package/build/@utils.d.ts +1 -0
- package/build/@utils.js +1 -0
- package/build/enum/organization-status.enum.d.ts +6 -1
- package/build/enum/organization-status.enum.js +5 -0
- package/build/enum/pricing-plan-status.enum.d.ts +4 -0
- package/build/enum/pricing-plan-status.enum.js +8 -0
- package/build/enum/registration-status.enum.d.ts +6 -1
- package/build/enum/registration-status.enum.js +5 -0
- package/build/enum/subscription-status.enum.d.ts +11 -0
- package/build/enum/subscription-status.enum.js +15 -0
- package/build/enum/user-status.enum.d.ts +5 -1
- package/build/enum/user-status.enum.js +4 -0
- package/build/exception/app-badrequest.exception.d.ts +4 -0
- package/build/exception/app-badrequest.exception.js +28 -0
- package/build/interface/api/create-bank-details.interface.d.ts +22 -0
- package/build/interface/api/create-pricing-plan.interface.d.ts +20 -0
- package/build/interface/api/create-pricing-plan.interface.js +2 -0
- package/build/interface/api/create-registration.interface.d.ts +2 -2
- package/build/interface/api/create-subscription.interface.d.ts +18 -0
- package/build/interface/api/create-subscription.interface.js +2 -0
- package/build/interface/api/get-bank-details.interface.d.ts +7 -0
- package/build/interface/api/get-bank-details.interface.js +2 -0
- package/build/interface/api/get-organization-by-id.interface.d.ts +6 -0
- package/build/interface/api/get-organization-by-id.interface.js +2 -0
- package/build/interface/api/get-pricing-plan-by-date.interface.d.ts +14 -0
- package/build/interface/api/get-pricing-plan-by-date.interface.js +2 -0
- package/build/interface/api/get-registration-by-id.interface.d.ts +15 -0
- package/build/interface/api/get-registration-by-id.interface.js +2 -0
- package/build/interface/api/get-registration-with-organization-owners.interface.d.ts +12 -0
- package/build/interface/api/get-registration-with-organization-owners.interface.js +2 -0
- package/build/interface/api/index.d.ts +16 -0
- package/build/interface/api/index.js +16 -0
- package/build/interface/api/login.interface.js +2 -0
- package/build/interface/api/remove-bank-details-by-id.interface.d.ts +7 -0
- package/build/interface/api/remove-bank-details-by-id.interface.js +2 -0
- package/build/interface/api/remove-pricing-plan-by-id.interface.d.ts +6 -0
- package/build/interface/api/remove-pricing-plan-by-id.interface.js +2 -0
- package/build/interface/api/update-bank-details.interface.d.ts +18 -0
- package/build/interface/api/update-bank-details.interface.js +2 -0
- package/build/interface/api/update-organization.interface.d.ts +2 -0
- package/build/interface/api/update-pricing-plan-by-id.interface.d.ts +18 -0
- package/build/interface/api/update-pricing-plan-by-id.interface.js +2 -0
- package/build/interface/api/update-pricing-plan.interface.d.ts +13 -0
- package/build/interface/api/update-pricing-plan.interface.js +2 -0
- package/build/interface/api/update-registration.interface.d.ts +8 -0
- package/build/interface/api/update-registration.interface.js +2 -0
- package/build/interface/api/update-subscription.interface.d.ts +11 -0
- package/build/interface/api/update-subscription.interface.js +2 -0
- package/build/interface/app-badrequest-exception.type.d.ts +4 -0
- package/build/interface/app-badrequest-exception.type.js +2 -0
- package/build/interface/entity/bank-details-entity.interface.d.ts +12 -0
- package/build/interface/entity/bank-details-entity.interface.js +2 -0
- package/build/interface/entity/index.d.ts +3 -0
- package/build/interface/entity/index.js +3 -0
- package/build/interface/entity/pricing-plan-entity.interface.d.ts +10 -0
- package/build/interface/entity/pricing-plan-entity.interface.js +2 -0
- package/build/interface/entity/subscription-entity.interface.d.ts +17 -0
- package/build/interface/entity/subscription-entity.interface.js +2 -0
- package/build/interface/ng-date-struct.interface.d.ts +0 -0
- package/build/interface/ng-date-struct.interface.js +5 -0
- package/build/interface/pricing-plan-model.interface.d.ts +14 -0
- package/build/interface/pricing-plan-model.interface.js +2 -0
- package/build/interface/user-entity-without-password.interface.d.ts +3 -0
- package/build/interface/user-entity-without-password.interface.js +2 -0
- package/build/model/pricing-plan-entity-model.d.ts +27 -0
- package/build/model/pricing-plan-entity-model.js +118 -0
- package/build/model/pricing-plan-model.d.ts +25 -0
- package/build/model/pricing-plan-model.js +31 -0
- package/build/model/subscribed-pricing-plan-model.d.ts +1 -0
- package/build/model/subscribed-pricing-plan-model.js +48 -0
- package/build/utils/date-util.d.ts +9 -0
- package/build/utils/date-util.js +46 -0
- package/package.json +4 -1
- /package/build/interface/api/{login-interface.js → create-bank-details.interface.js} +0 -0
- /package/build/interface/api/{login-interface.d.ts → login.interface.d.ts} +0 -0
package/build/@enum.d.ts
CHANGED
|
@@ -3,3 +3,5 @@ export * from "./enum/organization-type.enum";
|
|
|
3
3
|
export * from "./enum/user-status.enum";
|
|
4
4
|
export * from "./enum/user-type.enum";
|
|
5
5
|
export * from "./enum/registration-status.enum";
|
|
6
|
+
export * from "./enum/pricing-plan-status.enum";
|
|
7
|
+
export * from "./enum/subscription-status.enum";
|
package/build/@enum.js
CHANGED
|
@@ -19,3 +19,5 @@ __exportStar(require("./enum/organization-type.enum"), exports);
|
|
|
19
19
|
__exportStar(require("./enum/user-status.enum"), exports);
|
|
20
20
|
__exportStar(require("./enum/user-type.enum"), exports);
|
|
21
21
|
__exportStar(require("./enum/registration-status.enum"), exports);
|
|
22
|
+
__exportStar(require("./enum/pricing-plan-status.enum"), exports);
|
|
23
|
+
__exportStar(require("./enum/subscription-status.enum"), exports);
|
package/build/@model.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./model/pricing-plan-entity-model"), exports);
|
|
18
|
+
__exportStar(require("./model/subscribed-pricing-plan-model"), exports);
|
|
19
|
+
__exportStar(require("./exception/app-badrequest.exception"), exports);
|
package/build/@type.d.ts
CHANGED
|
@@ -6,3 +6,5 @@ export * from "./interface/without-token-registration-entity.interface";
|
|
|
6
6
|
export * from "./interface/modify-entity.interface";
|
|
7
7
|
export * from "./interface/modify.interface";
|
|
8
8
|
export * from "./interface/update-user-info.interface";
|
|
9
|
+
export * from "./interface/user-entity-without-password.interface";
|
|
10
|
+
export * from "./interface/pricing-plan-model.interface";
|
package/build/@type.js
CHANGED
|
@@ -22,3 +22,6 @@ __exportStar(require("./interface/without-token-registration-entity.interface"),
|
|
|
22
22
|
__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
|
+
__exportStar(require("./interface/user-entity-without-password.interface"), exports);
|
|
26
|
+
__exportStar(require("./interface/pricing-plan-model.interface"), exports);
|
|
27
|
+
// export * from "./interface/ng-date-struct.interface";
|
package/build/@utils.d.ts
CHANGED
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);
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export declare enum OrganizationStatus {
|
|
2
|
-
REGISTRATION_APPROVED = "registration_approved"
|
|
2
|
+
REGISTRATION_APPROVED = "registration_approved",
|
|
3
|
+
SETUP_DONE = "setup_done",
|
|
4
|
+
ACTIVE = "active",
|
|
5
|
+
SETUP_INVALID = "setup_invalid",
|
|
6
|
+
PAYMENT_INVALID = "payment_invalid",
|
|
7
|
+
ACCOUNT_SUSPENDED = "account_suspended"
|
|
3
8
|
}
|
|
@@ -4,4 +4,9 @@ exports.OrganizationStatus = void 0;
|
|
|
4
4
|
var OrganizationStatus;
|
|
5
5
|
(function (OrganizationStatus) {
|
|
6
6
|
OrganizationStatus["REGISTRATION_APPROVED"] = "registration_approved";
|
|
7
|
+
OrganizationStatus["SETUP_DONE"] = "setup_done";
|
|
8
|
+
OrganizationStatus["ACTIVE"] = "active";
|
|
9
|
+
OrganizationStatus["SETUP_INVALID"] = "setup_invalid";
|
|
10
|
+
OrganizationStatus["PAYMENT_INVALID"] = "payment_invalid";
|
|
11
|
+
OrganizationStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
|
|
7
12
|
})(OrganizationStatus || (exports.OrganizationStatus = OrganizationStatus = {}));
|
|
@@ -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 = {}));
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export declare enum RegistrationStatus {
|
|
2
|
-
REGISTRATION_APPROVED = "registration_approved"
|
|
2
|
+
REGISTRATION_APPROVED = "registration_approved",
|
|
3
|
+
SETUP_DONE = "setup_done",
|
|
4
|
+
ACTIVE = "active",
|
|
5
|
+
SETUP_INVALID = "setup_invalid",
|
|
6
|
+
PAYMENT_INVALID = "payment_invalid",
|
|
7
|
+
ACCOUNT_SUSPENDED = "account_suspended"
|
|
3
8
|
}
|
|
@@ -4,4 +4,9 @@ exports.RegistrationStatus = void 0;
|
|
|
4
4
|
var RegistrationStatus;
|
|
5
5
|
(function (RegistrationStatus) {
|
|
6
6
|
RegistrationStatus["REGISTRATION_APPROVED"] = "registration_approved";
|
|
7
|
+
RegistrationStatus["SETUP_DONE"] = "setup_done";
|
|
8
|
+
RegistrationStatus["ACTIVE"] = "active";
|
|
9
|
+
RegistrationStatus["SETUP_INVALID"] = "setup_invalid";
|
|
10
|
+
RegistrationStatus["PAYMENT_INVALID"] = "payment_invalid";
|
|
11
|
+
RegistrationStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
|
|
7
12
|
})(RegistrationStatus || (exports.RegistrationStatus = RegistrationStatus = {}));
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare enum SubscriptionStatus {
|
|
2
|
+
ACTIVE = "active",
|
|
3
|
+
DEACTIVE = "deactive",
|
|
4
|
+
PAYMENT_DONE = "payment_done",
|
|
5
|
+
PAYMENT_PENDING = "payment_pending",
|
|
6
|
+
REJECT = "reject",
|
|
7
|
+
SETUP_INVALID = "setup_invalid",
|
|
8
|
+
SETUP_DONE = "setup_done",
|
|
9
|
+
PAYMENT_INVALID = "payment_invalid",
|
|
10
|
+
ACCOUNT_SUSPENDED = "account_suspended"
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
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["PAYMENT_DONE"] = "payment_done";
|
|
9
|
+
SubscriptionStatus["PAYMENT_PENDING"] = "payment_pending";
|
|
10
|
+
SubscriptionStatus["REJECT"] = "reject";
|
|
11
|
+
SubscriptionStatus["SETUP_INVALID"] = "setup_invalid";
|
|
12
|
+
SubscriptionStatus["SETUP_DONE"] = "setup_done";
|
|
13
|
+
SubscriptionStatus["PAYMENT_INVALID"] = "payment_invalid";
|
|
14
|
+
SubscriptionStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
|
|
15
|
+
})(SubscriptionStatus || (exports.SubscriptionStatus = SubscriptionStatus = {}));
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export declare enum UserStatus {
|
|
2
2
|
ACTIVE = "active",
|
|
3
3
|
DEACTIVE = "deactive",
|
|
4
|
-
REGISTRATION_APPROVED = "registration_approved"
|
|
4
|
+
REGISTRATION_APPROVED = "registration_approved",
|
|
5
|
+
SETUP_DONE = "setup_done",
|
|
6
|
+
SETUP_INVALID = "setup_invalid",
|
|
7
|
+
PAYMENT_INVALID = "payment_invalid",
|
|
8
|
+
ACCOUNT_SUSPENDED = "account_suspended"
|
|
5
9
|
}
|
|
@@ -6,4 +6,8 @@ var UserStatus;
|
|
|
6
6
|
UserStatus["ACTIVE"] = "active";
|
|
7
7
|
UserStatus["DEACTIVE"] = "deactive";
|
|
8
8
|
UserStatus["REGISTRATION_APPROVED"] = "registration_approved";
|
|
9
|
+
UserStatus["SETUP_DONE"] = "setup_done";
|
|
10
|
+
UserStatus["SETUP_INVALID"] = "setup_invalid";
|
|
11
|
+
UserStatus["PAYMENT_INVALID"] = "payment_invalid";
|
|
12
|
+
UserStatus["ACCOUNT_SUSPENDED"] = "account_suspended";
|
|
9
13
|
})(UserStatus || (exports.UserStatus = UserStatus = {}));
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.AppBadRequestException = void 0;
|
|
19
|
+
var AppBadRequestException = /** @class */ (function (_super) {
|
|
20
|
+
__extends(AppBadRequestException, _super);
|
|
21
|
+
function AppBadRequestException(appBadRequestException) {
|
|
22
|
+
var _this = _super.call(this) || this;
|
|
23
|
+
_this.message = appBadRequestException.message.join(",");
|
|
24
|
+
return _this;
|
|
25
|
+
}
|
|
26
|
+
return AppBadRequestException;
|
|
27
|
+
}(Error));
|
|
28
|
+
exports.AppBadRequestException = AppBadRequestException;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IBankDetailEntity, IUploadedMulterFile, Modify } from "../../@type";
|
|
2
|
+
export interface ICreateBankDetailResponse extends Modify<IBankDetailEntity, {
|
|
3
|
+
createdOn: string;
|
|
4
|
+
updatedOn: string;
|
|
5
|
+
}> {
|
|
6
|
+
}
|
|
7
|
+
export interface ICreateBankDetailRequest {
|
|
8
|
+
qrCode?: IUploadedMulterFile;
|
|
9
|
+
bankName: string;
|
|
10
|
+
accountName: string;
|
|
11
|
+
accountNo: string;
|
|
12
|
+
ifscCode: string;
|
|
13
|
+
upiId?: string;
|
|
14
|
+
bankAddress?: string;
|
|
15
|
+
branch: string;
|
|
16
|
+
files: IFiles[];
|
|
17
|
+
}
|
|
18
|
+
export interface IFiles {
|
|
19
|
+
key: string;
|
|
20
|
+
value: File;
|
|
21
|
+
name: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IPricingPlanEntity, Modify } from "../../@type";
|
|
2
|
+
export interface ICreatePricingPlanRequest {
|
|
3
|
+
effectiveFromDate: number;
|
|
4
|
+
effectiveToDate?: number;
|
|
5
|
+
basePrice: number;
|
|
6
|
+
billingCycle: IBillingCycle;
|
|
7
|
+
}
|
|
8
|
+
export interface IBillingCycle {
|
|
9
|
+
[key: string]: IBilling;
|
|
10
|
+
}
|
|
11
|
+
export interface IBilling {
|
|
12
|
+
noOfMonths: number;
|
|
13
|
+
discount: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ICreatePricingPlanResponse extends Modify<IPricingPlanEntity, {
|
|
17
|
+
createdOn: string;
|
|
18
|
+
updatedOn: string;
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RegistrationStatus } from "../../@enum";
|
|
2
2
|
import { IModifyEntity, IWithoutTokenRegistrationEntity } from "../../@type";
|
|
3
3
|
export interface ICreateRegistrationResponse extends IModifyEntity<IWithoutTokenRegistrationEntity> {
|
|
4
4
|
}
|
|
@@ -6,6 +6,6 @@ export interface ICreateRegistrationRequest {
|
|
|
6
6
|
name: string;
|
|
7
7
|
contact: string;
|
|
8
8
|
email: string;
|
|
9
|
-
status:
|
|
9
|
+
status: RegistrationStatus;
|
|
10
10
|
comments?: string;
|
|
11
11
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ISubscriptionEntity } from "../entity";
|
|
2
|
+
import { Modify } from "../modify.interface";
|
|
3
|
+
export interface ICreateSubscriptionResponse extends Modify<ISubscriptionEntity, {
|
|
4
|
+
createdOn: string;
|
|
5
|
+
updatedOn: string;
|
|
6
|
+
}> {
|
|
7
|
+
}
|
|
8
|
+
export interface ICreateSubscriptionRequest {
|
|
9
|
+
from: number;
|
|
10
|
+
to: number;
|
|
11
|
+
pricingPlanId: number;
|
|
12
|
+
type: string;
|
|
13
|
+
grossAmount: number;
|
|
14
|
+
discount: string;
|
|
15
|
+
netAmount: number;
|
|
16
|
+
amountPaid: number;
|
|
17
|
+
remarks?: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IOrganizationEntity } from "../entity";
|
|
2
|
+
import { IModifyEntity } from "../modify-entity.interface";
|
|
3
|
+
import { IUserEntityWithoutPassword } from "../user-entity-without-password.interface";
|
|
4
|
+
export interface IGetOrganizationByOrgIdResponse extends IModifyEntity<IOrganizationEntity> {
|
|
5
|
+
owners?: IModifyEntity<IUserEntityWithoutPassword>[];
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface IGetPricingPlanByDateResponse {
|
|
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,15 @@
|
|
|
1
|
+
import { IModifyEntity, IOrganizationEntity, IRegistrationEntity, ISubscriptionEntity, IUserEntityWithoutPassword } from "../../@type";
|
|
2
|
+
export interface IOrganizationWithOwners extends IModifyEntity<IOrganizationEntity> {
|
|
3
|
+
owners: {
|
|
4
|
+
[userId: string]: IModifyEntity<IUserEntityWithoutPassword>;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export interface IGetRegistrationById {
|
|
8
|
+
registration: IRegistrationEntity;
|
|
9
|
+
organization: {
|
|
10
|
+
[id: string]: IOrganizationWithOwners;
|
|
11
|
+
};
|
|
12
|
+
subscription: {
|
|
13
|
+
[id: string]: IModifyEntity<ISubscriptionEntity>;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IModifyEntity, IOrganizationWithOwners, IRegistrationEntity, ISubscriptionEntity } from "../../@type";
|
|
2
|
+
export interface IGetRegistrationResponse {
|
|
3
|
+
[registrationId: string]: {
|
|
4
|
+
registration: IRegistrationEntity;
|
|
5
|
+
organization: {
|
|
6
|
+
[id: string]: IOrganizationWithOwners;
|
|
7
|
+
};
|
|
8
|
+
subscription: {
|
|
9
|
+
[id: string]: IModifyEntity<ISubscriptionEntity>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
export * from "./update-organization.interface";
|
|
2
2
|
export * from "./create-registration.interface";
|
|
3
3
|
export * from "./update-organization.interface";
|
|
4
|
+
export * from "./create-bank-details.interface";
|
|
5
|
+
export * from "./create-pricing-plan.interface";
|
|
6
|
+
export * from "./create-subscription.interface";
|
|
7
|
+
export * from "./remove-pricing-plan-by-id.interface";
|
|
8
|
+
export * from "./update-bank-details.interface";
|
|
9
|
+
export * from "./update-pricing-plan.interface";
|
|
10
|
+
export * from "./update-subscription.interface";
|
|
11
|
+
export * from "./get-pricing-plan-by-date.interface";
|
|
12
|
+
export * from "./get-bank-details.interface";
|
|
13
|
+
export * from "./get-registration-by-id.interface";
|
|
14
|
+
export * from "./get-registration-with-organization-owners.interface";
|
|
15
|
+
export * from "./remove-bank-details-by-id.interface";
|
|
16
|
+
export * from "./update-pricing-plan-by-id.interface";
|
|
17
|
+
export * from "./login.interface";
|
|
18
|
+
export * from "./update-registration.interface";
|
|
19
|
+
export * from "./get-organization-by-id.interface";
|
|
@@ -17,3 +17,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./update-organization.interface"), exports);
|
|
18
18
|
__exportStar(require("./create-registration.interface"), exports);
|
|
19
19
|
__exportStar(require("./update-organization.interface"), exports);
|
|
20
|
+
__exportStar(require("./create-bank-details.interface"), exports);
|
|
21
|
+
__exportStar(require("./create-pricing-plan.interface"), exports);
|
|
22
|
+
__exportStar(require("./create-subscription.interface"), exports);
|
|
23
|
+
__exportStar(require("./remove-pricing-plan-by-id.interface"), exports);
|
|
24
|
+
__exportStar(require("./update-bank-details.interface"), exports);
|
|
25
|
+
__exportStar(require("./update-pricing-plan.interface"), exports);
|
|
26
|
+
__exportStar(require("./update-subscription.interface"), exports);
|
|
27
|
+
__exportStar(require("./get-pricing-plan-by-date.interface"), exports);
|
|
28
|
+
__exportStar(require("./get-bank-details.interface"), exports);
|
|
29
|
+
__exportStar(require("./get-registration-by-id.interface"), exports);
|
|
30
|
+
__exportStar(require("./get-registration-with-organization-owners.interface"), exports);
|
|
31
|
+
__exportStar(require("./remove-bank-details-by-id.interface"), exports);
|
|
32
|
+
__exportStar(require("./update-pricing-plan-by-id.interface"), exports);
|
|
33
|
+
__exportStar(require("./login.interface"), exports);
|
|
34
|
+
__exportStar(require("./update-registration.interface"), exports);
|
|
35
|
+
__exportStar(require("./get-organization-by-id.interface"), exports);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IBankDetailEntity, IUploadedMulterFile, Modify } from "../../@type";
|
|
2
|
+
import { IFiles } from "./create-bank-details.interface";
|
|
3
|
+
export interface IUpdateBankDetailResponse extends Modify<IBankDetailEntity, {
|
|
4
|
+
createdOn: string;
|
|
5
|
+
updatedOn: string;
|
|
6
|
+
}> {
|
|
7
|
+
}
|
|
8
|
+
export interface IUpdateBankDetailRequest {
|
|
9
|
+
qrCode?: IUploadedMulterFile;
|
|
10
|
+
bankName?: string;
|
|
11
|
+
accountName?: string;
|
|
12
|
+
accountNo?: string;
|
|
13
|
+
ifscCode?: string;
|
|
14
|
+
upiId?: string;
|
|
15
|
+
bankAddress?: string;
|
|
16
|
+
branch?: string;
|
|
17
|
+
files: IFiles[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { IPricingPlanEntity } from "../entity";
|
|
2
|
+
import { Modify } from "../modify.interface";
|
|
3
|
+
export interface IUpdatePricingPlanByIdResponse extends Modify<IPricingPlanEntity, {
|
|
4
|
+
createdOn: string;
|
|
5
|
+
updatedOn: string;
|
|
6
|
+
}> {
|
|
7
|
+
}
|
|
8
|
+
export interface IUpdatePricingPlanByIdRequest {
|
|
9
|
+
effectiveFromDate?: number;
|
|
10
|
+
effectiveToDate?: number;
|
|
11
|
+
basePrice?: number;
|
|
12
|
+
billingCycle?: IBillingCycleDto;
|
|
13
|
+
}
|
|
14
|
+
export interface IBillingCycleDto {
|
|
15
|
+
noOfMonths: number;
|
|
16
|
+
discount: string;
|
|
17
|
+
name: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IPricingPlanEntity, Modify } from "../../@type";
|
|
2
|
+
import { IBillingCycle } from "./create-pricing-plan.interface";
|
|
3
|
+
export interface IUpdatePricingPlanRequest {
|
|
4
|
+
effectiveFromDate?: number;
|
|
5
|
+
effectiveToDate?: number;
|
|
6
|
+
basePrice?: number;
|
|
7
|
+
billingCycle?: IBillingCycle;
|
|
8
|
+
}
|
|
9
|
+
export interface IUpdatePricingPlanResponse extends Modify<IPricingPlanEntity, {
|
|
10
|
+
createdOn: string;
|
|
11
|
+
updatedOn: string;
|
|
12
|
+
}> {
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RegistrationStatus } from "../../@enum";
|
|
2
|
+
import { IModifyEntity } from "../modify-entity.interface";
|
|
3
|
+
import { IWithoutTokenRegistrationEntity } from "../without-token-registration-entity.interface";
|
|
4
|
+
export interface IUpdateRegistrationRequest {
|
|
5
|
+
status?: RegistrationStatus;
|
|
6
|
+
}
|
|
7
|
+
export interface IUpdateRegistrationResponse extends IModifyEntity<IWithoutTokenRegistrationEntity> {
|
|
8
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ISubscriptionEntity, Modify } from "../../@type";
|
|
2
|
+
export interface IUpdateSubscriptionResponse extends Modify<ISubscriptionEntity, {
|
|
3
|
+
createdOn: string;
|
|
4
|
+
updatedOn: string;
|
|
5
|
+
}> {
|
|
6
|
+
advanceAmount?: number;
|
|
7
|
+
}
|
|
8
|
+
export interface IUpdateSubscriptionRequest {
|
|
9
|
+
advanceAmount?: number;
|
|
10
|
+
remarks?: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IEntityAuditColumn } from "./entity-audit-column.interface";
|
|
2
|
+
export interface IBankDetailEntity extends IEntityAuditColumn {
|
|
3
|
+
id: number;
|
|
4
|
+
bankName: string;
|
|
5
|
+
accountNo: string;
|
|
6
|
+
ifscCode: string;
|
|
7
|
+
upiId: string;
|
|
8
|
+
qrCode: string | null;
|
|
9
|
+
bankAddress: string;
|
|
10
|
+
branch: string;
|
|
11
|
+
accountName: string;
|
|
12
|
+
}
|
|
@@ -2,3 +2,6 @@ export * from "./entity-audit-column.interface";
|
|
|
2
2
|
export * from "./organization-entity.interface";
|
|
3
3
|
export * from "./user-entity.interface";
|
|
4
4
|
export * from "./registration-entity";
|
|
5
|
+
export * from "./bank-details-entity.interface";
|
|
6
|
+
export * from "./pricing-plan-entity.interface";
|
|
7
|
+
export * from "./subscription-entity.interface";
|
|
@@ -18,3 +18,6 @@ __exportStar(require("./entity-audit-column.interface"), exports);
|
|
|
18
18
|
__exportStar(require("./organization-entity.interface"), exports);
|
|
19
19
|
__exportStar(require("./user-entity.interface"), exports);
|
|
20
20
|
__exportStar(require("./registration-entity"), exports);
|
|
21
|
+
__exportStar(require("./bank-details-entity.interface"), exports);
|
|
22
|
+
__exportStar(require("./pricing-plan-entity.interface"), exports);
|
|
23
|
+
__exportStar(require("./subscription-entity.interface"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PricingPlanStatus } from "../../@enum";
|
|
2
|
+
import { IEntityAuditColumn } from "./entity-audit-column.interface";
|
|
3
|
+
export interface IPricingPlanEntity extends IEntityAuditColumn {
|
|
4
|
+
id: number;
|
|
5
|
+
effectiveFrom: number;
|
|
6
|
+
effectiveTo: number;
|
|
7
|
+
status: PricingPlanStatus;
|
|
8
|
+
basePrice: number;
|
|
9
|
+
billingCycle: string;
|
|
10
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SubscriptionStatus } from "../../@enum";
|
|
2
|
+
import { IEntityAuditColumn } from "./entity-audit-column.interface";
|
|
3
|
+
export interface ISubscriptionEntity extends IEntityAuditColumn {
|
|
4
|
+
id: number;
|
|
5
|
+
fromDateCode: number;
|
|
6
|
+
toDateCode: number;
|
|
7
|
+
organizationId: number;
|
|
8
|
+
type: string;
|
|
9
|
+
grossAmount: number;
|
|
10
|
+
discount: string;
|
|
11
|
+
netAmount: number;
|
|
12
|
+
amountPaid: number;
|
|
13
|
+
status: SubscriptionStatus;
|
|
14
|
+
remarks: string;
|
|
15
|
+
registrationId: number;
|
|
16
|
+
pricingPlanId: number;
|
|
17
|
+
}
|
|
File without changes
|
|
@@ -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,27 @@
|
|
|
1
|
+
import { PricingPlanStatus } from "../@enum";
|
|
2
|
+
import { IGetPricingPlanByDateResponse, IPricingPlanEntity } from "../@type";
|
|
3
|
+
export declare class PricingPlanEntityModel implements IPricingPlanEntity {
|
|
4
|
+
id: number;
|
|
5
|
+
effectiveFrom: number;
|
|
6
|
+
effectiveTo: number;
|
|
7
|
+
status: PricingPlanStatus;
|
|
8
|
+
createdBy: number;
|
|
9
|
+
createdOn: Date;
|
|
10
|
+
updatedBy: number;
|
|
11
|
+
updatedOn: Date;
|
|
12
|
+
basePrice: number;
|
|
13
|
+
billingCycle: string;
|
|
14
|
+
constructor(data: IPricingPlanEntity);
|
|
15
|
+
toObject(): IGetPricingPlanByDateResponse;
|
|
16
|
+
}
|
|
17
|
+
export declare class BillingCycleModel {
|
|
18
|
+
code: string;
|
|
19
|
+
noOfMonths: number;
|
|
20
|
+
discount: string;
|
|
21
|
+
name: string;
|
|
22
|
+
key: string;
|
|
23
|
+
constructor(code: string);
|
|
24
|
+
parse(): BillingCycleModel;
|
|
25
|
+
getDiscount(): number;
|
|
26
|
+
getKey(): string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingCycleModel = exports.PricingPlanEntityModel = void 0;
|
|
4
|
+
var PricingPlanEntityModel = /** @class */ (function () {
|
|
5
|
+
function PricingPlanEntityModel(data) {
|
|
6
|
+
Object.assign(this, data);
|
|
7
|
+
}
|
|
8
|
+
PricingPlanEntityModel.prototype.toObject = function () {
|
|
9
|
+
var responseObj = {
|
|
10
|
+
id: this.id,
|
|
11
|
+
effectiveFromDate: 0,
|
|
12
|
+
effectiveToDate: 0,
|
|
13
|
+
basePrice: 0,
|
|
14
|
+
billingCycle: {},
|
|
15
|
+
};
|
|
16
|
+
var billingCycle = this.billingCycle.split(",");
|
|
17
|
+
billingCycle.forEach(function (billing, index) {
|
|
18
|
+
var billingArray = billing.split("_");
|
|
19
|
+
responseObj.billingCycle[index] = {
|
|
20
|
+
noOfMonths: Number(billingArray[0]),
|
|
21
|
+
discount: billingArray[1],
|
|
22
|
+
name: billingArray.slice(2).join("_"),
|
|
23
|
+
key: billingArray.slice(2).join("-").toLowerCase().replace(/ /g, "-"),
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
responseObj.effectiveFromDate = this.effectiveFrom;
|
|
27
|
+
responseObj.effectiveToDate = this.effectiveTo;
|
|
28
|
+
responseObj.basePrice = this.basePrice;
|
|
29
|
+
return responseObj;
|
|
30
|
+
};
|
|
31
|
+
return PricingPlanEntityModel;
|
|
32
|
+
}());
|
|
33
|
+
exports.PricingPlanEntityModel = PricingPlanEntityModel;
|
|
34
|
+
var BillingCycleModel = /** @class */ (function () {
|
|
35
|
+
function BillingCycleModel(code) {
|
|
36
|
+
this.code = code;
|
|
37
|
+
this.parse();
|
|
38
|
+
}
|
|
39
|
+
BillingCycleModel.prototype.parse = function () {
|
|
40
|
+
var billingCycleComponents = this.code.split("_");
|
|
41
|
+
this.noOfMonths = Number(billingCycleComponents[0]);
|
|
42
|
+
this.discount = billingCycleComponents[1];
|
|
43
|
+
this.name = billingCycleComponents[2];
|
|
44
|
+
this.key = this.getKey();
|
|
45
|
+
return this;
|
|
46
|
+
};
|
|
47
|
+
BillingCycleModel.prototype.getDiscount = function () {
|
|
48
|
+
if (this.discount.indexOf("P") > -1) {
|
|
49
|
+
return parseFloat(this.discount.replace("P", ""));
|
|
50
|
+
}
|
|
51
|
+
return 0;
|
|
52
|
+
};
|
|
53
|
+
BillingCycleModel.prototype.getKey = function () {
|
|
54
|
+
return this.name.toLowerCase().replace(" ", "-");
|
|
55
|
+
};
|
|
56
|
+
return BillingCycleModel;
|
|
57
|
+
}());
|
|
58
|
+
exports.BillingCycleModel = BillingCycleModel;
|
|
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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var _utils_1 = require("../@utils");
|
|
4
|
+
var SubscribedPricingPlanModel = /** @class */ (function () {
|
|
5
|
+
function SubscribedPricingPlanModel(data, billingCycleKey) {
|
|
6
|
+
// super(data);
|
|
7
|
+
this.basePrice = data.basePrice;
|
|
8
|
+
this.billingCycleKey = billingCycleKey;
|
|
9
|
+
this.selectedBillingCycle = data.getBillCycleByKey(billingCycleKey);
|
|
10
|
+
this.pricingPlanModel = data;
|
|
11
|
+
}
|
|
12
|
+
SubscribedPricingPlanModel.prototype.getGrossAmount = function (config) {
|
|
13
|
+
if (config === void 0) { config = { roundDown: false }; }
|
|
14
|
+
var roundDown = config.roundDown;
|
|
15
|
+
if (roundDown) {
|
|
16
|
+
return Math.floor(this.basePrice * this.selectedBillingCycle.noOfMonths);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return Math.round(this.basePrice * this.selectedBillingCycle.noOfMonths);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
SubscribedPricingPlanModel.prototype.getNextBillingCycleDateRange = function () {
|
|
23
|
+
var subscriptionDays = this.pricingPlanModel.getNoOfSubscriptionDays(this.billingCycleKey);
|
|
24
|
+
var date = _utils_1.dateUtil.addNDaysToDateCode(_utils_1.dateUtil.getDateCode(new Date()), subscriptionDays);
|
|
25
|
+
return { subscriptionDays: subscriptionDays, date: date };
|
|
26
|
+
};
|
|
27
|
+
SubscribedPricingPlanModel.prototype.getNetAmount = function (config) {
|
|
28
|
+
if (config === void 0) { config = { roundDown: false }; }
|
|
29
|
+
var roundDown = config.roundDown;
|
|
30
|
+
if (roundDown) {
|
|
31
|
+
return Math.floor(this.basePrice *
|
|
32
|
+
(1 - this.getBillingDiscount() / 100) *
|
|
33
|
+
this.selectedBillingCycle.noOfMonths);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
return Math.round(this.basePrice *
|
|
37
|
+
(1 - this.getBillingDiscount() / 100) *
|
|
38
|
+
this.selectedBillingCycle.noOfMonths);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
SubscribedPricingPlanModel.prototype.getBillingDiscount = function () {
|
|
42
|
+
if (this.selectedBillingCycle.discount.indexOf("P") > -1) {
|
|
43
|
+
return parseFloat(this.selectedBillingCycle.discount.replace("P", ""));
|
|
44
|
+
}
|
|
45
|
+
return 0;
|
|
46
|
+
};
|
|
47
|
+
return SubscribedPricingPlanModel;
|
|
48
|
+
}());
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare class DateUtil {
|
|
2
|
+
static isValidDate(dateCode: string): boolean;
|
|
3
|
+
getDateCode(date: Date): string;
|
|
4
|
+
getTodayCode(): string;
|
|
5
|
+
convertStringToDate(dateString: string, format?: string): Date;
|
|
6
|
+
addNDaysToDate(date: Date, n: number): Date;
|
|
7
|
+
addNDaysToDateCode(dateCode: string, n: number): string;
|
|
8
|
+
}
|
|
9
|
+
export declare const dateUtil: DateUtil;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dateUtil = exports.DateUtil = void 0;
|
|
4
|
+
var date_fns_1 = require("date-fns");
|
|
5
|
+
// import { INgbDateStruct } from "../@type";
|
|
6
|
+
var DateUtil = /** @class */ (function () {
|
|
7
|
+
function DateUtil() {
|
|
8
|
+
}
|
|
9
|
+
DateUtil.isValidDate = function (dateCode) {
|
|
10
|
+
if (dateCode.length !== 6)
|
|
11
|
+
return false;
|
|
12
|
+
// Date format: YYMMDD
|
|
13
|
+
function isDate(dateString) {
|
|
14
|
+
var separators = ["\\.", "\\-", "\\/"];
|
|
15
|
+
var stringBits = dateString.split(new RegExp(separators.join("|"), "g"));
|
|
16
|
+
var intBits = stringBits.map(function (bit) { return parseInt(bit); });
|
|
17
|
+
var parsedDate = new Date(intBits[0], intBits[1] - 1, intBits[2]);
|
|
18
|
+
return (parsedDate.getFullYear() === intBits[0] &&
|
|
19
|
+
parsedDate.getMonth() + 1 === intBits[1] &&
|
|
20
|
+
parsedDate.getDate() === intBits[2]);
|
|
21
|
+
}
|
|
22
|
+
return isDate("20".concat(dateCode.slice(0, 2), ".").concat(dateCode.slice(2, 4), ".").concat(dateCode.slice(4, 6)));
|
|
23
|
+
};
|
|
24
|
+
DateUtil.prototype.getDateCode = function (date) {
|
|
25
|
+
return (0, date_fns_1.format)(date, "yyMMdd");
|
|
26
|
+
};
|
|
27
|
+
DateUtil.prototype.getTodayCode = function () {
|
|
28
|
+
return (0, date_fns_1.format)(new Date(), "yyMMdd");
|
|
29
|
+
};
|
|
30
|
+
DateUtil.prototype.convertStringToDate = function (dateString, format) {
|
|
31
|
+
if (format === void 0) { format = "yyMMdd"; }
|
|
32
|
+
var parsedDate = (0, date_fns_1.parse)(dateString, format, new Date());
|
|
33
|
+
// IST has a fixed offset of UTC+5:30
|
|
34
|
+
var indianDate = new Date(parsedDate.getTime() + 330 * 60 * 1000);
|
|
35
|
+
return indianDate;
|
|
36
|
+
};
|
|
37
|
+
DateUtil.prototype.addNDaysToDate = function (date, n) {
|
|
38
|
+
return (0, date_fns_1.add)(date, { days: n });
|
|
39
|
+
};
|
|
40
|
+
DateUtil.prototype.addNDaysToDateCode = function (dateCode, n) {
|
|
41
|
+
return this.getDateCode(this.addNDaysToDate(this.convertStringToDate(dateCode, "yyMMdd"), n));
|
|
42
|
+
};
|
|
43
|
+
return DateUtil;
|
|
44
|
+
}());
|
|
45
|
+
exports.DateUtil = DateUtil;
|
|
46
|
+
exports.dateUtil = new DateUtil();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ia-common",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -30,5 +30,8 @@
|
|
|
30
30
|
"del-cli": "^5.1.0",
|
|
31
31
|
"eslint": "^8.56.0",
|
|
32
32
|
"typescript": "^5.3.3"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"date-fns": "^3.3.1"
|
|
33
36
|
}
|
|
34
37
|
}
|
|
File without changes
|
|
File without changes
|