@konplit-services/common 1.0.132 → 1.0.135
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/index.d.ts +1 -0
- package/build/events/index.js +1 -0
- package/build/events/subjects.d.ts +7 -1
- package/build/events/subjects.js +7 -0
- package/build/events/transaction/interfaces/index.d.ts +6 -0
- package/build/events/transaction/interfaces/index.js +22 -0
- package/build/events/transaction/interfaces/transaction-aborted.interface.d.ts +11 -0
- package/build/events/transaction/interfaces/transaction-aborted.interface.js +2 -0
- package/build/events/transaction/interfaces/transaction-cancelled.interface.d.ts +11 -0
- package/build/events/transaction/interfaces/transaction-cancelled.interface.js +2 -0
- package/build/events/transaction/interfaces/transaction-completed.interface.d.ts +11 -0
- package/build/events/transaction/interfaces/transaction-completed.interface.js +2 -0
- package/build/events/transaction/interfaces/transaction-declined.interface.d.ts +11 -0
- package/build/events/transaction/interfaces/transaction-declined.interface.js +2 -0
- package/build/events/transaction/interfaces/transaction-failed.interface.d.ts +11 -0
- package/build/events/transaction/interfaces/transaction-failed.interface.js +2 -0
- package/build/events/transaction/interfaces/transaction-processing.interface.d.ts +11 -0
- package/build/events/transaction/interfaces/transaction-processing.interface.js +2 -0
- package/build/events/transaction/interfaces/transaction-success.interface.d.ts +12 -0
- package/build/events/transaction/interfaces/transaction-success.interface.js +2 -0
- package/build/events/transaction/interfaces/wallet-credited.interface.d.ts +12 -0
- package/build/events/transaction/interfaces/wallet-credited.interface.js +2 -0
- package/build/events/transaction/interfaces/wallet-debited.interface.d.ts +12 -0
- package/build/events/transaction/interfaces/wallet-debited.interface.js +2 -0
- package/build/helper/settlement.d.ts +2 -1
- package/build/helper/settlement.js +1 -0
- package/build/middlewares/index.d.ts +1 -0
- package/build/middlewares/index.js +1 -0
- package/build/middlewares/mono-webhook.d.ts +2 -0
- package/build/middlewares/mono-webhook.js +14 -0
- package/package.json +1 -1
package/build/events/index.d.ts
CHANGED
|
@@ -4,5 +4,6 @@ export * from "./logs-events/interfaces";
|
|
|
4
4
|
export * from "./notification-events/interfaces";
|
|
5
5
|
export * from "./wallets/interfaces";
|
|
6
6
|
export * from "./merchants-events/interfaces";
|
|
7
|
+
export * from "./transaction/interfaces";
|
|
7
8
|
export * from "./base-events";
|
|
8
9
|
export * from "./types";
|
package/build/events/index.js
CHANGED
|
@@ -20,5 +20,6 @@ __exportStar(require("./logs-events/interfaces"), exports);
|
|
|
20
20
|
__exportStar(require("./notification-events/interfaces"), exports);
|
|
21
21
|
__exportStar(require("./wallets/interfaces"), exports);
|
|
22
22
|
__exportStar(require("./merchants-events/interfaces"), exports);
|
|
23
|
+
__exportStar(require("./transaction/interfaces"), exports);
|
|
23
24
|
__exportStar(require("./base-events"), exports);
|
|
24
25
|
__exportStar(require("./types"), exports);
|
|
@@ -32,5 +32,11 @@ export declare enum Subjects {
|
|
|
32
32
|
APIConfigUpdated = "events.apiconfig.updated",
|
|
33
33
|
DefaultChargeUpdated = "events.default.charge.updated",
|
|
34
34
|
SettingCreated = "events.setting.created",
|
|
35
|
-
SettingUpdated = "events.setting.updated"
|
|
35
|
+
SettingUpdated = "events.setting.updated",
|
|
36
|
+
transactionCompleted = "events.transaction.completed",
|
|
37
|
+
transactionAborted = "events.transaction.aborted",
|
|
38
|
+
transactionFailed = "events.transaction.failed",
|
|
39
|
+
transactionProcessing = "events.transaction.processing",
|
|
40
|
+
transactionCancelled = "events.transaction.cancelled",
|
|
41
|
+
transactionDeclined = "events.transaction.declined"
|
|
36
42
|
}
|
package/build/events/subjects.js
CHANGED
|
@@ -51,4 +51,11 @@ var Subjects;
|
|
|
51
51
|
//Settings
|
|
52
52
|
Subjects["SettingCreated"] = "events.setting.created";
|
|
53
53
|
Subjects["SettingUpdated"] = "events.setting.updated";
|
|
54
|
+
//Transactions
|
|
55
|
+
Subjects["transactionCompleted"] = "events.transaction.completed";
|
|
56
|
+
Subjects["transactionAborted"] = "events.transaction.aborted";
|
|
57
|
+
Subjects["transactionFailed"] = "events.transaction.failed";
|
|
58
|
+
Subjects["transactionProcessing"] = "events.transaction.processing";
|
|
59
|
+
Subjects["transactionCancelled"] = "events.transaction.cancelled";
|
|
60
|
+
Subjects["transactionDeclined"] = "events.transaction.declined";
|
|
54
61
|
})(Subjects = exports.Subjects || (exports.Subjects = {}));
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * from "./transaction-completed.interface";
|
|
2
|
+
export * from "./transaction-cancelled.interface";
|
|
3
|
+
export * from "./transaction-failed.interface";
|
|
4
|
+
export * from "./transaction-declined.interface";
|
|
5
|
+
export * from "./transaction-processing.interface";
|
|
6
|
+
export * from "./transaction-aborted.interface";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./transaction-completed.interface"), exports);
|
|
18
|
+
__exportStar(require("./transaction-cancelled.interface"), exports);
|
|
19
|
+
__exportStar(require("./transaction-failed.interface"), exports);
|
|
20
|
+
__exportStar(require("./transaction-declined.interface"), exports);
|
|
21
|
+
__exportStar(require("./transaction-processing.interface"), exports);
|
|
22
|
+
__exportStar(require("./transaction-aborted.interface"), exports);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface TransactionAbortedEvent {
|
|
3
|
+
subject: Subjects.transactionAborted;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
merchantId: string;
|
|
8
|
+
transactionId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface TransactionCancelledEvent {
|
|
3
|
+
subject: Subjects.transactionCancelled;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
merchantId: string;
|
|
8
|
+
transactionId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface TransactionCompletedEvent {
|
|
3
|
+
subject: Subjects.transactionCompleted;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
merchantId: string;
|
|
8
|
+
transactionId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface TransactionDeclinedEvent {
|
|
3
|
+
subject: Subjects.transactionDeclined;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
merchantId: string;
|
|
8
|
+
transactionId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface TransactionFailedEvent {
|
|
3
|
+
subject: Subjects.transactionFailed;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
merchantId: string;
|
|
8
|
+
transactionId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface TransactionProcessingEvent {
|
|
3
|
+
subject: Subjects.transactionProcessing;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
merchantId: string;
|
|
8
|
+
transactionId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CURRENCY_TYPE } from "../../../helper";
|
|
2
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
3
|
+
export interface WalletCreatedEvent {
|
|
4
|
+
subject: Subjects.WalletCreated;
|
|
5
|
+
streamName: StreamName.name;
|
|
6
|
+
streamEvents: StreamEvent.Event;
|
|
7
|
+
data: {
|
|
8
|
+
merchantId: string;
|
|
9
|
+
accountId: string;
|
|
10
|
+
currencyType?: CURRENCY_TYPE;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CURRENCY_TYPE } from "../../../helper";
|
|
2
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
3
|
+
export interface WalletCreditedEvent {
|
|
4
|
+
subject: Subjects.WalletCreated;
|
|
5
|
+
streamName: StreamName.name;
|
|
6
|
+
streamEvents: StreamEvent.Event;
|
|
7
|
+
data: {
|
|
8
|
+
merchantId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
currencyType?: CURRENCY_TYPE;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CURRENCY_TYPE } from "../../../helper";
|
|
2
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
3
|
+
export interface WalletDebitedEvent {
|
|
4
|
+
subject: Subjects.WalletDebited;
|
|
5
|
+
streamName: StreamName.name;
|
|
6
|
+
streamEvents: StreamEvent.Event;
|
|
7
|
+
data: {
|
|
8
|
+
merchantId: string;
|
|
9
|
+
amount: number;
|
|
10
|
+
currencyType?: CURRENCY_TYPE;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -17,4 +17,5 @@ var Settlement_Status;
|
|
|
17
17
|
Settlement_Status["PENDING"] = "PENDING";
|
|
18
18
|
Settlement_Status["FAILED"] = "FAILED";
|
|
19
19
|
Settlement_Status["SETTLED"] = "SETTLED";
|
|
20
|
+
Settlement_Status["PROCESSING"] = "PROCESSING";
|
|
20
21
|
})(Settlement_Status = exports.Settlement_Status || (exports.Settlement_Status = {}));
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.monoVerifyWebhook = void 0;
|
|
4
|
+
const app_configs_1 = require("../app.configs");
|
|
5
|
+
const helper_1 = require("../helper");
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
const monoVerifyWebhook = (req, res, next) => {
|
|
8
|
+
const { webhook_secret } = app_configs_1.appConfigs.getMonoDetails();
|
|
9
|
+
if (req.headers["mono-webhook-secret"] !== webhook_secret) {
|
|
10
|
+
throw new errors_1.NotAuthorizedError("You do not have permission to access this endpoint", helper_1.error_codes.INVALID_FORBIDDEN);
|
|
11
|
+
}
|
|
12
|
+
next();
|
|
13
|
+
};
|
|
14
|
+
exports.monoVerifyWebhook = monoVerifyWebhook;
|