docta-package 1.2.112 → 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.
@@ -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 EnumTranzakRefundStatus {
14
+ export declare enum EnumTranzakWebhookRefundStatus {
15
15
  PENDING = "PENDING",
16
16
  APPROVED = "APPROVED",
17
17
  REJECTED = "REJECTED",
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnumTranzakReasonCode = exports.EnumTranzakEventType = exports.EnumTranzakRefundStatus = exports.EnumTranzakPaymentStatus = exports.EnumTranzakCurrency = void 0;
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 EnumTranzakRefundStatus;
20
- (function (EnumTranzakRefundStatus) {
21
- EnumTranzakRefundStatus["PENDING"] = "PENDING";
22
- EnumTranzakRefundStatus["APPROVED"] = "APPROVED";
23
- EnumTranzakRefundStatus["REJECTED"] = "REJECTED";
24
- EnumTranzakRefundStatus["ON_HOLD"] = "ON_HOLD";
25
- EnumTranzakRefundStatus["SUCCESSFUL"] = "SUCCESSFUL";
26
- EnumTranzakRefundStatus["CANCELLED"] = "CANCELLED";
27
- EnumTranzakRefundStatus["FAILED"] = "FAILED";
28
- EnumTranzakRefundStatus["PROCESSING"] = "PROCESSING";
29
- })(EnumTranzakRefundStatus || (exports.EnumTranzakRefundStatus = EnumTranzakRefundStatus = {}));
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 { EnumTranzakCurrency, EnumTranzakEventType, EnumTranzakPaymentStatus, EnumTranzakReasonCode, EnumTranzakRefundStatus } from "../enums/tranzak";
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: EnumTranzakRefundStatus.PROCESSING;
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: EnumTranzakRefundStatus;
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, EnumTranzakRefundStatus } from "../enums/tranzak";
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?: EnumTranzakRefundStatus;
35
+ webhookStatus?: EnumTranzakWebhookRefundStatus;
36
36
  refundId?: string;
37
37
  refundedTransactionId?: string;
38
38
  currency?: EnumTranzakCurrency;
@@ -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.EnumTranzakRefundStatus),
62
+ enum: Object.values(tranzak_1.EnumTranzakWebhookRefundStatus),
63
63
  required: false,
64
64
  },
65
65
  refundId: { type: String, required: false },
@@ -1,9 +1,4 @@
1
1
  "use strict";
2
- // // src/utils/logger.ts
3
- // import winston from "winston";
4
- // import "winston-daily-rotate-file";
5
- // import path from "path";
6
- // import fs from "fs";
7
2
  var __rest = (this && this.__rest) || function (s, e) {
8
3
  var t = {};
9
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -20,42 +15,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20
15
  };
21
16
  Object.defineProperty(exports, "__esModule", { value: true });
22
17
  exports.logger = void 0;
23
- // const logDir = path.join(process.cwd(), "logs");
24
- // // ensure logs directory exists
25
- // if (!fs.existsSync(logDir)) {
26
- // fs.mkdirSync(logDir, { recursive: true });
27
- // }
28
- // const transport = new winston.transports.DailyRotateFile({
29
- // dirname: logDir,
30
- // filename: "%DATE%.log",
31
- // datePattern: "YYYY-MM-DD",
32
- // zippedArchive: false,
33
- // maxSize: "20m",
34
- // maxFiles: "14d",
35
- // });
36
- // export const logger = winston.createLogger({
37
- // level: "error",
38
- // format: winston.format.combine(
39
- // winston.format.timestamp(),
40
- // winston.format.json()
41
- // ),
42
- // transports: [
43
- // transport,
44
- // new winston.transports.Console({ format: winston.format.simple() }), // optional
45
- // ],
46
- // });
47
- /////////////////////////
48
18
  const winston_1 = __importDefault(require("winston"));
49
19
  require("winston-daily-rotate-file");
50
20
  const path_1 = __importDefault(require("path"));
51
21
  const fs_1 = __importDefault(require("fs"));
52
22
  const errorLogDir = path_1.default.join(process.cwd(), "logs/error");
53
- const debugLogDir = path_1.default.join(process.cwd(), "logs/debug");
54
- // ensure logs directories exist
55
- for (const dir of [errorLogDir, debugLogDir]) {
56
- if (!fs_1.default.existsSync(dir)) {
57
- fs_1.default.mkdirSync(dir, { recursive: true });
58
- }
23
+ // ensure logs directory exists
24
+ if (!fs_1.default.existsSync(errorLogDir)) {
25
+ fs_1.default.mkdirSync(errorLogDir, { recursive: true });
59
26
  }
60
27
  /**
61
28
  * ERROR → file
@@ -69,27 +36,34 @@ const errorTransport = new winston_1.default.transports.DailyRotateFile({
69
36
  maxFiles: "14d",
70
37
  });
71
38
  /**
72
- * DEBUGfile
39
+ * INFOconsole with request information
73
40
  */
74
- const debugTransport = new winston_1.default.transports.DailyRotateFile({
75
- level: "debug",
76
- dirname: debugLogDir,
77
- filename: "%DATE%.log",
78
- datePattern: "YYYY-MM-DD",
79
- maxSize: "20m",
80
- maxFiles: "7d",
81
- });
82
- /**
83
- * INFO / WARN / ERROR / DEBUG → console (CloudWatch)
84
- */
85
- const consoleTransport = new winston_1.default.transports.Console({
86
- level: "debug", // allow everything to console
41
+ const infoTransport = new winston_1.default.transports.Console({
42
+ level: "info",
87
43
  format: winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.timestamp(), winston_1.default.format.printf((_a) => {
88
- var { timestamp, level, message } = _a, meta = __rest(_a, ["timestamp", "level", "message"]);
89
- return `[${timestamp}] ${level}: ${message}${Object.keys(meta).length ? " " + JSON.stringify(meta) : ""}`;
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;
90
64
  })),
91
65
  });
92
66
  exports.logger = winston_1.default.createLogger({
93
- level: "debug", // minimum accepted level
94
- transports: [consoleTransport, errorTransport, debugTransport],
67
+ level: "info",
68
+ transports: [infoTransport, errorTransport],
95
69
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docta-package",
3
- "version": "1.2.112",
3
+ "version": "1.2.115",
4
4
  "description": "This package will contail all the required files to run the docta micro-service app",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",