@konplit-services/common 1.0.251 → 1.0.253

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.
@@ -146,6 +146,12 @@ declare class AppConfigs {
146
146
  access_in: string;
147
147
  };
148
148
  getAPIPrivateKey(): string;
149
+ getEmailVendor(): string;
150
+ getZeptoMailAPIKey(): string;
151
+ getPlatFormName(): string;
152
+ getNoReplyMail(): string;
153
+ getBCCMail(): string;
154
+ getWebAppUrl(): string;
149
155
  getRedisHost(): {
150
156
  url: string;
151
157
  host: string;
@@ -193,6 +193,39 @@ class AppConfigs {
193
193
  }
194
194
  return this.env.API_PRIVATE_KEY;
195
195
  }
196
+ getEmailVendor() {
197
+ if (!this.env.EMAIL_VENDOR) {
198
+ throw new Error("EMAIL_VENDOR is required");
199
+ }
200
+ return this.env.EMAIL_VENDOR;
201
+ }
202
+ getZeptoMailAPIKey() {
203
+ if (!this.env.ZEPTOMAIL_KEY) {
204
+ throw new Error("ZEPTOMAIL_KEY is required");
205
+ }
206
+ return this.env.ZEPTOMAIL_KEY;
207
+ }
208
+ getPlatFormName() {
209
+ return this.getAppName();
210
+ }
211
+ getNoReplyMail() {
212
+ if (!this.env.NO_REPLY_EMAIL) {
213
+ throw new Error("NO_REPLY_EMAIL is required");
214
+ }
215
+ return this.env.NO_REPLY_EMAIL;
216
+ }
217
+ getBCCMail() {
218
+ if (!this.env.BCC_EMAIL) {
219
+ throw new Error("BCC_EMAIL is required");
220
+ }
221
+ return this.env.BCC_EMAIL;
222
+ }
223
+ getWebAppUrl() {
224
+ if (!this.env.WEB_URL) {
225
+ throw new Error("WEB_URL is required");
226
+ }
227
+ return this.env.WEB_URL;
228
+ }
196
229
  getRedisHost() {
197
230
  if (!this.env.REDIS_URL) {
198
231
  throw new Error("REDIS_URL is required");
@@ -9,5 +9,9 @@ export * from "./recipient-validation.interface";
9
9
  export * from "./recipient-webhook.interface";
10
10
  export * from "./reserve-fund-update.interface";
11
11
  export * from "./transfer-created";
12
+ export * from "./transfer-otp-timer-completed.interface";
13
+ export * from "./transfer-otp-timer-created.interface";
14
+ export * from "./transfer-url-completed.interface";
15
+ export * from "./transfer-url-created.interface";
12
16
  export * from "./start-batch-transfer-process.interface";
13
17
  export * from "./start-transfer-process.interface";
@@ -25,5 +25,9 @@ __exportStar(require("./recipient-validation.interface"), exports);
25
25
  __exportStar(require("./recipient-webhook.interface"), exports);
26
26
  __exportStar(require("./reserve-fund-update.interface"), exports);
27
27
  __exportStar(require("./transfer-created"), exports);
28
+ __exportStar(require("./transfer-otp-timer-completed.interface"), exports);
29
+ __exportStar(require("./transfer-otp-timer-created.interface"), exports);
30
+ __exportStar(require("./transfer-url-completed.interface"), exports);
31
+ __exportStar(require("./transfer-url-created.interface"), exports);
28
32
  __exportStar(require("./start-batch-transfer-process.interface"), exports);
29
33
  __exportStar(require("./start-transfer-process.interface"), exports);
@@ -0,0 +1,12 @@
1
+ import { Usage } from "../../../helper";
2
+ import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
+ export interface TransferOptTimerCompletedEvent {
4
+ subject: Subjects.EASYPAY_TRANSFER_OTP_COMPLETED;
5
+ streamName: StreamName.name;
6
+ streamEvents: StreamEvent.Event;
7
+ data: {
8
+ merchantId: string;
9
+ transferId: string;
10
+ usage: Usage;
11
+ };
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,13 @@
1
+ import { Usage } from "../../../helper";
2
+ import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
+ export interface TransferOptTimerCreatedEvent {
4
+ subject: Subjects.EASYPAY_TRANSFER_OTP_CREATED;
5
+ streamName: StreamName.name;
6
+ streamEvents: StreamEvent.Event;
7
+ data: {
8
+ merchantId: string;
9
+ transferId: string;
10
+ usage: Usage;
11
+ duration: number;
12
+ };
13
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,12 @@
1
+ import { Usage } from "../../../helper";
2
+ import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
+ export interface TransferUrlAuthCompletedEvent {
4
+ subject: Subjects.EASYPAY_TRANSFER_URL_COMPLETED;
5
+ streamName: StreamName.name;
6
+ streamEvents: StreamEvent.Event;
7
+ data: {
8
+ merchantId: string;
9
+ transferId: string;
10
+ usage: Usage;
11
+ };
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,14 @@
1
+ import { Usage } from "../../../helper";
2
+ import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
+ export interface TransferUrlAuthCreatedEvent {
4
+ subject: Subjects.EASYPAY_TRANSFER_URL_CREATED;
5
+ streamName: StreamName.name;
6
+ streamEvents: StreamEvent.Event;
7
+ data: {
8
+ merchantId: string;
9
+ transferId: string;
10
+ url: string;
11
+ encrytionKey: string;
12
+ usage: Usage;
13
+ };
14
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -74,6 +74,10 @@ export declare enum Subjects {
74
74
  CardTransactionStatus = "events.card.transaction.status",
75
75
  EASYPAY_SCHEDULED_TRANSFER = "events.scheduled.transfer.created",
76
76
  EASYPAY_SCHEDULED_TRANSFER_COMPLETED = "events.scheduled.transfer.completed",
77
+ EASYPAY_TRANSFER_OTP_CREATED = "events.tranfer.otp.created",
78
+ EASYPAY_TRANSFER_OTP_COMPLETED = "events..tranfer.otp.completed",
79
+ EASYPAY_TRANSFER_URL_CREATED = "events.tranfer.url.created",
80
+ EASYPAY_TRANSFER_URL_COMPLETED = "events..tranfer.url.completed",
77
81
  EASYPAY_START_TRANSFER_PROCESS = "events.start.transfer.process",
78
82
  EASYPAY_START_BATCH_TRANSFER_PROCESS = "events.start.batch.transfer.process",
79
83
  EASYPAY_RESERVED_FUND_CREATED = "events.reserved.fund.created",
@@ -104,6 +104,10 @@ var Subjects;
104
104
  //EASYPAY
105
105
  Subjects["EASYPAY_SCHEDULED_TRANSFER"] = "events.scheduled.transfer.created";
106
106
  Subjects["EASYPAY_SCHEDULED_TRANSFER_COMPLETED"] = "events.scheduled.transfer.completed";
107
+ Subjects["EASYPAY_TRANSFER_OTP_CREATED"] = "events.tranfer.otp.created";
108
+ Subjects["EASYPAY_TRANSFER_OTP_COMPLETED"] = "events..tranfer.otp.completed";
109
+ Subjects["EASYPAY_TRANSFER_URL_CREATED"] = "events.tranfer.url.created";
110
+ Subjects["EASYPAY_TRANSFER_URL_COMPLETED"] = "events..tranfer.url.completed";
107
111
  Subjects["EASYPAY_START_TRANSFER_PROCESS"] = "events.start.transfer.process";
108
112
  Subjects["EASYPAY_START_BATCH_TRANSFER_PROCESS"] = "events.start.batch.transfer.process";
109
113
  Subjects["EASYPAY_RESERVED_FUND_CREATED"] = "events.reserved.fund.created";
@@ -5,7 +5,7 @@ const phoneValidation = (token) => `Your OTP is ${token}. Use this code to compl
5
5
  exports.phoneValidation = phoneValidation;
6
6
  const twoFactor = (token) => `Your OTP is ${token}. Use this code to complete your 2fa verification. This code is valid for 15 minutes. Do not share it with anyone.`;
7
7
  exports.twoFactor = twoFactor;
8
- const transfer = (token) => `Your OTP is ${token}. Use this code to complete your transfer process. This code is valid for 15 minutes. Do not share it with anyone.`;
8
+ const transfer = (token) => `Your OTP is ${token}. Use this code to complete your transfer process. This code is valid for 30 minutes. Do not share it with anyone.`;
9
9
  exports.transfer = transfer;
10
10
  var SMSTYPE;
11
11
  (function (SMSTYPE) {
@@ -1,6 +1,8 @@
1
1
  export declare const REDIS_REPOSITORY = "RedisRepository";
2
2
  export declare const setVerificationCode: (email: string) => string;
3
3
  export declare const getVerificationCode: (email: string) => string;
4
+ export declare const setTransferCode: (id: string, code: string) => string;
5
+ export declare const getTransferCode: (id: string, code: string) => string;
4
6
  export declare const getPermissions: (id: string) => string;
5
7
  export declare const setPermissions: (id: string) => string;
6
8
  export declare const checkRevokedToken: (id: string, token: string) => string;
@@ -1,11 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setTransferToken = exports.checkTransferToken = exports.setsetRevokedToken = exports.checkRevokedToken = exports.setPermissions = exports.getPermissions = exports.getVerificationCode = exports.setVerificationCode = exports.REDIS_REPOSITORY = void 0;
3
+ exports.setTransferToken = exports.checkTransferToken = exports.setsetRevokedToken = exports.checkRevokedToken = exports.setPermissions = exports.getPermissions = exports.getTransferCode = exports.setTransferCode = exports.getVerificationCode = exports.setVerificationCode = exports.REDIS_REPOSITORY = void 0;
4
4
  exports.REDIS_REPOSITORY = "RedisRepository";
5
5
  const setVerificationCode = (email) => `${email}-verification`;
6
6
  exports.setVerificationCode = setVerificationCode;
7
7
  const getVerificationCode = (email) => `${email}-verification`;
8
8
  exports.getVerificationCode = getVerificationCode;
9
+ const setTransferCode = (id, code) => `${id}-${code}-transfer`;
10
+ exports.setTransferCode = setTransferCode;
11
+ const getTransferCode = (id, code) => `${id}-${code}-transfer`;
12
+ exports.getTransferCode = getTransferCode;
9
13
  const getPermissions = (id) => `${id}-permission`;
10
14
  exports.getPermissions = getPermissions;
11
15
  const setPermissions = (id) => `${id}-permission`;
@@ -3,6 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatPhoneNumber = void 0;
4
4
  //TODO: this endpoint does not format to only Nigerian phone numbers
5
5
  const formatPhoneNumber = (value) => {
6
- return `${value.substring(1)}`;
6
+ let phone = "";
7
+ if (value.length === 13) {
8
+ phone = value;
9
+ }
10
+ else if (value.length === 14) {
11
+ phone = value.substring(1);
12
+ }
13
+ if (value.startsWith("0")) {
14
+ return `234${value.substring(1)}`;
15
+ }
16
+ return phone;
7
17
  };
8
18
  exports.formatPhoneNumber = formatPhoneNumber;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.251",
3
+ "version": "1.0.253",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",