@konplit-services/common 1.0.154 → 1.0.156

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.
@@ -35,6 +35,12 @@ interface Interswitch {
35
35
  recurrent_client_id: string;
36
36
  recurrent_secret_key: string;
37
37
  }
38
+ interface InterswitchTransfer {
39
+ client_id: string;
40
+ secret_key: string;
41
+ access_token_url: string;
42
+ base_url: string;
43
+ }
38
44
  interface MessageQueue {
39
45
  sendMail: string;
40
46
  Payment: string;
@@ -89,6 +95,7 @@ declare class AppConfigs {
89
95
  getActivityLogDBURI(): string;
90
96
  getAccountDBURI(): string;
91
97
  getMerchantDBURI(): string;
98
+ getTransferDBURI(): string;
92
99
  getVirtualAccountDBURI(): string;
93
100
  getWalletDBURI(): string;
94
101
  getNATSURI(): string;
@@ -156,6 +163,7 @@ declare class AppConfigs {
156
163
  account_mode: string;
157
164
  };
158
165
  getInterswitchDetails(): Interswitch;
166
+ getInterswitchTransferDetails(): InterswitchTransfer;
159
167
  getMonoDetails(): {
160
168
  base_url: string;
161
169
  public_key: string;
@@ -41,6 +41,12 @@ class AppConfigs {
41
41
  }
42
42
  return this.env.MONGO_URI_MERCHANT;
43
43
  }
44
+ getTransferDBURI() {
45
+ if (!this.env.MONGO_URI_TRANSFER) {
46
+ throw new Error("MONGO_URI_TRANSFER is required");
47
+ }
48
+ return this.env.MONGO_URI_TRANSFER;
49
+ }
44
50
  getVirtualAccountDBURI() {
45
51
  if (!this.env.MONGO_URI_VIRTUAL_ACCOUNT) {
46
52
  throw new Error("MONGO_URI_VIRTUAL_ACCOUNT is required");
@@ -546,6 +552,28 @@ class AppConfigs {
546
552
  recurrent_secret_key: this.env.INTERSWITCH_RECURRENT_SECRET_KEY,
547
553
  };
548
554
  }
555
+ // Interswitch
556
+ getInterswitchTransferDetails() {
557
+ // Interswitch
558
+ if (!this.env.INTERSWITCH_TRANSFER_CLIENT_ID) {
559
+ throw new Error("INTERSWITCH_TRANSFER_CLIENT_ID is required");
560
+ }
561
+ if (!this.env.INTERSWITCH_TRANSFER_SECRET_KEY) {
562
+ throw new Error("INTERSWITCH_TRANSFER_SECRET_KEY is required");
563
+ }
564
+ if (!this.env.INTERSWITCH_ACCESS_TOKEN_URL) {
565
+ throw new Error("INTERSWITCH_ACCESS_TOKEN_URL is required");
566
+ }
567
+ if (!this.env.INTERSWITCH_BASE_URL) {
568
+ throw new Error("INTERSWITCH_BASE_URL is required");
569
+ }
570
+ return {
571
+ client_id: this.env.INTERSWITCH_TRANSFER_CLIENT_ID,
572
+ secret_key: this.env.INTERSWITCH_TRANSFER_SECRET_KEY,
573
+ access_token_url: this.env.INTERSWITCH_ACCESS_TOKEN_URL,
574
+ base_url: this.env.INTERSWITCH_BASE_URL,
575
+ };
576
+ }
549
577
  // MONO MOBILE MONEY
550
578
  getMonoDetails() {
551
579
  if (!this.env.MONO_BASE_URL) {
@@ -81,26 +81,33 @@ class Listener {
81
81
  });
82
82
  }
83
83
  listenForRequests() {
84
- var e_1, _a;
85
- var _b;
84
+ var _a, e_1, _b, _c;
85
+ var _d;
86
86
  return __awaiter(this, void 0, void 0, function* () {
87
- const subscription = (_b = this.nc) === null || _b === void 0 ? void 0 : _b.subscribe(this.subject);
87
+ const subscription = (_d = this.nc) === null || _d === void 0 ? void 0 : _d.subscribe(this.subject);
88
88
  try {
89
- for (var subscription_1 = __asyncValues(subscription), subscription_1_1; subscription_1_1 = yield subscription_1.next(), !subscription_1_1.done;) {
90
- const msg = subscription_1_1.value;
91
- // Decode the request data
92
- const decodedRequest = this.jc.decode(msg.data);
93
- console.log("Received Request:", decodedRequest);
94
- const response = yield this.onMessageResponse(decodedRequest, msg);
95
- console.log("Respons comming here", response);
96
- // Send a reply back
97
- msg.respond(this.jc.encode({ data: response }));
89
+ for (var _e = true, subscription_1 = __asyncValues(subscription), subscription_1_1; subscription_1_1 = yield subscription_1.next(), _a = subscription_1_1.done, !_a;) {
90
+ _c = subscription_1_1.value;
91
+ _e = false;
92
+ try {
93
+ const msg = _c;
94
+ // Decode the request data
95
+ const decodedRequest = this.jc.decode(msg.data);
96
+ console.log("Received Request:", decodedRequest);
97
+ const response = yield this.onMessageResponse(decodedRequest, msg);
98
+ console.log("Respons comming here", response);
99
+ // Send a reply back
100
+ msg.respond(this.jc.encode({ data: response }));
101
+ }
102
+ finally {
103
+ _e = true;
104
+ }
98
105
  }
99
106
  }
100
107
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
101
108
  finally {
102
109
  try {
103
- if (subscription_1_1 && !subscription_1_1.done && (_a = subscription_1.return)) yield _a.call(subscription_1);
110
+ if (!_e && !_a && (_b = subscription_1.return)) yield _b.call(subscription_1);
104
111
  }
105
112
  finally { if (e_1) throw e_1.error; }
106
113
  }
@@ -1,6 +1,6 @@
1
1
  import { Usage } from "../../../helper";
2
2
  import { StreamEvent, StreamName, Subjects } from "../../subjects";
3
- export declare type DurationTypes = "2hours" | "1day" | "now" | "2days" | "custom";
3
+ export type DurationTypes = "2hours" | "1day" | "now" | "2days" | "custom";
4
4
  export interface KeyUpdateTimerEvent {
5
5
  subject: Subjects.KeysUpdated;
6
6
  streamName: StreamName.name;
@@ -1,6 +1,6 @@
1
1
  import { PLAN_INTERVAL } from "./plan-types";
2
2
  export declare const formatDate: (dataString: string) => string;
3
3
  export declare const formatDateTime: (dataString: string) => string;
4
- declare type PlanInterval = keyof typeof PLAN_INTERVAL;
4
+ type PlanInterval = keyof typeof PLAN_INTERVAL;
5
5
  export declare const getDuration: (duration: PlanInterval) => number;
6
6
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konplit-services/common",
3
- "version": "1.0.154",
3
+ "version": "1.0.156",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",