turf-common 1.0.16-beta.26 → 1.0.16-beta.27
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/configuration-key.enum.d.ts +8 -0
- package/build/enums/configuration-key.enum.js +25 -0
- package/build/enums/cron-jobs-name.enum.d.ts +3 -0
- package/build/enums/cron-jobs-name.enum.js +7 -0
- package/build/enums/cron-jobs-status.enum.d.ts +5 -0
- package/build/enums/cron-jobs-status.enum.js +9 -0
- package/build/enums/transaction-type.enum.d.ts +7 -0
- package/build/enums/transaction-type.enum.js +11 -0
- package/build/interface/configuration-model.interface.d.ts +4 -0
- package/build/interface/configuration-model.interface.js +2 -0
- package/build/models/booking-payment-history-model.d.ts +20 -0
- package/build/models/booking-payment-history-model.js +36 -0
- package/build/models/configuration-model.d.ts +16 -0
- package/build/models/configuration-model.js +17 -0
- package/build/types/date-wise-payment-history-data.types.d.ts +9 -0
- package/build/types/date-wise-payment-history-data.types.js +2 -0
- package/build/types/entity/booking-payment-history-entity.type.d.ts +13 -0
- package/build/types/entity/booking-payment-history-entity.type.js +2 -0
- package/build/types/entity/configurations-entity.type.d.ts +8 -0
- package/build/types/entity/configurations-entity.type.js +2 -0
- package/build/types/entity/cron-jobs-entity.type.d.ts +12 -0
- package/build/types/entity/cron-jobs-entity.type.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CronJobsNames } from './cron-jobs-name.enum';
|
|
2
|
+
export declare enum ConfigurationKey {
|
|
3
|
+
SEND_DAILY_COLLECTION = "send_daily_collection"
|
|
4
|
+
}
|
|
5
|
+
export declare namespace ConfigurationKey {
|
|
6
|
+
function CronJobsConfigurationsKeys(key: ConfigurationKey): boolean;
|
|
7
|
+
function getCronJobName(configurationKey: ConfigurationKey): CronJobsNames;
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationKey = void 0;
|
|
4
|
+
var cron_jobs_name_enum_1 = require("./cron-jobs-name.enum");
|
|
5
|
+
var ConfigurationKey;
|
|
6
|
+
(function (ConfigurationKey) {
|
|
7
|
+
ConfigurationKey["SEND_DAILY_COLLECTION"] = "send_daily_collection";
|
|
8
|
+
})(ConfigurationKey || (exports.ConfigurationKey = ConfigurationKey = {}));
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
10
|
+
(function (ConfigurationKey) {
|
|
11
|
+
function CronJobsConfigurationsKeys(key) {
|
|
12
|
+
if (getCronJobName(key))
|
|
13
|
+
return true;
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
ConfigurationKey.CronJobsConfigurationsKeys = CronJobsConfigurationsKeys;
|
|
17
|
+
function getCronJobName(configurationKey) {
|
|
18
|
+
var _a;
|
|
19
|
+
var cronJobConfigurationKeyMapping = (_a = {},
|
|
20
|
+
_a[ConfigurationKey.SEND_DAILY_COLLECTION] = cron_jobs_name_enum_1.CronJobsNames.SEND_DAILY_COLLECTION,
|
|
21
|
+
_a);
|
|
22
|
+
return cronJobConfigurationKeyMapping[configurationKey];
|
|
23
|
+
}
|
|
24
|
+
ConfigurationKey.getCronJobName = getCronJobName;
|
|
25
|
+
})(ConfigurationKey || (exports.ConfigurationKey = ConfigurationKey = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CronJobsNames = void 0;
|
|
4
|
+
var CronJobsNames;
|
|
5
|
+
(function (CronJobsNames) {
|
|
6
|
+
CronJobsNames["SEND_DAILY_COLLECTION"] = "send_daily_collection";
|
|
7
|
+
})(CronJobsNames || (exports.CronJobsNames = CronJobsNames = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CronJobsStatus = void 0;
|
|
4
|
+
var CronJobsStatus;
|
|
5
|
+
(function (CronJobsStatus) {
|
|
6
|
+
CronJobsStatus["RUNNING"] = "running";
|
|
7
|
+
CronJobsStatus["FAILED"] = "failed";
|
|
8
|
+
CronJobsStatus["SUCCESS"] = "success";
|
|
9
|
+
})(CronJobsStatus || (exports.CronJobsStatus = CronJobsStatus = {}));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare enum BookingPaymentTransactionType {
|
|
2
|
+
CUSTOMER_PAYMENT = "customer_payment",
|
|
3
|
+
CUSTOMER_REFUND = "customer_refund",
|
|
4
|
+
CUSTOMER_REFUND_INPROCESS = "customer_refund_inprocess",
|
|
5
|
+
CUSTOMER_REFUND_REJECT = "customer_refund_reject",
|
|
6
|
+
CUSTOMER_CANCELLATION = "customer_cancellation"
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BookingPaymentTransactionType = void 0;
|
|
4
|
+
var BookingPaymentTransactionType;
|
|
5
|
+
(function (BookingPaymentTransactionType) {
|
|
6
|
+
BookingPaymentTransactionType["CUSTOMER_PAYMENT"] = "customer_payment";
|
|
7
|
+
BookingPaymentTransactionType["CUSTOMER_REFUND"] = "customer_refund";
|
|
8
|
+
BookingPaymentTransactionType["CUSTOMER_REFUND_INPROCESS"] = "customer_refund_inprocess";
|
|
9
|
+
BookingPaymentTransactionType["CUSTOMER_REFUND_REJECT"] = "customer_refund_reject";
|
|
10
|
+
BookingPaymentTransactionType["CUSTOMER_CANCELLATION"] = "customer_cancellation";
|
|
11
|
+
})(BookingPaymentTransactionType || (exports.BookingPaymentTransactionType = BookingPaymentTransactionType = {}));
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { PaymentMode } from "../enums/payment-mode.enum";
|
|
2
|
+
import { BookingPaymentTransactionType } from "../enums/transaction-type.enum";
|
|
3
|
+
import { IDateWisePaymentHistoryData } from "../types/date-wise-payment-history-data.types";
|
|
4
|
+
import { IBookingPaymentHistoryEntity } from "../types/entity/booking-payment-history-entity.type";
|
|
5
|
+
export declare class BookingPaymentHistoryModel implements IBookingPaymentHistoryEntity {
|
|
6
|
+
id: number;
|
|
7
|
+
bookingDetailsId: number;
|
|
8
|
+
turfId: number;
|
|
9
|
+
pitchId: number;
|
|
10
|
+
type: PaymentMode | null;
|
|
11
|
+
transactionType: BookingPaymentTransactionType;
|
|
12
|
+
amount: number;
|
|
13
|
+
bookingHistoryId: number;
|
|
14
|
+
createdOn: Date;
|
|
15
|
+
updatedOn: Date;
|
|
16
|
+
createdBy: number;
|
|
17
|
+
updatedBy: number;
|
|
18
|
+
constructor(data: IBookingPaymentHistoryEntity);
|
|
19
|
+
static dateCodeAndTurfIdWiseData(bookingPaymentHistoryEntities: IBookingPaymentHistoryEntity[]): IDateWisePaymentHistoryData;
|
|
20
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BookingPaymentHistoryModel = void 0;
|
|
4
|
+
var payment_mode_enum_1 = require("../enums/payment-mode.enum");
|
|
5
|
+
var booking_code_model_1 = require("./booking-code-model");
|
|
6
|
+
var BookingPaymentHistoryModel = /** @class */ (function () {
|
|
7
|
+
function BookingPaymentHistoryModel(data) {
|
|
8
|
+
Object.assign(this, data);
|
|
9
|
+
}
|
|
10
|
+
BookingPaymentHistoryModel.dateCodeAndTurfIdWiseData = function (bookingPaymentHistoryEntities) {
|
|
11
|
+
var dateWisePaymentHistoryData = {};
|
|
12
|
+
for (var _i = 0, bookingPaymentHistoryEntities_1 = bookingPaymentHistoryEntities; _i < bookingPaymentHistoryEntities_1.length; _i++) {
|
|
13
|
+
var bookingPaymentHistoryEntity = bookingPaymentHistoryEntities_1[_i];
|
|
14
|
+
var turfId = bookingPaymentHistoryEntity.turfId, amount = bookingPaymentHistoryEntity.amount, type = bookingPaymentHistoryEntity.type, createdOn = bookingPaymentHistoryEntity.createdOn;
|
|
15
|
+
var dateCode = booking_code_model_1.BookingCode.getDateCode(createdOn);
|
|
16
|
+
if (!dateWisePaymentHistoryData[dateCode])
|
|
17
|
+
dateWisePaymentHistoryData[dateCode] = {};
|
|
18
|
+
var turfWisePaymentData = dateWisePaymentHistoryData[dateCode][turfId];
|
|
19
|
+
if (!turfWisePaymentData)
|
|
20
|
+
turfWisePaymentData = dateWisePaymentHistoryData[dateCode][turfId] = {
|
|
21
|
+
cashTotal: 0,
|
|
22
|
+
upiTotal: 0,
|
|
23
|
+
total: 0,
|
|
24
|
+
};
|
|
25
|
+
if (type === payment_mode_enum_1.PaymentMode.CASH)
|
|
26
|
+
turfWisePaymentData.cashTotal += amount;
|
|
27
|
+
else if (type === payment_mode_enum_1.PaymentMode.UPI)
|
|
28
|
+
turfWisePaymentData.upiTotal += amount;
|
|
29
|
+
turfWisePaymentData.total =
|
|
30
|
+
turfWisePaymentData.cashTotal + turfWisePaymentData.upiTotal;
|
|
31
|
+
}
|
|
32
|
+
return dateWisePaymentHistoryData;
|
|
33
|
+
};
|
|
34
|
+
return BookingPaymentHistoryModel;
|
|
35
|
+
}());
|
|
36
|
+
exports.BookingPaymentHistoryModel = BookingPaymentHistoryModel;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ConfigurationKey } from "../enums/configuration-key.enum";
|
|
2
|
+
import { IConfigurationsModel } from "../interface/configuration-model.interface";
|
|
3
|
+
import { IConfigurationsEntity } from "../types/entity/configurations-entity.type";
|
|
4
|
+
export declare class ConfigurationsModel implements IConfigurationsModel {
|
|
5
|
+
id: number;
|
|
6
|
+
key: ConfigurationKey;
|
|
7
|
+
value: string;
|
|
8
|
+
description: string;
|
|
9
|
+
createdOn: Date;
|
|
10
|
+
updatedOn: Date;
|
|
11
|
+
createdBy: number;
|
|
12
|
+
updatedBy: number;
|
|
13
|
+
constructor(data: IConfigurationsEntity);
|
|
14
|
+
isCronJobKey(): boolean;
|
|
15
|
+
static findByKey(configurationEntities: IConfigurationsEntity[], key: ConfigurationKey): IConfigurationsEntity | undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationsModel = void 0;
|
|
4
|
+
var configuration_key_enum_1 = require("../enums/configuration-key.enum");
|
|
5
|
+
var ConfigurationsModel = /** @class */ (function () {
|
|
6
|
+
function ConfigurationsModel(data) {
|
|
7
|
+
Object.assign(this, data);
|
|
8
|
+
}
|
|
9
|
+
ConfigurationsModel.prototype.isCronJobKey = function () {
|
|
10
|
+
return configuration_key_enum_1.ConfigurationKey.CronJobsConfigurationsKeys(this.key);
|
|
11
|
+
};
|
|
12
|
+
ConfigurationsModel.findByKey = function (configurationEntities, key) {
|
|
13
|
+
return configurationEntities.find(function (configurationEntity) { return configurationEntity.key === key; });
|
|
14
|
+
};
|
|
15
|
+
return ConfigurationsModel;
|
|
16
|
+
}());
|
|
17
|
+
exports.ConfigurationsModel = ConfigurationsModel;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PaymentMode } from "../../enums/payment-mode.enum";
|
|
2
|
+
import { BookingPaymentTransactionType } from "../../enums/transaction-type.enum";
|
|
3
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
4
|
+
export interface IBookingPaymentHistoryEntity extends IEntityAuditColumn {
|
|
5
|
+
id: number;
|
|
6
|
+
bookingDetailsId: number;
|
|
7
|
+
turfId: number;
|
|
8
|
+
pitchId: number;
|
|
9
|
+
type: PaymentMode | null;
|
|
10
|
+
transactionType: BookingPaymentTransactionType;
|
|
11
|
+
amount: number;
|
|
12
|
+
bookingHistoryId: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ConfigurationKey } from "../../enums/configuration-key.enum";
|
|
2
|
+
import { IEntityAuditColumn } from "./entity-audit-column.type";
|
|
3
|
+
export interface IConfigurationsEntity extends IEntityAuditColumn {
|
|
4
|
+
id: number;
|
|
5
|
+
key: ConfigurationKey;
|
|
6
|
+
value: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CronJobsNames } from '../../enums/cron-jobs-name.enum';
|
|
2
|
+
import { CronJobsStatus } from '../../enums/cron-jobs-status.enum';
|
|
3
|
+
export interface ICronJobsEntity {
|
|
4
|
+
id: number;
|
|
5
|
+
job: CronJobsNames;
|
|
6
|
+
startTime: Date;
|
|
7
|
+
endTime: Date;
|
|
8
|
+
message: string;
|
|
9
|
+
error: string;
|
|
10
|
+
data: string;
|
|
11
|
+
status: CronJobsStatus;
|
|
12
|
+
}
|