docta-package 1.2.113 → 1.2.116

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,4 +1,8 @@
1
1
  "use strict";
2
+ // import winston from "winston";
3
+ // import "winston-daily-rotate-file";
4
+ // import path from "path";
5
+ // import fs from "fs";
2
6
  var __rest = (this && this.__rest) || function (s, e) {
3
7
  var t = {};
4
8
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -15,6 +19,62 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
19
  };
16
20
  Object.defineProperty(exports, "__esModule", { value: true });
17
21
  exports.logger = void 0;
22
+ // const errorLogDir = path.join(process.cwd(), "logs/error");
23
+ // // ensure logs directory exists
24
+ // if (!fs.existsSync(errorLogDir)) {
25
+ // fs.mkdirSync(errorLogDir, { recursive: true });
26
+ // }
27
+ // /**
28
+ // * ERROR → file
29
+ // */
30
+ // const errorTransport = new winston.transports.DailyRotateFile({
31
+ // level: "error",
32
+ // dirname: errorLogDir,
33
+ // filename: "%DATE%.log",
34
+ // datePattern: "YYYY-MM-DD",
35
+ // maxSize: "20m",
36
+ // maxFiles: "14d",
37
+ // });
38
+ // /**
39
+ // * INFO → console with request information
40
+ // */
41
+ // const infoTransport = new winston.transports.Console({
42
+ // level: "info",
43
+ // format: winston.format.combine(
44
+ // winston.format.colorize(),
45
+ // winston.format.timestamp(),
46
+ // winston.format.printf(
47
+ // ({ timestamp, level, message, method, path, request_id, ...meta }) => {
48
+ // let logMessage = `[${timestamp}] ${level}: ${message}`;
49
+ // // Add request information if available
50
+ // const requestInfo: string[] = [];
51
+ // if (method) requestInfo.push(`method=${method}`);
52
+ // if (path) requestInfo.push(`path=${path}`);
53
+ // if (request_id) 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(
59
+ // (key) => key !== "timestamp"
60
+ // );
61
+ // if (remainingMeta.length > 0) {
62
+ // const metaObj = remainingMeta.reduce(
63
+ // (acc, key) => ({ ...acc, [key]: meta[key] }),
64
+ // {}
65
+ // );
66
+ // logMessage += ` | meta=${JSON.stringify(metaObj)}`;
67
+ // }
68
+ // return logMessage;
69
+ // }
70
+ // )
71
+ // ),
72
+ // });
73
+ // export const logger = winston.createLogger({
74
+ // level: "info",
75
+ // transports: [infoTransport, errorTransport],
76
+ // });
77
+ ///////YOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
18
78
  const winston_1 = __importDefault(require("winston"));
19
79
  require("winston-daily-rotate-file");
20
80
  const path_1 = __importDefault(require("path"));
@@ -37,6 +97,7 @@ const errorTransport = new winston_1.default.transports.DailyRotateFile({
37
97
  datePattern: "YYYY-MM-DD",
38
98
  maxSize: "20m",
39
99
  maxFiles: "14d",
100
+ format: winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.timestamp()),
40
101
  });
41
102
  /**
42
103
  * DEBUG ONLY → file
@@ -48,7 +109,7 @@ const debugTransport = new winston_1.default.transports.DailyRotateFile({
48
109
  datePattern: "YYYY-MM-DD",
49
110
  maxSize: "20m",
50
111
  maxFiles: "7d",
51
- format: winston_1.default.format.combine(winston_1.default.format((info) => (info.level === "debug" ? info : false))()),
112
+ format: winston_1.default.format.combine(winston_1.default.format.colorize(), winston_1.default.format.timestamp(), winston_1.default.format((info) => (info.level === "debug" ? info : false))()),
52
113
  });
53
114
  /**
54
115
  * CONSOLE → everything (CloudWatch)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docta-package",
3
- "version": "1.2.113",
3
+ "version": "1.2.116",
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",