orbitx-core-models 11.130.0 → 11.131.0
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,11 +1,12 @@
|
|
|
1
1
|
import { Document, Types } from "mongoose";
|
|
2
2
|
export interface ILeadDispute extends Document {
|
|
3
3
|
companyId: Types.ObjectId;
|
|
4
|
-
invoiceId
|
|
4
|
+
invoiceId?: Types.ObjectId;
|
|
5
5
|
leadLedgerId: Types.ObjectId;
|
|
6
6
|
leadId: Types.ObjectId;
|
|
7
|
+
ticketId?: Types.ObjectId;
|
|
7
8
|
reason: string;
|
|
8
|
-
status: "open" | "under_review" | "approved" | "rejected";
|
|
9
|
+
status: "open" | "under_review" | "approved" | "resolved" | "rejected";
|
|
9
10
|
resolution?: "refund_to_card" | "credit_next_invoice";
|
|
10
11
|
resolutionAmount?: number;
|
|
11
12
|
stripeCreditNoteId?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leadDispute.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/leadDispute.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"leadDispute.interface.d.ts","sourceRoot":"","sources":["../../src/interfaces/leadDispute.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,WAAW,YAAa,SAAQ,QAAQ;IAC5C,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC;IAM1B,SAAS,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC3B,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC7B,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAE1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;IAEvE,UAAU,CAAC,EAAE,gBAAgB,GAAG,qBAAqB,CAAC;IACtD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAG1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC;IACzB,UAAU,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;IAC5B,UAAU,CAAC,EAAE,IAAI,CAAC;IAElB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,SAAS,CAAC,EAAE,IAAI,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"leadDispute.model.d.ts","sourceRoot":"","sources":["../../src/models/leadDispute.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"leadDispute.model.d.ts","sourceRoot":"","sources":["../../src/models/leadDispute.model.ts"],"names":[],"mappings":"AAAA,OAAO,QAAoB,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAmHnE,eAAO,MAAM,WAAW;;;;OAGvB,CAAC;AACF,eAAe,WAAW,CAAC"}
|
|
@@ -47,10 +47,15 @@ const leadDisputeSchema = new mongoose_1.Schema({
|
|
|
47
47
|
ref: "Company",
|
|
48
48
|
required: [true, "Company ID is required"],
|
|
49
49
|
},
|
|
50
|
+
// Optional -- a just-generated lead's ledger entry may not be linked to
|
|
51
|
+
// any Invoice yet (invoices are only produced by the monthly batch), and
|
|
52
|
+
// a dispute must still be raisable before that happens. See
|
|
53
|
+
// disputeResolution.service.js: approveDisputeWithRefund requires this
|
|
54
|
+
// (and the invoice's stripeInvoiceId) to actually resolve; approveDisputeWithCredit
|
|
55
|
+
// never needs it.
|
|
50
56
|
invoiceId: {
|
|
51
57
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
52
58
|
ref: "Invoice",
|
|
53
|
-
required: [true, "Invoice ID is required"],
|
|
54
59
|
},
|
|
55
60
|
leadLedgerId: {
|
|
56
61
|
type: mongoose_1.Schema.Types.ObjectId,
|
|
@@ -62,6 +67,14 @@ const leadDisputeSchema = new mongoose_1.Schema({
|
|
|
62
67
|
ref: "Lead",
|
|
63
68
|
required: [true, "Lead ID is required"],
|
|
64
69
|
},
|
|
70
|
+
// The Ticket a client raised this dispute through -- lets Ops jump from
|
|
71
|
+
// the normal ticket thread straight to the real billing context, and
|
|
72
|
+
// lets the resolution step post a system message back into that same
|
|
73
|
+
// thread instead of resolving somewhere the client never sees.
|
|
74
|
+
ticketId: {
|
|
75
|
+
type: mongoose_1.Schema.Types.ObjectId,
|
|
76
|
+
ref: "Ticket",
|
|
77
|
+
},
|
|
65
78
|
// ─────────────────────────────────────────────
|
|
66
79
|
// DISPUTE DETAILS
|
|
67
80
|
// ─────────────────────────────────────────────
|
|
@@ -71,8 +84,13 @@ const leadDisputeSchema = new mongoose_1.Schema({
|
|
|
71
84
|
trim: true,
|
|
72
85
|
},
|
|
73
86
|
status: {
|
|
87
|
+
// "resolved" was missing here even though both approve* functions in
|
|
88
|
+
// disputeResolution.service.js already set it -- silently unenforced
|
|
89
|
+
// since those writes use findByIdAndUpdate without runValidators, but
|
|
90
|
+
// wrong per this schema's own contract. "approved" is unused (kept
|
|
91
|
+
// for compatibility in case anything external already reads for it).
|
|
74
92
|
type: String,
|
|
75
|
-
enum: ["open", "under_review", "approved", "rejected"],
|
|
93
|
+
enum: ["open", "under_review", "approved", "resolved", "rejected"],
|
|
76
94
|
default: "open",
|
|
77
95
|
},
|
|
78
96
|
// ─────────────────────────────────────────────
|
|
@@ -112,5 +130,6 @@ const leadDisputeSchema = new mongoose_1.Schema({
|
|
|
112
130
|
leadDisputeSchema.index({ companyId: 1, status: 1 });
|
|
113
131
|
leadDisputeSchema.index({ invoiceId: 1 });
|
|
114
132
|
leadDisputeSchema.index({ leadLedgerId: 1 });
|
|
133
|
+
leadDisputeSchema.index({ ticketId: 1 });
|
|
115
134
|
exports.LeadDispute = mongoose_1.default.model("LeadDispute", leadDisputeSchema);
|
|
116
135
|
exports.default = exports.LeadDispute;
|