docta-package 1.2.105 → 1.2.110
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/dto/output/session.d.ts +6 -0
- package/build/dto/output/session.js +8 -0
- package/build/enums/index.d.ts +1 -0
- package/build/enums/index.js +1 -0
- package/build/enums/refund.status.d.ts +6 -0
- package/build/enums/refund.status.js +10 -0
- package/build/enums/session.status.d.ts +1 -1
- package/build/enums/session.status.js +1 -1
- package/build/enums/tranzak.d.ts +2 -1
- package/build/enums/tranzak.js +1 -0
- package/build/interfaces/tranzak.api.response.d.ts +1 -1
- package/build/models/session.d.ts +20 -7
- package/build/models/session.js +19 -1
- package/build/utils/winston.js +58 -0
- package/package.json +1 -1
|
@@ -14,6 +14,8 @@ export declare class SessionOutputDto {
|
|
|
14
14
|
doctorId: string | null;
|
|
15
15
|
patientId: string | null;
|
|
16
16
|
refund: ISessionRefund | null;
|
|
17
|
+
paidAt: number | null;
|
|
18
|
+
cancelledAt: number | null;
|
|
17
19
|
isDeleted: boolean;
|
|
18
20
|
createdAt: number;
|
|
19
21
|
updatedAt: number;
|
|
@@ -46,6 +48,10 @@ export declare class SessionAdminOutputDto extends SessionOutputDto {
|
|
|
46
48
|
createdBy: UserOutputDto | null;
|
|
47
49
|
updatedBy: UserOutputDto | null;
|
|
48
50
|
deletedBy: UserOutputDto | null;
|
|
51
|
+
tranzakErrorDetails: {
|
|
52
|
+
errorCode: string | null;
|
|
53
|
+
errorMessage: string | null;
|
|
54
|
+
} | null;
|
|
49
55
|
constructor(session: ISessionDocument);
|
|
50
56
|
}
|
|
51
57
|
export {};
|
|
@@ -18,6 +18,8 @@ class SessionOutputDto {
|
|
|
18
18
|
this.isDeleted = session.isDeleted;
|
|
19
19
|
this.createdAt = session.createdAt;
|
|
20
20
|
this.updatedAt = session.updatedAt;
|
|
21
|
+
this.paidAt = session.paidAt || null;
|
|
22
|
+
this.cancelledAt = session.cancelledAt || null;
|
|
21
23
|
}
|
|
22
24
|
}
|
|
23
25
|
exports.SessionOutputDto = SessionOutputDto;
|
|
@@ -70,6 +72,12 @@ class SessionAdminOutputDto extends SessionOutputDto {
|
|
|
70
72
|
this.deletedBy = session.deletedBy
|
|
71
73
|
? new user_1.UserOutputDto(session.deletedBy)
|
|
72
74
|
: null;
|
|
75
|
+
this.tranzakErrorDetails = session.tranzakErrorDetails
|
|
76
|
+
? {
|
|
77
|
+
errorCode: session.tranzakErrorDetails.errorCode,
|
|
78
|
+
errorMessage: session.tranzakErrorDetails.errorMessage,
|
|
79
|
+
}
|
|
80
|
+
: null;
|
|
73
81
|
}
|
|
74
82
|
}
|
|
75
83
|
exports.SessionAdminOutputDto = SessionAdminOutputDto;
|
package/build/enums/index.d.ts
CHANGED
package/build/enums/index.js
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EnumRefundStatus = void 0;
|
|
4
|
+
var EnumRefundStatus;
|
|
5
|
+
(function (EnumRefundStatus) {
|
|
6
|
+
EnumRefundStatus["PROCESSING"] = "PROCESSING";
|
|
7
|
+
EnumRefundStatus["COMPLETED"] = "COMPLETED";
|
|
8
|
+
EnumRefundStatus["FAILED_AT_WEBHOOK"] = "FAILED_AT_WEBHOOK";
|
|
9
|
+
EnumRefundStatus["FAILED_AT_INITIATING"] = "FAILED_AT_INITIATING";
|
|
10
|
+
})(EnumRefundStatus || (exports.EnumRefundStatus = EnumRefundStatus = {}));
|
|
@@ -9,5 +9,5 @@ var SessionStatus;
|
|
|
9
9
|
SessionStatus["CANCELLED"] = "CANCELLED";
|
|
10
10
|
SessionStatus["CANCELLED_BY_DOCTOR"] = "CANCELLED_BY_DOCTOR";
|
|
11
11
|
SessionStatus["CANCELLED_DUE_TO_TIME_OUT"] = "CANCELLED_DUE_TO_TIME_OUT";
|
|
12
|
-
SessionStatus["
|
|
12
|
+
SessionStatus["PAYMENT_FAILED"] = "PAYMENT_FAILED";
|
|
13
13
|
})(SessionStatus || (exports.SessionStatus = SessionStatus = {}));
|
package/build/enums/tranzak.d.ts
CHANGED
|
@@ -18,7 +18,8 @@ export declare enum EnumTranzakRefundStatus {
|
|
|
18
18
|
ON_HOLD = "ON_HOLD",
|
|
19
19
|
SUCCESSFUL = "SUCCESSFUL",
|
|
20
20
|
CANCELLED = "CANCELLED",
|
|
21
|
-
FAILED = "FAILED"
|
|
21
|
+
FAILED = "FAILED",
|
|
22
|
+
PROCESSING = "PROCESSING"
|
|
22
23
|
}
|
|
23
24
|
export declare enum EnumTranzakEventType {
|
|
24
25
|
REQUEST_COMPLETED = "REQUEST.COMPLETED",
|
package/build/enums/tranzak.js
CHANGED
|
@@ -25,6 +25,7 @@ var EnumTranzakRefundStatus;
|
|
|
25
25
|
EnumTranzakRefundStatus["SUCCESSFUL"] = "SUCCESSFUL";
|
|
26
26
|
EnumTranzakRefundStatus["CANCELLED"] = "CANCELLED";
|
|
27
27
|
EnumTranzakRefundStatus["FAILED"] = "FAILED";
|
|
28
|
+
EnumTranzakRefundStatus["PROCESSING"] = "PROCESSING";
|
|
28
29
|
})(EnumTranzakRefundStatus || (exports.EnumTranzakRefundStatus = EnumTranzakRefundStatus = {}));
|
|
29
30
|
var EnumTranzakEventType;
|
|
30
31
|
(function (EnumTranzakEventType) {
|
|
@@ -41,7 +41,7 @@ export type CreateRefundResponseData = {
|
|
|
41
41
|
refundedTransactionId: string;
|
|
42
42
|
amount: number;
|
|
43
43
|
currencyCode: EnumTranzakCurrency;
|
|
44
|
-
status:
|
|
44
|
+
status: EnumTranzakRefundStatus.PROCESSING;
|
|
45
45
|
type: "REFUND";
|
|
46
46
|
merchantRefundRef: string;
|
|
47
47
|
reasonDescription: string;
|
|
@@ -5,6 +5,8 @@ import { IPatientDocument } from "./patient";
|
|
|
5
5
|
import { SessionStatus } from "../enums/session.status";
|
|
6
6
|
import { IDoctorDocument } from "./doctor";
|
|
7
7
|
import { EnumTranzakPaymentStatus, EnumTranzakCurrency, EnumTranzakRefundStatus } from "../enums/tranzak";
|
|
8
|
+
import { EnumRefundStatus } from "../enums/refund.status";
|
|
9
|
+
import { EnumRefundDirection } from "../enums";
|
|
8
10
|
/**
|
|
9
11
|
* Interface for session configuration percentages
|
|
10
12
|
*/
|
|
@@ -29,13 +31,18 @@ export interface ISessionPayment {
|
|
|
29
31
|
* Interface for embedded refund data
|
|
30
32
|
*/
|
|
31
33
|
export interface ISessionRefund {
|
|
32
|
-
webhookId
|
|
33
|
-
webhookStatus
|
|
34
|
-
refundId
|
|
35
|
-
refundedTransactionId
|
|
36
|
-
currency
|
|
37
|
-
serviceId
|
|
38
|
-
reason
|
|
34
|
+
webhookId?: string;
|
|
35
|
+
webhookStatus?: EnumTranzakRefundStatus;
|
|
36
|
+
refundId?: string;
|
|
37
|
+
refundedTransactionId?: string;
|
|
38
|
+
currency?: EnumTranzakCurrency;
|
|
39
|
+
serviceId?: string;
|
|
40
|
+
reason?: string;
|
|
41
|
+
refundStartedAt?: number;
|
|
42
|
+
refundCompletedAt?: number;
|
|
43
|
+
refundFailedAt?: number;
|
|
44
|
+
status: EnumRefundStatus;
|
|
45
|
+
direction?: EnumRefundDirection;
|
|
39
46
|
}
|
|
40
47
|
/**
|
|
41
48
|
* Session interface
|
|
@@ -55,7 +62,13 @@ export interface ISession extends IBaseModel {
|
|
|
55
62
|
hasPlatformCollected: boolean;
|
|
56
63
|
meta: ISessionConfig;
|
|
57
64
|
payment?: ISessionPayment;
|
|
65
|
+
paidAt?: number;
|
|
66
|
+
cancelledAt?: number;
|
|
58
67
|
refund?: ISessionRefund;
|
|
68
|
+
tranzakErrorDetails?: {
|
|
69
|
+
errorCode: string;
|
|
70
|
+
errorMessage: string;
|
|
71
|
+
};
|
|
59
72
|
}
|
|
60
73
|
/**
|
|
61
74
|
* Document + Model interfaces
|
package/build/models/session.js
CHANGED
|
@@ -8,6 +8,8 @@ const patient_1 = require("./patient");
|
|
|
8
8
|
const session_status_1 = require("../enums/session.status");
|
|
9
9
|
const doctor_1 = require("./doctor");
|
|
10
10
|
const tranzak_1 = require("../enums/tranzak");
|
|
11
|
+
const refund_status_1 = require("../enums/refund.status");
|
|
12
|
+
const enums_1 = require("../enums");
|
|
11
13
|
/**
|
|
12
14
|
* Schema definition
|
|
13
15
|
*/
|
|
@@ -69,6 +71,22 @@ const SessionSchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base
|
|
|
69
71
|
},
|
|
70
72
|
serviceId: { type: String, required: false },
|
|
71
73
|
reason: { type: String, required: false },
|
|
72
|
-
|
|
74
|
+
refundStartedAt: { type: Number, required: false },
|
|
75
|
+
refundCompletedAt: { type: Number, required: false },
|
|
76
|
+
refundFailedAt: { type: Number, required: false },
|
|
77
|
+
status: {
|
|
78
|
+
type: String,
|
|
79
|
+
enum: Object.values(refund_status_1.EnumRefundStatus),
|
|
80
|
+
required: false,
|
|
81
|
+
},
|
|
82
|
+
direction: {
|
|
83
|
+
type: String,
|
|
84
|
+
enum: Object.values(enums_1.EnumRefundDirection),
|
|
85
|
+
required: false,
|
|
86
|
+
},
|
|
87
|
+
}, tranzakErrorDetails: {
|
|
88
|
+
errorCode: { type: String, required: false },
|
|
89
|
+
errorMessage: { type: String, required: false },
|
|
90
|
+
}, paidAt: { type: Number, required: false }, cancelledAt: { type: Number, required: false } }));
|
|
73
91
|
SessionSchema.plugin(base_1.BaseSchemaPlugin);
|
|
74
92
|
exports.SessionModel = (0, mongoose_1.model)("Session", SessionSchema);
|
package/build/utils/winston.js
CHANGED
|
@@ -30,3 +30,61 @@ exports.logger = winston_1.default.createLogger({
|
|
|
30
30
|
new winston_1.default.transports.Console({ format: winston_1.default.format.simple() }), // optional
|
|
31
31
|
],
|
|
32
32
|
});
|
|
33
|
+
/////////////////////////
|
|
34
|
+
// import winston from "winston";
|
|
35
|
+
// import "winston-daily-rotate-file";
|
|
36
|
+
// import path from "path";
|
|
37
|
+
// import fs from "fs";
|
|
38
|
+
// const errorLogDir = path.join(process.cwd(), "logs/error");
|
|
39
|
+
// const debugLogDir = path.join(process.cwd(), "logs/debug");
|
|
40
|
+
// // ensure logs directories exist
|
|
41
|
+
// for (const dir of [errorLogDir, debugLogDir]) {
|
|
42
|
+
// if (!fs.existsSync(dir)) {
|
|
43
|
+
// fs.mkdirSync(dir, { recursive: true });
|
|
44
|
+
// }
|
|
45
|
+
// }
|
|
46
|
+
// /**
|
|
47
|
+
// * ERROR → file
|
|
48
|
+
// */
|
|
49
|
+
// const errorTransport = new winston.transports.DailyRotateFile({
|
|
50
|
+
// level: "error",
|
|
51
|
+
// dirname: errorLogDir,
|
|
52
|
+
// filename: "%DATE%.log",
|
|
53
|
+
// datePattern: "YYYY-MM-DD",
|
|
54
|
+
// maxSize: "20m",
|
|
55
|
+
// maxFiles: "14d",
|
|
56
|
+
// });
|
|
57
|
+
// /**
|
|
58
|
+
// * DEBUG → file
|
|
59
|
+
// */
|
|
60
|
+
// const debugTransport = new winston.transports.DailyRotateFile({
|
|
61
|
+
// level: "debug",
|
|
62
|
+
// dirname: debugLogDir,
|
|
63
|
+
// filename: "%DATE%.log",
|
|
64
|
+
// datePattern: "YYYY-MM-DD",
|
|
65
|
+
// maxSize: "20m",
|
|
66
|
+
// maxFiles: "7d",
|
|
67
|
+
// });
|
|
68
|
+
// /**
|
|
69
|
+
// * INFO / WARN / ERROR / DEBUG → console (CloudWatch)
|
|
70
|
+
// */
|
|
71
|
+
// const consoleTransport = new winston.transports.Console({
|
|
72
|
+
// level: "debug", // allow everything to console
|
|
73
|
+
// format: winston.format.combine(
|
|
74
|
+
// winston.format.colorize(),
|
|
75
|
+
// winston.format.timestamp(),
|
|
76
|
+
// winston.format.printf(({ timestamp, level, message, ...meta }) => {
|
|
77
|
+
// return `[${timestamp}] ${level}: ${message}${
|
|
78
|
+
// Object.keys(meta).length ? " " + JSON.stringify(meta) : ""
|
|
79
|
+
// }`;
|
|
80
|
+
// })
|
|
81
|
+
// ),
|
|
82
|
+
// });
|
|
83
|
+
// export const logger = winston.createLogger({
|
|
84
|
+
// level: "debug", // minimum accepted level
|
|
85
|
+
// transports: [
|
|
86
|
+
// consoleTransport,
|
|
87
|
+
// errorTransport,
|
|
88
|
+
// debugTransport,
|
|
89
|
+
// ],
|
|
90
|
+
// });
|
package/package.json
CHANGED