@konplit-services/common 1.5.0 → 1.7.0
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/app.configs.d.ts +1 -0
- package/build/app.configs.js +6 -0
- package/build/events/Settlements-events/interfaces/settlement-pay-merchant-created.interface.d.ts +1 -0
- package/build/events/Settlements-events/interfaces/settlement-pay-merchant-nibss-created.interface.d.ts +1 -0
- package/build/events/Settlements-events/interfaces/settlement-transfer-reserved-nibss.interface.d.ts +1 -0
- package/build/events/Settlements-events/interfaces/settlement-transfer-verify-nibss.interface.d.ts +1 -0
- package/build/events/Settlements-events/interfaces/settlement-transter-initiation.interface.d.ts +1 -0
- package/build/events/Settlements-events/interfaces/settlement-transter-reserved.interface.d.ts +1 -0
- package/build/events/Settlements-events/interfaces/settlement-updated.interface.d.ts +1 -0
- package/build/helper/date-processing.d.ts +2 -1
- package/build/helper/date-processing.js +14 -2
- package/build/notification/interfaces.d.ts +1 -0
- package/package.json +1 -1
package/build/app.configs.d.ts
CHANGED
package/build/app.configs.js
CHANGED
|
@@ -113,6 +113,12 @@ class AppConfigs {
|
|
|
113
113
|
}
|
|
114
114
|
return this.env.ADMIN_WEB_URL;
|
|
115
115
|
}
|
|
116
|
+
getClientAppUrl() {
|
|
117
|
+
if (!this.env.CLIENT_APP_URL) {
|
|
118
|
+
throw new Error("CLIENT_APP_URL is required");
|
|
119
|
+
}
|
|
120
|
+
return this.env.CLIENT_APP_URL;
|
|
121
|
+
}
|
|
116
122
|
getNATSURI() {
|
|
117
123
|
if (!this.env.NATS_URI) {
|
|
118
124
|
throw new Error("NATS_URI is required");
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PLAN_INTERVAL } from "./plan-types";
|
|
2
|
-
export declare const formatDate: (
|
|
2
|
+
export declare const formatDate: (dateInput: string | Date | number, // support more input types
|
|
3
|
+
format?: string, tz?: string) => string;
|
|
3
4
|
export declare const interswitchRefundDateFormat: (dataString: string) => string;
|
|
4
5
|
export declare const formatDateTime: (dataString: string) => string;
|
|
5
6
|
export declare const convertToDate: (date: string) => Date;
|
|
@@ -8,11 +8,23 @@ exports.canRefundFromSettlementLedgerByDay = canRefundFromSettlementLedgerByDay;
|
|
|
8
8
|
exports.getSettlementDate = getSettlementDate;
|
|
9
9
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
10
10
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
11
|
+
const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
|
|
11
12
|
// Extend dayjs with the UTC plugin
|
|
12
13
|
dayjs_1.default.extend(utc_1.default);
|
|
14
|
+
dayjs_1.default.extend(timezone_1.default);
|
|
15
|
+
const DEFAULT_TZ = "Africa/Lagos";
|
|
16
|
+
const DEFAULT_FORMAT = "YYYY-MM-DD";
|
|
13
17
|
const plan_types_1 = require("./plan-types");
|
|
14
|
-
const formatDate = (
|
|
15
|
-
|
|
18
|
+
const formatDate = (dateInput, // support more input types
|
|
19
|
+
format = DEFAULT_FORMAT, tz = DEFAULT_TZ) => {
|
|
20
|
+
if (!dateInput) {
|
|
21
|
+
return ""; // gracefully handle empty/null
|
|
22
|
+
}
|
|
23
|
+
const parsed = (0, dayjs_1.default)(dateInput);
|
|
24
|
+
if (!parsed.isValid()) {
|
|
25
|
+
throw new Error(`Invalid date: ${dateInput}`); // fail fast in prod
|
|
26
|
+
}
|
|
27
|
+
return parsed.tz(tz).format(format);
|
|
16
28
|
};
|
|
17
29
|
exports.formatDate = formatDate;
|
|
18
30
|
const interswitchRefundDateFormat = (dataString) => {
|
|
@@ -175,6 +175,7 @@ export interface TokenVerificationTemplateData extends EmailBase {
|
|
|
175
175
|
export interface MerchantInvitationTemplateData extends EmailBase {
|
|
176
176
|
merchant_name: string;
|
|
177
177
|
to: string;
|
|
178
|
+
url?: string;
|
|
178
179
|
}
|
|
179
180
|
export interface CustomerWelcomeTemplateData extends EmailBase {
|
|
180
181
|
first_name: string;
|