docta-package 1.2.99 → 1.2.104

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.
@@ -1,4 +1,4 @@
1
- import { ISessionDocument, ISessionPayment } from "../../models";
1
+ import { ISessionDocument, ISessionPayment, ISessionRefund } from "../../models";
2
2
  import { PeriodOutputDto } from "./period";
3
3
  import { UserOutputDto } from "./user";
4
4
  interface ISessionConfigOutput {
@@ -13,6 +13,7 @@ export declare class SessionOutputDto {
13
13
  status: string;
14
14
  doctorId: string | null;
15
15
  patientId: string | null;
16
+ refund: ISessionRefund | null;
16
17
  isDeleted: boolean;
17
18
  createdAt: number;
18
19
  updatedAt: number;
@@ -14,6 +14,7 @@ class SessionOutputDto {
14
14
  ((_d = ((_c = session.doctor.id) !== null && _c !== void 0 ? _c : session.doctor._id)) === null || _d === void 0 ? void 0 : _d.toString()) || null;
15
15
  this.patientId =
16
16
  ((_f = ((_e = session.patient.id) !== null && _e !== void 0 ? _e : session.patient._id)) === null || _f === void 0 ? void 0 : _f.toString()) || null;
17
+ this.refund = session.refund || null;
17
18
  this.isDeleted = session.isDeleted;
18
19
  this.createdAt = session.createdAt;
19
20
  this.updatedAt = session.updatedAt;
@@ -11,6 +11,26 @@ 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 {
15
+ PENDING = "PENDING",
16
+ APPROVED = "APPROVED",
17
+ REJECTED = "REJECTED",
18
+ ON_HOLD = "ON_HOLD",
19
+ SUCCESSFUL = "SUCCESSFUL",
20
+ CANCELLED = "CANCELLED",
21
+ FAILED = "FAILED"
22
+ }
14
23
  export declare enum EnumTranzakEventType {
15
- REQUEST_COMPLETED = "REQUEST.COMPLETED"
24
+ REQUEST_COMPLETED = "REQUEST.COMPLETED",
25
+ REFUND_COMPLETED = "REFUND.COMPLETED"
26
+ }
27
+ export declare enum EnumTranzakReasonCode {
28
+ MUTUAL_AGREEMENT_BETWEEN_BUYER_AND_SELLER = 1,
29
+ ORDER_DID_NOT_MATCH_TRANSACTION_AGREEMENT = 2,
30
+ SUSPICIOUS_TRANSACTION = 3,
31
+ DISPUTED_TRANSACTION = 4,
32
+ OTHER_REASONS = 5,
33
+ DEFICIENT_PRODUCT_OR_SERVICE = 6,
34
+ DUPLICATE_TRANSACTION = 7,
35
+ PURCHASED_ITEM_NOT_DELIVERED_BY_MERCHANT = 8
16
36
  }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EnumTranzakEventType = exports.EnumTranzakPaymentStatus = exports.EnumTranzakCurrency = void 0;
3
+ exports.EnumTranzakReasonCode = exports.EnumTranzakEventType = exports.EnumTranzakRefundStatus = exports.EnumTranzakPaymentStatus = exports.EnumTranzakCurrency = void 0;
4
4
  var EnumTranzakCurrency;
5
5
  (function (EnumTranzakCurrency) {
6
6
  EnumTranzakCurrency["XAF"] = "XAF";
@@ -16,7 +16,29 @@ 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 || (exports.EnumTranzakRefundStatus = EnumTranzakRefundStatus = {}));
19
29
  var EnumTranzakEventType;
20
30
  (function (EnumTranzakEventType) {
21
31
  EnumTranzakEventType["REQUEST_COMPLETED"] = "REQUEST.COMPLETED";
32
+ EnumTranzakEventType["REFUND_COMPLETED"] = "REFUND.COMPLETED";
22
33
  })(EnumTranzakEventType || (exports.EnumTranzakEventType = EnumTranzakEventType = {}));
34
+ var EnumTranzakReasonCode;
35
+ (function (EnumTranzakReasonCode) {
36
+ EnumTranzakReasonCode[EnumTranzakReasonCode["MUTUAL_AGREEMENT_BETWEEN_BUYER_AND_SELLER"] = 1] = "MUTUAL_AGREEMENT_BETWEEN_BUYER_AND_SELLER";
37
+ EnumTranzakReasonCode[EnumTranzakReasonCode["ORDER_DID_NOT_MATCH_TRANSACTION_AGREEMENT"] = 2] = "ORDER_DID_NOT_MATCH_TRANSACTION_AGREEMENT";
38
+ EnumTranzakReasonCode[EnumTranzakReasonCode["SUSPICIOUS_TRANSACTION"] = 3] = "SUSPICIOUS_TRANSACTION";
39
+ EnumTranzakReasonCode[EnumTranzakReasonCode["DISPUTED_TRANSACTION"] = 4] = "DISPUTED_TRANSACTION";
40
+ EnumTranzakReasonCode[EnumTranzakReasonCode["OTHER_REASONS"] = 5] = "OTHER_REASONS";
41
+ EnumTranzakReasonCode[EnumTranzakReasonCode["DEFICIENT_PRODUCT_OR_SERVICE"] = 6] = "DEFICIENT_PRODUCT_OR_SERVICE";
42
+ EnumTranzakReasonCode[EnumTranzakReasonCode["DUPLICATE_TRANSACTION"] = 7] = "DUPLICATE_TRANSACTION";
43
+ EnumTranzakReasonCode[EnumTranzakReasonCode["PURCHASED_ITEM_NOT_DELIVERED_BY_MERCHANT"] = 8] = "PURCHASED_ITEM_NOT_DELIVERED_BY_MERCHANT";
44
+ })(EnumTranzakReasonCode || (exports.EnumTranzakReasonCode = EnumTranzakReasonCode = {}));
@@ -1,2 +1,3 @@
1
1
  export * from "./LoggedInUserToken";
2
2
  export * from "./tranzak.api.response";
3
+ export * from "./tranzak.api.request";
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./LoggedInUserToken"), exports);
18
18
  __exportStar(require("./tranzak.api.response"), exports);
19
+ __exportStar(require("./tranzak.api.request"), exports);
@@ -0,0 +1,16 @@
1
+ import { EnumTranzakCurrency, EnumTranzakReasonCode } from "../enums/tranzak";
2
+ export type TranzakCreatePaymentSessionRequestDto = {
3
+ amount: number;
4
+ currencyCode: EnumTranzakCurrency;
5
+ description: string;
6
+ mchTransactionRef: string;
7
+ returnUrl: string;
8
+ cancelUrl: string;
9
+ };
10
+ export type TranzakCreateRefundRequestDto = {
11
+ refundedTransactionId: string;
12
+ reasonCode: EnumTranzakReasonCode;
13
+ merchantRefundNumber: string;
14
+ note: string;
15
+ amount: number;
16
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- import { EnumTranzakCurrency, EnumTranzakEventType, EnumTranzakPaymentStatus } from "../enums/tranzak";
1
+ import { EnumTranzakCurrency, EnumTranzakEventType, EnumTranzakPaymentStatus, EnumTranzakReasonCode, EnumTranzakRefundStatus } from "../enums/tranzak";
2
2
  export type GetPaymentTokenResponseData = {
3
3
  scope: string;
4
4
  appId: string;
@@ -36,27 +36,36 @@ export type CreatePaymentSessionResponseData = {
36
36
  paymentAuthUrl: string;
37
37
  };
38
38
  };
39
- export type TranzakCreatePaymentSessionRequestDto = {
39
+ export type CreateRefundResponseData = {
40
+ refundId: string;
41
+ refundedTransactionId: string;
40
42
  amount: number;
41
43
  currencyCode: EnumTranzakCurrency;
42
- description: string;
43
- mchTransactionRef: string;
44
- returnUrl: string;
45
- cancelUrl: string;
44
+ status: "COMPLETED";
45
+ type: "REFUND";
46
+ merchantRefundRef: string;
47
+ reasonDescription: string;
48
+ isInitiatedByText: string;
49
+ isCancelledByText: string;
50
+ isApprovedByText: string;
51
+ note: string;
52
+ reasonCode: EnumTranzakReasonCode;
53
+ createdAt: string;
54
+ approvedAt: string;
46
55
  };
47
- export interface TranzakWebhookResponse {
56
+ export interface TranzakWebhookResponse<T> {
48
57
  name: string;
49
58
  version: string;
50
59
  eventType: EnumTranzakEventType;
51
60
  merchantId: string;
52
61
  appId: string;
53
62
  resourceId: string;
54
- resource: TranzakWebhookResource;
63
+ resource: T;
55
64
  creationDateTime: string;
56
65
  webhookId: string;
57
66
  authKey: string;
58
67
  }
59
- interface TranzakWebhookResource {
68
+ export interface TranzakWebhookPaymentResource {
60
69
  requestId: string;
61
70
  amount: number;
62
71
  currencyCode: EnumTranzakCurrency;
@@ -103,4 +112,22 @@ interface TranzakWebhookResource {
103
112
  errorCode?: number;
104
113
  errorMessage?: string;
105
114
  }
106
- export {};
115
+ export interface TranzakWebhookRefundResource {
116
+ refundId: string;
117
+ refundedTransactionId: string;
118
+ serviceId: string;
119
+ amount: number;
120
+ currencyCode: EnumTranzakCurrency;
121
+ status: EnumTranzakRefundStatus;
122
+ type: "REFUND";
123
+ merchantRefundRef: string | null;
124
+ reasonDescription: string;
125
+ isInitiatedByText: string;
126
+ isCancelledByText: string | null;
127
+ isApprovedByText: string;
128
+ note: string;
129
+ reasonCode: EnumTranzakReasonCode;
130
+ reason: string;
131
+ createdAt: string;
132
+ approvedAt: string;
133
+ }
@@ -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 } from "../enums/tranzak";
7
+ import { EnumTranzakPaymentStatus, EnumTranzakCurrency, EnumTranzakRefundStatus } from "../enums/tranzak";
8
8
  /**
9
9
  * Interface for session configuration percentages
10
10
  */
@@ -25,6 +25,18 @@ export interface ISessionPayment {
25
25
  amount: number;
26
26
  currency: EnumTranzakCurrency;
27
27
  }
28
+ /**
29
+ * Interface for embedded refund data
30
+ */
31
+ export interface ISessionRefund {
32
+ webhookId: string;
33
+ webhookStatus: EnumTranzakRefundStatus;
34
+ refundId: string;
35
+ refundedTransactionId: string;
36
+ currency: EnumTranzakCurrency;
37
+ serviceId: string;
38
+ reason: string;
39
+ }
28
40
  /**
29
41
  * Session interface
30
42
  */
@@ -43,6 +55,7 @@ export interface ISession extends IBaseModel {
43
55
  hasPlatformCollected: boolean;
44
56
  meta: ISessionConfig;
45
57
  payment?: ISessionPayment;
58
+ refund?: ISessionRefund;
46
59
  }
47
60
  /**
48
61
  * Document + Model interfaces
@@ -53,6 +53,22 @@ const SessionSchema = new mongoose_1.Schema(Object.assign(Object.assign({}, base
53
53
  enum: Object.values(tranzak_1.EnumTranzakCurrency),
54
54
  required: false,
55
55
  },
56
+ }, refund: {
57
+ webhookId: { type: String, required: false },
58
+ webhookStatus: {
59
+ type: String,
60
+ enum: Object.values(tranzak_1.EnumTranzakRefundStatus),
61
+ required: false,
62
+ },
63
+ refundId: { type: String, required: false },
64
+ refundedTransactionId: { type: String, required: false },
65
+ currency: {
66
+ type: String,
67
+ enum: Object.values(tranzak_1.EnumTranzakCurrency),
68
+ required: false,
69
+ },
70
+ serviceId: { type: String, required: false },
71
+ reason: { type: String, required: false },
56
72
  } }));
57
73
  SessionSchema.plugin(base_1.BaseSchemaPlugin);
58
74
  exports.SessionModel = (0, mongoose_1.model)("Session", SessionSchema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "docta-package",
3
- "version": "1.2.99",
3
+ "version": "1.2.104",
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",