@konplit-services/common 1.0.354 → 1.0.356

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.
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
25
28
  Object.defineProperty(exports, "__esModule", { value: true });
26
29
  exports.generateTimestampUUIDShort = exports.generateOpaySign = exports.generateTransactionID = exports.generateBase64KeyNibssBVN = exports.generateSignatureCipher = exports.generateBase64Key = exports.generateOrderId = exports.authData = exports.generateSignMD5Fedilty = exports.generateSignMD5 = exports.hashingKey = exports.generateMAC = void 0;
27
30
  const crypto_1 = __importStar(require("crypto"));
@@ -29,6 +32,11 @@ const forge = __importStar(require("node-forge"));
29
32
  const timestamp_1 = require("./timestamp");
30
33
  const app_configs_1 = require("../app.configs");
31
34
  const nanoid_1 = require("nanoid");
35
+ const dayjs_1 = __importDefault(require("dayjs"));
36
+ const utc_1 = __importDefault(require("dayjs/plugin/utc"));
37
+ const timezone_1 = __importDefault(require("dayjs/plugin/timezone"));
38
+ dayjs_1.default.extend(utc_1.default);
39
+ dayjs_1.default.extend(timezone_1.default);
32
40
  /**
33
41
  * Hashing a secret using sha256
34
42
  * @param secret - the secret to hash
@@ -159,13 +167,13 @@ exports.generateOrderId = generateOrderId;
159
167
  * @returns the generated transaction ID
160
168
  */
161
169
  const generateTransactionID = (clientCode) => {
162
- const now = new Date();
163
- const year = now.getFullYear().toString().slice(-2);
164
- const month = String(now.getMonth() + 1).padStart(2, "0");
165
- const day = String(now.getDate()).padStart(2, "0");
166
- const hours = String(now.getHours()).padStart(2, "0");
167
- const minutes = String(now.getMinutes()).padStart(2, "0");
168
- const seconds = String(now.getSeconds()).padStart(2, "0");
170
+ const now = (0, dayjs_1.default)().tz("Africa/Lagos"); // West Africa Time (UTC+1)
171
+ const year = now.format("YY");
172
+ const month = now.format("MM");
173
+ const day = now.format("DD");
174
+ const hours = now.format("HH");
175
+ const minutes = now.format("mm");
176
+ const seconds = now.format("ss");
169
177
  const random12Digits = Math.floor(100000000000 + Math.random() * 900000000000);
170
178
  return `${clientCode}${year}${month}${day}${hours}${minutes}${seconds}${random12Digits}`;
171
179
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.354",
3
+ "version": "1.0.356",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",
@@ -28,12 +28,12 @@
28
28
  "@types/node-forge": "^1.3.11",
29
29
  "@types/swagger-jsdoc": "^6.0.4",
30
30
  "@types/swagger-ui-express": "^4.1.6",
31
- "axios": "^1.7.2",
31
+ "axios": "^1.9.0",
32
32
  "dayjs": "^1.11.13",
33
33
  "express": "^4.18.1",
34
34
  "express-validator": "^6.14.2",
35
35
  "ioredis": "^5.4.1",
36
- "jsonwebtoken": "^8.5.1",
36
+ "jsonwebtoken": "^9.0.0",
37
37
  "mailersend": "^2.0.5",
38
38
  "mongoose": "^6.9.2",
39
39
  "morgan": "^1.10.0",