@konplit-services/common 1.0.179 → 1.0.181
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/events/qrpayments-events/interfaces/index.d.ts +5 -0
- package/build/events/qrpayments-events/interfaces/index.js +5 -0
- package/build/events/qrpayments-events/interfaces/qr-dynamic-code-cancelled.interface.d.ts +10 -0
- package/build/events/qrpayments-events/interfaces/qr-dynamic-code-cancelled.interface.js +2 -0
- package/build/events/qrpayments-events/interfaces/qr-dynamic-code-created.interface.d.ts +14 -0
- package/build/events/qrpayments-events/interfaces/qr-dynamic-code-created.interface.js +2 -0
- package/build/events/qrpayments-events/interfaces/qr-query-order-status.interfce.d.ts +10 -0
- package/build/events/qrpayments-events/interfaces/qr-query-order-status.interfce.js +2 -0
- package/build/events/qrpayments-events/interfaces/qr-query-status-delay-coplete.interface.d.ts +11 -0
- package/build/events/qrpayments-events/interfaces/qr-query-status-delay-coplete.interface.js +2 -0
- package/build/events/qrpayments-events/interfaces/qr-query-status-delay.interface.d.ts +12 -0
- package/build/events/qrpayments-events/interfaces/qr-query-status-delay.interface.js +2 -0
- package/build/events/subjects.d.ts +6 -1
- package/build/events/subjects.js +7 -0
- package/build/helper/custom-paginate.js +5 -3
- package/build/helper/date-processing.d.ts +14 -0
- package/build/helper/date-processing.js +52 -5
- package/package.json +1 -1
|
@@ -1 +1,6 @@
|
|
|
1
1
|
export * from "./get-nibss-institutions.interface";
|
|
2
|
+
export * from "./qr-dynamic-code-cancelled.interface";
|
|
3
|
+
export * from "./qr-dynamic-code-created.interface";
|
|
4
|
+
export * from "./qr-query-order-status.interfce";
|
|
5
|
+
export * from "./qr-query-status-delay-coplete.interface";
|
|
6
|
+
export * from "./qr-query-status-delay.interface";
|
|
@@ -15,3 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./get-nibss-institutions.interface"), exports);
|
|
18
|
+
__exportStar(require("./qr-dynamic-code-cancelled.interface"), exports);
|
|
19
|
+
__exportStar(require("./qr-dynamic-code-created.interface"), exports);
|
|
20
|
+
__exportStar(require("./qr-query-order-status.interfce"), exports);
|
|
21
|
+
__exportStar(require("./qr-query-status-delay-coplete.interface"), exports);
|
|
22
|
+
__exportStar(require("./qr-query-status-delay.interface"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface QRDynamicCodeCancelledEvent {
|
|
3
|
+
subject: Subjects.QRDynamicCodeCancelled;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
transactionId: string;
|
|
8
|
+
merchantId: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ResSubjects } from "../../subjects";
|
|
2
|
+
export interface QRDynamicCodedCreatedEvent {
|
|
3
|
+
subject: ResSubjects.QRDynamicCodeCreated;
|
|
4
|
+
data: {
|
|
5
|
+
transactionId: string;
|
|
6
|
+
merchantId: string;
|
|
7
|
+
amount: number;
|
|
8
|
+
status: string;
|
|
9
|
+
charges: number;
|
|
10
|
+
orderNo?: string;
|
|
11
|
+
orderSn?: string;
|
|
12
|
+
transactionDate: Date;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface QRQueryOrderStatusEvent {
|
|
3
|
+
subject: Subjects.QRQueryOrderStatus;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
transactionId: string;
|
|
8
|
+
merchantId: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
package/build/events/qrpayments-events/interfaces/qr-query-status-delay-coplete.interface.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface QueryStatusDelayCompletedEvent {
|
|
3
|
+
subject: Subjects.KeysUpdatedComplete;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
transactionId: string;
|
|
8
|
+
orderNo: string;
|
|
9
|
+
orderSn?: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface QueryStatusDelayEvent {
|
|
3
|
+
subject: Subjects.KeysUpdatedComplete;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
transactionId: string;
|
|
8
|
+
orderNo: string;
|
|
9
|
+
orderSn: string;
|
|
10
|
+
delay: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -58,6 +58,10 @@ export declare enum Subjects {
|
|
|
58
58
|
TransactionProcessing = "events.transaction.processing",
|
|
59
59
|
TransactionCancelled = "events.transaction.cancelled",
|
|
60
60
|
TransactionDeclined = "events.transaction.declined",
|
|
61
|
+
QRDynamicCodeCancelled = "events.qrdynamiccode.cancelled",
|
|
62
|
+
QRQueryOrderStatus = "events.qrqueryorder.status",
|
|
63
|
+
QRQueryStatusDelay = "events.qrqueryorder.delay",
|
|
64
|
+
QRQueryStatusComplete = "events.qrqueryorder.complete",
|
|
61
65
|
VirtualFixedAccountCreatedEvent = "events.virtualfixedaccount.created"
|
|
62
66
|
}
|
|
63
67
|
export declare enum ResSubjects {
|
|
@@ -65,5 +69,6 @@ export declare enum ResSubjects {
|
|
|
65
69
|
BankListCreated = "res.bank.list.created",
|
|
66
70
|
BankAccountNameCreated = "res.bank.account.name.created",
|
|
67
71
|
MonoInitiationTransaction = "res.mono.initiation",
|
|
68
|
-
NIBSSInstitutions = "res.nibss.institution.list"
|
|
72
|
+
NIBSSInstitutions = "res.nibss.institution.list",
|
|
73
|
+
QRDynamicCodeCreated = "res.dynamic.code.created"
|
|
69
74
|
}
|
package/build/events/subjects.js
CHANGED
|
@@ -80,6 +80,12 @@ var Subjects;
|
|
|
80
80
|
Subjects["TransactionProcessing"] = "events.transaction.processing";
|
|
81
81
|
Subjects["TransactionCancelled"] = "events.transaction.cancelled";
|
|
82
82
|
Subjects["TransactionDeclined"] = "events.transaction.declined";
|
|
83
|
+
//NIBSS
|
|
84
|
+
//QRCODE
|
|
85
|
+
Subjects["QRDynamicCodeCancelled"] = "events.qrdynamiccode.cancelled";
|
|
86
|
+
Subjects["QRQueryOrderStatus"] = "events.qrqueryorder.status";
|
|
87
|
+
Subjects["QRQueryStatusDelay"] = "events.qrqueryorder.delay";
|
|
88
|
+
Subjects["QRQueryStatusComplete"] = "events.qrqueryorder.complete";
|
|
83
89
|
//Virtual Fixed Account
|
|
84
90
|
Subjects["VirtualFixedAccountCreatedEvent"] = "events.virtualfixedaccount.created";
|
|
85
91
|
})(Subjects = exports.Subjects || (exports.Subjects = {}));
|
|
@@ -94,4 +100,5 @@ var ResSubjects;
|
|
|
94
100
|
ResSubjects["MonoInitiationTransaction"] = "res.mono.initiation";
|
|
95
101
|
//NIBSS
|
|
96
102
|
ResSubjects["NIBSSInstitutions"] = "res.nibss.institution.list";
|
|
103
|
+
ResSubjects["QRDynamicCodeCreated"] = "res.dynamic.code.created";
|
|
97
104
|
})(ResSubjects = exports.ResSubjects || (exports.ResSubjects = {}));
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.generateQueryObject = exports.paginate = void 0;
|
|
13
|
+
const date_processing_1 = require("./date-processing");
|
|
13
14
|
function paginate(model, options = {}) {
|
|
14
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
16
|
const page = options.page || 1;
|
|
@@ -95,14 +96,15 @@ const generateQueryObject = (filters, searchesFieldNames = [], select = "", popu
|
|
|
95
96
|
query.status = status;
|
|
96
97
|
}
|
|
97
98
|
if (filters.from && filters.to) {
|
|
99
|
+
const date = (0, date_processing_1.convertDateToUTCRange)(filters.from, filters.to);
|
|
98
100
|
query.createdAt = {
|
|
99
|
-
$gte:
|
|
100
|
-
$lte:
|
|
101
|
+
$gte: date.startUTC,
|
|
102
|
+
$lte: date.endUTC,
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
105
|
else if (filters.from) {
|
|
104
106
|
query.createdAt = {
|
|
105
|
-
$gte:
|
|
107
|
+
$gte: (0, date_processing_1.convertDateToUTC)(filters.from),
|
|
106
108
|
};
|
|
107
109
|
}
|
|
108
110
|
if (filters.sort_by && filters.order) {
|
|
@@ -6,6 +6,20 @@ export declare const getPreviousDayRange: () => {
|
|
|
6
6
|
startOfPreviousDay: Date;
|
|
7
7
|
endOfPreviousDay: Date;
|
|
8
8
|
};
|
|
9
|
+
export declare const getCurrentDayRange: () => {
|
|
10
|
+
startOfCurrentDay: Date;
|
|
11
|
+
endOfCurrentDay: Date;
|
|
12
|
+
};
|
|
13
|
+
export declare const convertDateToUTCRangeString: (startDateTime: string, endDateTime: string) => {
|
|
14
|
+
startUTC: string;
|
|
15
|
+
endUTC: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const convertDateToUTCRange: (startDateTime: string, endDateTime: string) => {
|
|
18
|
+
startUTC: Date;
|
|
19
|
+
endUTC: Date;
|
|
20
|
+
};
|
|
21
|
+
export declare const convertDateToUTCString: (startTime: string) => string;
|
|
22
|
+
export declare const convertDateToUTC: (startTime: string) => Date;
|
|
9
23
|
type PlanInterval = keyof typeof PLAN_INTERVAL;
|
|
10
24
|
export declare const getDuration: (duration: PlanInterval) => number;
|
|
11
25
|
export {};
|
|
@@ -3,8 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDuration = exports.getPreviousDayRange = exports.convertToDate = exports.formatDateTime = exports.formatDate = void 0;
|
|
6
|
+
exports.getDuration = exports.convertDateToUTC = exports.convertDateToUTCString = exports.convertDateToUTCRange = exports.convertDateToUTCRangeString = exports.getCurrentDayRange = exports.getPreviousDayRange = exports.convertToDate = exports.formatDateTime = exports.formatDate = void 0;
|
|
7
7
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
|
+
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
9
|
+
// Extend dayjs with the UTC plugin
|
|
10
|
+
dayjs_1.default.extend(utc_1.default);
|
|
8
11
|
const plan_types_1 = require("./plan-types");
|
|
9
12
|
const formatDate = (dataString) => {
|
|
10
13
|
return (0, dayjs_1.default)(dataString).format("YYYY-MM-DD");
|
|
@@ -19,13 +22,57 @@ const convertToDate = (date) => {
|
|
|
19
22
|
};
|
|
20
23
|
exports.convertToDate = convertToDate;
|
|
21
24
|
const getPreviousDayRange = () => {
|
|
22
|
-
// Get the start of the previous day (00:00:00)
|
|
23
|
-
const startOfPreviousDay =
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
// Get the start of the previous day in UTC (00:00:00)
|
|
26
|
+
const startOfPreviousDay = dayjs_1.default
|
|
27
|
+
.utc()
|
|
28
|
+
.subtract(1, "day")
|
|
29
|
+
.startOf("day")
|
|
30
|
+
.toDate();
|
|
31
|
+
// Get the end of the previous day in UTC (23:59:59.999)
|
|
32
|
+
const endOfPreviousDay = dayjs_1.default.utc().subtract(1, "day").endOf("day").toDate();
|
|
26
33
|
return { startOfPreviousDay, endOfPreviousDay };
|
|
27
34
|
};
|
|
28
35
|
exports.getPreviousDayRange = getPreviousDayRange;
|
|
36
|
+
const getCurrentDayRange = () => {
|
|
37
|
+
// Get the start of the previous day in UTC (00:00:00)
|
|
38
|
+
const startOfCurrentDay = dayjs_1.default.utc().startOf("day").toDate();
|
|
39
|
+
// Get the end of the previous day in UTC (23:59:59.999)
|
|
40
|
+
const endOfCurrentDay = dayjs_1.default.utc().endOf("day").toDate();
|
|
41
|
+
return { startOfCurrentDay, endOfCurrentDay };
|
|
42
|
+
};
|
|
43
|
+
exports.getCurrentDayRange = getCurrentDayRange;
|
|
44
|
+
const convertDateToUTCRangeString = (startDateTime, endDateTime) => {
|
|
45
|
+
// Get the start of the previous day in UTC (00:00:00)
|
|
46
|
+
const startTime = (0, dayjs_1.default)(`${startDateTime}`, "YYYY-MM-DD HH:mm");
|
|
47
|
+
const endTime = (0, dayjs_1.default)(`${endDateTime}`, "YYYY-MM-DD HH:mm");
|
|
48
|
+
const startUTC = startTime.utc().format();
|
|
49
|
+
const endUTC = endTime.utc().format();
|
|
50
|
+
return { startUTC, endUTC };
|
|
51
|
+
};
|
|
52
|
+
exports.convertDateToUTCRangeString = convertDateToUTCRangeString;
|
|
53
|
+
const convertDateToUTCRange = (startDateTime, endDateTime) => {
|
|
54
|
+
// Get the start of the previous day in UTC (00:00:00)
|
|
55
|
+
const startTime = (0, dayjs_1.default)(`${startDateTime}`, "YYYY-MM-DD HH:mm");
|
|
56
|
+
const endTime = (0, dayjs_1.default)(`${endDateTime}`, "YYYY-MM-DD HH:mm");
|
|
57
|
+
const startUTC = startTime.utc().toDate();
|
|
58
|
+
const endUTC = endTime.utc().toDate();
|
|
59
|
+
return { startUTC, endUTC };
|
|
60
|
+
};
|
|
61
|
+
exports.convertDateToUTCRange = convertDateToUTCRange;
|
|
62
|
+
const convertDateToUTCString = (startTime) => {
|
|
63
|
+
// Get the start of the previous day in UTC (00:00:00)
|
|
64
|
+
const date = (0, dayjs_1.default)(`${startTime}`, "YYYY-MM-DD HH:mm");
|
|
65
|
+
const DateInUTC = date.utc().format();
|
|
66
|
+
return DateInUTC;
|
|
67
|
+
};
|
|
68
|
+
exports.convertDateToUTCString = convertDateToUTCString;
|
|
69
|
+
const convertDateToUTC = (startTime) => {
|
|
70
|
+
// Get the start of the previous day in UTC (00:00:00)
|
|
71
|
+
const date = (0, dayjs_1.default)(`${startTime}`, "YYYY-MM-DD HH:mm");
|
|
72
|
+
const DateInUTC = date.utc().toDate();
|
|
73
|
+
return DateInUTC;
|
|
74
|
+
};
|
|
75
|
+
exports.convertDateToUTC = convertDateToUTC;
|
|
29
76
|
const getDuration = (duration) => {
|
|
30
77
|
const currentDate = (0, dayjs_1.default)();
|
|
31
78
|
switch (duration) {
|