docta-package 1.2.113 → 1.2.115
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/enums/tranzak.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare enum EnumTranzakPaymentStatus {
|
|
|
11
11
|
CANCELLED_REFUNDED = "CANCELLED/REFUNDED",
|
|
12
12
|
PAYER_REDIRECT_REQUIRED = "PAYER_REDIRECT_REQUIRED"
|
|
13
13
|
}
|
|
14
|
-
export declare enum
|
|
14
|
+
export declare enum EnumTranzakWebhookRefundStatus {
|
|
15
15
|
PENDING = "PENDING",
|
|
16
16
|
APPROVED = "APPROVED",
|
|
17
17
|
REJECTED = "REJECTED",
|
package/build/enums/tranzak.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EnumTranzakReasonCode = exports.EnumTranzakEventType = exports.
|
|
3
|
+
exports.EnumTranzakReasonCode = exports.EnumTranzakEventType = exports.EnumTranzakWebhookRefundStatus = exports.EnumTranzakPaymentStatus = exports.EnumTranzakCurrency = void 0;
|
|
4
4
|
var EnumTranzakCurrency;
|
|
5
5
|
(function (EnumTranzakCurrency) {
|
|
6
6
|
EnumTranzakCurrency["XAF"] = "XAF";
|
|
@@ -16,17 +16,17 @@ var EnumTranzakPaymentStatus;
|
|
|
16
16
|
EnumTranzakPaymentStatus["CANCELLED_REFUNDED"] = "CANCELLED/REFUNDED";
|
|
17
17
|
EnumTranzakPaymentStatus["PAYER_REDIRECT_REQUIRED"] = "PAYER_REDIRECT_REQUIRED";
|
|
18
18
|
})(EnumTranzakPaymentStatus || (exports.EnumTranzakPaymentStatus = EnumTranzakPaymentStatus = {}));
|
|
19
|
-
var
|
|
20
|
-
(function (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})(
|
|
19
|
+
var EnumTranzakWebhookRefundStatus;
|
|
20
|
+
(function (EnumTranzakWebhookRefundStatus) {
|
|
21
|
+
EnumTranzakWebhookRefundStatus["PENDING"] = "PENDING";
|
|
22
|
+
EnumTranzakWebhookRefundStatus["APPROVED"] = "APPROVED";
|
|
23
|
+
EnumTranzakWebhookRefundStatus["REJECTED"] = "REJECTED";
|
|
24
|
+
EnumTranzakWebhookRefundStatus["ON_HOLD"] = "ON_HOLD";
|
|
25
|
+
EnumTranzakWebhookRefundStatus["SUCCESSFUL"] = "SUCCESSFUL";
|
|
26
|
+
EnumTranzakWebhookRefundStatus["CANCELLED"] = "CANCELLED";
|
|
27
|
+
EnumTranzakWebhookRefundStatus["FAILED"] = "FAILED";
|
|
28
|
+
EnumTranzakWebhookRefundStatus["PROCESSING"] = "PROCESSING";
|
|
29
|
+
})(EnumTranzakWebhookRefundStatus || (exports.EnumTranzakWebhookRefundStatus = EnumTranzakWebhookRefundStatus = {}));
|
|
30
30
|
var EnumTranzakEventType;
|
|
31
31
|
(function (EnumTranzakEventType) {
|
|
32
32
|
EnumTranzakEventType["REQUEST_COMPLETED"] = "REQUEST.COMPLETED";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnumRefundStatus } from "../enums";
|
|
2
|
+
import { EnumTranzakCurrency, EnumTranzakEventType, EnumTranzakPaymentStatus, EnumTranzakReasonCode, EnumTranzakWebhookRefundStatus } from "../enums/tranzak";
|
|
2
3
|
export type GetPaymentTokenResponseData = {
|
|
3
4
|
scope: string;
|
|
4
5
|
appId: string;
|
|
@@ -41,7 +42,7 @@ export type CreateRefundResponseData = {
|
|
|
41
42
|
refundedTransactionId: string;
|
|
42
43
|
amount: number;
|
|
43
44
|
currencyCode: EnumTranzakCurrency;
|
|
44
|
-
status:
|
|
45
|
+
status: EnumRefundStatus.PROCESSING;
|
|
45
46
|
type: "REFUND";
|
|
46
47
|
merchantRefundRef: string;
|
|
47
48
|
reasonDescription: string;
|
|
@@ -118,7 +119,7 @@ export interface TranzakWebhookRefundResource {
|
|
|
118
119
|
serviceId: string;
|
|
119
120
|
amount: number;
|
|
120
121
|
currencyCode: EnumTranzakCurrency;
|
|
121
|
-
status:
|
|
122
|
+
status: EnumTranzakWebhookRefundStatus;
|
|
122
123
|
type: "REFUND";
|
|
123
124
|
merchantRefundRef: string | null;
|
|
124
125
|
reasonDescription: string;
|
|
@@ -4,7 +4,7 @@ import { IPeriodDocument } from "./period";
|
|
|
4
4
|
import { IPatientDocument } from "./patient";
|
|
5
5
|
import { SessionStatus } from "../enums/session.status";
|
|
6
6
|
import { IDoctorDocument } from "./doctor";
|
|
7
|
-
import { EnumTranzakPaymentStatus, EnumTranzakCurrency,
|
|
7
|
+
import { EnumTranzakPaymentStatus, EnumTranzakCurrency, EnumTranzakWebhookRefundStatus } from "../enums/tranzak";
|
|
8
8
|
import { EnumRefundStatus } from "../enums/refund.status";
|
|
9
9
|
import { EnumRefundDirection } from "../enums";
|
|
10
10
|
/**
|
|
@@ -32,7 +32,7 @@ export interface ISessionPayment {
|
|
|
32
32
|
*/
|
|
33
33
|
export interface ISessionRefund {
|
|
34
34
|
webhookId?: string;
|
|
35
|
-
webhookStatus?:
|
|
35
|
+
webhookStatus?: EnumTranzakWebhookRefundStatus;
|
|
36
36
|
refundId?: string;
|
|
37
37
|
refundedTransactionId?: string;
|
|
38
38
|
currency?: EnumTranzakCurrency;
|
package/build/models/session.js
CHANGED
|
@@ -59,7 +59,7 @@ const SessionSchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base
|
|
|
59
59
|
webhookId: { type: String, required: false },
|
|
60
60
|
webhookStatus: {
|
|
61
61
|
type: String,
|
|
62
|
-
enum: Object.values(tranzak_1.
|
|
62
|
+
enum: Object.values(tranzak_1.EnumTranzakWebhookRefundStatus),
|
|
63
63
|
required: false,
|
|
64
64
|
},
|
|
65
65
|
refundId: { type: String, required: false },
|
package/build/utils/winston.js
CHANGED
|
@@ -20,12 +20,9 @@ require("winston-daily-rotate-file");
|
|
|
20
20
|
const path_1 = __importDefault(require("path"));
|
|
21
21
|
const fs_1 = __importDefault(require("fs"));
|
|
22
22
|
const errorLogDir = path_1.default.join(process.cwd(), "logs/error");
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (!fs_1.default.existsSync(dir)) {
|
|
27
|
-
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
28
|
-
}
|
|
23
|
+
// ensure logs directory exists
|
|
24
|
+
if (!fs_1.default.existsSync(errorLogDir)) {
|
|
25
|
+
fs_1.default.mkdirSync(errorLogDir, { recursive: true });
|
|
29
26
|
}
|
|
30
27
|
/**
|
|
31
28
|
* ERROR → file
|
|
@@ -39,28 +36,34 @@ const errorTransport = new winston_1.default.transports.DailyRotateFile({
|
|
|
39
36
|
maxFiles: "14d",
|
|
40
37
|
});
|
|
41
38
|
/**
|
|
42
|
-
*
|
|
39
|
+
* INFO → console with request information
|
|
43
40
|
*/
|
|
44
|
-
const
|
|
45
|
-
level: "
|
|
46
|
-
dirname: debugLogDir,
|
|
47
|
-
filename: "%DATE%.log",
|
|
48
|
-
datePattern: "YYYY-MM-DD",
|
|
49
|
-
maxSize: "20m",
|
|
50
|
-
maxFiles: "7d",
|
|
51
|
-
format: winston_1.default.format.combine(winston_1.default.format((info) => (info.level === "debug" ? info : false))()),
|
|
52
|
-
});
|
|
53
|
-
/**
|
|
54
|
-
* CONSOLE → everything (CloudWatch)
|
|
55
|
-
*/
|
|
56
|
-
const consoleTransport = new winston_1.default.transports.Console({
|
|
57
|
-
level: "debug",
|
|
41
|
+
const infoTransport = new winston_1.default.transports.Console({
|
|
42
|
+
level: "info",
|
|
58
43
|
format: winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.timestamp(), winston_1.default.format.printf((_a) => {
|
|
59
|
-
var { timestamp, level, message } = _a, meta = __rest(_a, ["timestamp", "level", "message"]);
|
|
60
|
-
|
|
44
|
+
var { timestamp, level, message, method, path, request_id } = _a, meta = __rest(_a, ["timestamp", "level", "message", "method", "path", "request_id"]);
|
|
45
|
+
let logMessage = `[${timestamp}] ${level}: ${message}`;
|
|
46
|
+
// Add request information if available
|
|
47
|
+
const requestInfo = [];
|
|
48
|
+
if (method)
|
|
49
|
+
requestInfo.push(`method=${method}`);
|
|
50
|
+
if (path)
|
|
51
|
+
requestInfo.push(`path=${path}`);
|
|
52
|
+
if (request_id)
|
|
53
|
+
requestInfo.push(`request_id=${request_id}`);
|
|
54
|
+
if (requestInfo.length > 0) {
|
|
55
|
+
logMessage += ` | ${requestInfo.join(", ")}`;
|
|
56
|
+
}
|
|
57
|
+
// Add any remaining metadata
|
|
58
|
+
const remainingMeta = Object.keys(meta).filter((key) => key !== "timestamp");
|
|
59
|
+
if (remainingMeta.length > 0) {
|
|
60
|
+
const metaObj = remainingMeta.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: meta[key] })), {});
|
|
61
|
+
logMessage += ` | meta=${JSON.stringify(metaObj)}`;
|
|
62
|
+
}
|
|
63
|
+
return logMessage;
|
|
61
64
|
})),
|
|
62
65
|
});
|
|
63
66
|
exports.logger = winston_1.default.createLogger({
|
|
64
|
-
level: "
|
|
65
|
-
transports: [
|
|
67
|
+
level: "info",
|
|
68
|
+
transports: [infoTransport, errorTransport],
|
|
66
69
|
});
|
package/package.json
CHANGED