@konplit-services/common 1.0.204 → 1.0.206
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/errors/gateway-error.d.ts +17 -0
- package/build/errors/gateway-error.js +28 -0
- package/build/errors/index.d.ts +1 -0
- package/build/errors/index.js +1 -0
- package/build/events/interswitch-events/interfaces/card-payment-initiation.interface.d.ts +16 -19
- package/build/events/interswitch-events/interfaces/card-payment-otp-resend.interface.d.ts +11 -0
- package/build/events/interswitch-events/interfaces/card-payment-otp-resend.interface.js +2 -0
- package/build/events/subjects.d.ts +4 -1
- package/build/events/subjects.js +5 -0
- package/build/helper/date-processing.d.ts +1 -0
- package/build/helper/date-processing.js +5 -1
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Status } from "../helper/status";
|
|
2
|
+
import { CustomError } from "./custom-error";
|
|
3
|
+
import { ErrorReturn } from "./error.interface";
|
|
4
|
+
export declare class GatewayError extends CustomError {
|
|
5
|
+
message: string;
|
|
6
|
+
private error_data;
|
|
7
|
+
readonly statusCode = 502;
|
|
8
|
+
constructor(message: string, error_data: ErrorReturn);
|
|
9
|
+
sequalizeErrors(): {
|
|
10
|
+
status: Status;
|
|
11
|
+
errors: {
|
|
12
|
+
message: string;
|
|
13
|
+
code: number;
|
|
14
|
+
error_code: string;
|
|
15
|
+
}[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GatewayError = void 0;
|
|
4
|
+
const status_1 = require("../helper/status");
|
|
5
|
+
const custom_error_1 = require("./custom-error");
|
|
6
|
+
class GatewayError extends custom_error_1.CustomError {
|
|
7
|
+
constructor(message, error_data) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.message = message;
|
|
10
|
+
this.error_data = error_data;
|
|
11
|
+
this.statusCode = 502;
|
|
12
|
+
this.error_data = error_data;
|
|
13
|
+
Object.setPrototypeOf(this, GatewayError.prototype);
|
|
14
|
+
}
|
|
15
|
+
sequalizeErrors() {
|
|
16
|
+
return {
|
|
17
|
+
status: status_1.Status.Failed,
|
|
18
|
+
errors: [
|
|
19
|
+
{
|
|
20
|
+
message: this.message,
|
|
21
|
+
code: this.error_data.code,
|
|
22
|
+
error_code: this.error_data.error_code,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.GatewayError = GatewayError;
|
package/build/errors/index.d.ts
CHANGED
package/build/errors/index.js
CHANGED
|
@@ -25,3 +25,4 @@ __exportStar(require("./mongoose-validation-error"), exports);
|
|
|
25
25
|
__exportStar(require("./invalid-input-error"), exports);
|
|
26
26
|
__exportStar(require("./service-not-available"), exports);
|
|
27
27
|
__exportStar(require("./axios-request-error"), exports);
|
|
28
|
+
__exportStar(require("./gateway-error"), exports);
|
|
@@ -6,25 +6,22 @@ export interface CardInitiationEvent {
|
|
|
6
6
|
merchantId: string;
|
|
7
7
|
accountId: string;
|
|
8
8
|
transactionType: TRANSACTION_CHARGES_TYPE;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
transactionId: string;
|
|
26
|
-
description: string;
|
|
27
|
-
amount: number;
|
|
9
|
+
customerId: string;
|
|
10
|
+
amount: string;
|
|
11
|
+
transactionRef: string;
|
|
12
|
+
currency: string;
|
|
13
|
+
authData: string;
|
|
14
|
+
callbackUrl?: string;
|
|
15
|
+
deviceInformation?: {
|
|
16
|
+
httpBrowserLanguage: string;
|
|
17
|
+
httpBrowserJavaEnabled: boolean;
|
|
18
|
+
httpBrowserJavaScriptEnabled: boolean;
|
|
19
|
+
httpBrowserColorDepth: number;
|
|
20
|
+
httpBrowserScreenHeight: number;
|
|
21
|
+
httpBrowserScreenWidth: number;
|
|
22
|
+
httpBrowserTimeDifference: number;
|
|
23
|
+
userAgentBrowserValue: string;
|
|
24
|
+
deviceChannel: string;
|
|
28
25
|
};
|
|
29
26
|
};
|
|
30
27
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StreamEvent, StreamName, Subjects } from "../../subjects";
|
|
2
|
+
export interface CardOTPResendEvent {
|
|
3
|
+
subject: Subjects.CardOtpResend;
|
|
4
|
+
streamName: StreamName.name;
|
|
5
|
+
streamEvents: StreamEvent.Event;
|
|
6
|
+
data: {
|
|
7
|
+
paymentId: string;
|
|
8
|
+
amount: string;
|
|
9
|
+
currency: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
@@ -66,7 +66,8 @@ export declare enum Subjects {
|
|
|
66
66
|
QRQueryOrderStatus = "events.qrqueryorder.status",
|
|
67
67
|
QRQueryStatusDelay = "events.qrqueryorder.delay",
|
|
68
68
|
QRQueryStatusComplete = "events.qrqueryorder.complete",
|
|
69
|
-
VirtualFixedAccountCreatedEvent = "events.virtualfixedaccount.created"
|
|
69
|
+
VirtualFixedAccountCreatedEvent = "events.virtualfixedaccount.created",
|
|
70
|
+
CardOtpResend = "events.card.otp.resend"
|
|
70
71
|
}
|
|
71
72
|
export declare enum ResSubjects {
|
|
72
73
|
VirtualDynamicAccountCreatedEvent = "res.virtual.dynamicaccount.created",
|
|
@@ -76,5 +77,7 @@ export declare enum ResSubjects {
|
|
|
76
77
|
NIBSSInstitutions = "res.nibss.institution.list",
|
|
77
78
|
QRDynamicCodeCreated = "res.dynamic.code.created",
|
|
78
79
|
CardInitiationTransaction = "res.card.initiation.transaction",
|
|
80
|
+
CardAuthenticatedOTP = "res.card.auth.otp",
|
|
81
|
+
CardAuthorized3DS = "res.card.ath.threeds",
|
|
79
82
|
CashierInitiation = "res.cashier.initiation"
|
|
80
83
|
}
|
package/build/events/subjects.js
CHANGED
|
@@ -93,6 +93,9 @@ var Subjects;
|
|
|
93
93
|
Subjects["QRQueryStatusComplete"] = "events.qrqueryorder.complete";
|
|
94
94
|
//Virtual Fixed Account
|
|
95
95
|
Subjects["VirtualFixedAccountCreatedEvent"] = "events.virtualfixedaccount.created";
|
|
96
|
+
//Interswitch
|
|
97
|
+
//Card
|
|
98
|
+
Subjects["CardOtpResend"] = "events.card.otp.resend";
|
|
96
99
|
})(Subjects = exports.Subjects || (exports.Subjects = {}));
|
|
97
100
|
var ResSubjects;
|
|
98
101
|
(function (ResSubjects) {
|
|
@@ -108,6 +111,8 @@ var ResSubjects;
|
|
|
108
111
|
ResSubjects["QRDynamicCodeCreated"] = "res.dynamic.code.created";
|
|
109
112
|
//Interswitch
|
|
110
113
|
ResSubjects["CardInitiationTransaction"] = "res.card.initiation.transaction";
|
|
114
|
+
ResSubjects["CardAuthenticatedOTP"] = "res.card.auth.otp";
|
|
115
|
+
ResSubjects["CardAuthorized3DS"] = "res.card.ath.threeds";
|
|
111
116
|
//Opay
|
|
112
117
|
ResSubjects["CashierInitiation"] = "res.cashier.initiation";
|
|
113
118
|
})(ResSubjects = exports.ResSubjects || (exports.ResSubjects = {}));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PLAN_INTERVAL } from "./plan-types";
|
|
2
2
|
export declare const formatDate: (dataString: string) => string;
|
|
3
|
+
export declare const interswitchRefundDateFormat: (dataString: string) => string;
|
|
3
4
|
export declare const formatDateTime: (dataString: string) => string;
|
|
4
5
|
export declare const convertToDate: (date: string) => Date;
|
|
5
6
|
export declare const getPreviousDayRange: () => {
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDuration = exports.convertDateToUTC = exports.convertDateToUTCString = exports.convertDateToUTCRange = exports.convertDateToUTCRangeString = exports.getCurrentDayRange = exports.getPreviousDayRange = exports.convertToDate = exports.formatDateTime = exports.formatDate = void 0;
|
|
6
|
+
exports.getDuration = exports.convertDateToUTC = exports.convertDateToUTCString = exports.convertDateToUTCRange = exports.convertDateToUTCRangeString = exports.getCurrentDayRange = exports.getPreviousDayRange = exports.convertToDate = exports.formatDateTime = exports.interswitchRefundDateFormat = exports.formatDate = void 0;
|
|
7
7
|
const dayjs_1 = __importDefault(require("dayjs"));
|
|
8
8
|
const utc_1 = __importDefault(require("dayjs/plugin/utc"));
|
|
9
9
|
// Extend dayjs with the UTC plugin
|
|
@@ -13,6 +13,10 @@ const formatDate = (dataString) => {
|
|
|
13
13
|
return (0, dayjs_1.default)(dataString).format("YYYY-MM-DD");
|
|
14
14
|
};
|
|
15
15
|
exports.formatDate = formatDate;
|
|
16
|
+
const interswitchRefundDateFormat = (dataString) => {
|
|
17
|
+
return (0, dayjs_1.default)(dataString).format("DD/MM/YYYY");
|
|
18
|
+
};
|
|
19
|
+
exports.interswitchRefundDateFormat = interswitchRefundDateFormat;
|
|
16
20
|
const formatDateTime = (dataString) => {
|
|
17
21
|
return (0, dayjs_1.default)(dataString).format("YYYY-MM-DD HH:mm:ss");
|
|
18
22
|
};
|