payservedb 10.1.7 → 10.1.9
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/index.js +1 -0
- package/package.json +1 -1
- package/src/models/invoice.js +5 -0
- package/src/models/propertyManagerContract.js +28 -0
- package/src/models/quickbooks_invoice_mapping.js +2 -0
- package/src/models/quickbooks_invoice_routing.js +2 -0
- package/src/models/quickbooks_lease_deposit_mapping.js +35 -0
package/index.js
CHANGED
|
@@ -282,6 +282,7 @@ const models = {
|
|
|
282
282
|
QuickBooksPaymentMapping: require("./src/models/quickbooks_payment_mapping"),
|
|
283
283
|
QuickBooksInvoicePaymentMapping: require("./src/models/quickbooks_invoice_payment_mapping"),
|
|
284
284
|
QuickBooksDepositMapping: require("./src/models/quickbooks_deposit_mapping"),
|
|
285
|
+
QuickBooksLeaseDepositMapping: require("./src/models/quickbooks_lease_deposit_mapping"),
|
|
285
286
|
QuickBooksOutboundSyncState: require("./src/models/quickbooks_outbound_sync_state"),
|
|
286
287
|
QuickBooksCdcSweepState: require("./src/models/quickbooks_cdc_sweep_state"),
|
|
287
288
|
QuickBooksBackfillState: require("./src/models/quickbooks_backfill_state"),
|
package/package.json
CHANGED
package/src/models/invoice.js
CHANGED
|
@@ -154,6 +154,11 @@ const invoiceSchema = new mongoose.Schema(
|
|
|
154
154
|
type: String,
|
|
155
155
|
default: null,
|
|
156
156
|
},
|
|
157
|
+
// Property-management invoice details (fee basis, deductions taken first)
|
|
158
|
+
pmContractDetails: {
|
|
159
|
+
type: mongoose.Schema.Types.Mixed,
|
|
160
|
+
default: undefined,
|
|
161
|
+
},
|
|
157
162
|
balanceBroughtForward: {
|
|
158
163
|
type: Number,
|
|
159
164
|
default: 0,
|
|
@@ -117,6 +117,34 @@ const PropertyManagerContractSchema = new Schema(
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
},
|
|
120
|
+
// Optional deductions taken off the gross rental income BEFORE the
|
|
121
|
+
// management fee is calculated (e.g. repairs, caretaker, levies).
|
|
122
|
+
// Only applied when `enabled` is true. Percentage deductions are
|
|
123
|
+
// taken from the gross rental income; fixed amounts are subtracted
|
|
124
|
+
// as-is. Management fee is then computed on the net figure.
|
|
125
|
+
deductions: {
|
|
126
|
+
enabled: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
default: false
|
|
129
|
+
},
|
|
130
|
+
items: [{
|
|
131
|
+
name: {
|
|
132
|
+
type: String,
|
|
133
|
+
required: true,
|
|
134
|
+
trim: true
|
|
135
|
+
},
|
|
136
|
+
type: {
|
|
137
|
+
type: String,
|
|
138
|
+
enum: ['percentage', 'amount'],
|
|
139
|
+
required: true
|
|
140
|
+
},
|
|
141
|
+
value: {
|
|
142
|
+
type: Number,
|
|
143
|
+
required: true,
|
|
144
|
+
min: [0, 'Deduction value cannot be negative']
|
|
145
|
+
}
|
|
146
|
+
}]
|
|
147
|
+
},
|
|
120
148
|
// Per-contract lease commission override — when set (value present)
|
|
121
149
|
// it takes precedence over the facility-wide
|
|
122
150
|
// PropertyManagementSettings default. Lease commission is the
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Lease security deposit <-> QuickBooks invoice line.
|
|
2
|
+
// Lease deposits have no Deposit document (they are a "Security Deposit" line
|
|
3
|
+
// on the tenant's first lease invoice), so this collection records each one
|
|
4
|
+
// separately from levy deposits (quickbooks_deposit_mapping). The line posts
|
|
5
|
+
// to the "security_deposit_lease" Item, which must be a Liability.
|
|
6
|
+
const mongoose = require("mongoose");
|
|
7
|
+
|
|
8
|
+
const quickBooksLeaseDepositMappingSchema = new mongoose.Schema(
|
|
9
|
+
{
|
|
10
|
+
facilityId: { type: mongoose.Schema.Types.ObjectId, ref: "Facility", required: true, index: true },
|
|
11
|
+
qbConfigId: { type: mongoose.Schema.Types.ObjectId, ref: "QuickBooksConfig", required: true, index: true },
|
|
12
|
+
// The PayServe lease invoice carrying the Security Deposit line.
|
|
13
|
+
invoiceId: { type: mongoose.Schema.Types.ObjectId, ref: "Invoice", required: true },
|
|
14
|
+
invoiceNumber: { type: String, default: null },
|
|
15
|
+
customerId: { type: mongoose.Schema.Types.ObjectId, ref: "Customer", default: null },
|
|
16
|
+
depositAmount: { type: Number, default: 0 },
|
|
17
|
+
qbInvoiceId: { type: String, trim: true, default: null },
|
|
18
|
+
// Item the deposit line was posted with (security_deposit_lease mapping).
|
|
19
|
+
qbItemId: { type: String, trim: true, default: null },
|
|
20
|
+
qbItemName: { type: String, trim: true, default: null },
|
|
21
|
+
syncStatus: {
|
|
22
|
+
type: String,
|
|
23
|
+
enum: ["synced", "pending", "error"],
|
|
24
|
+
default: "pending",
|
|
25
|
+
index: true,
|
|
26
|
+
},
|
|
27
|
+
syncError: { type: String, default: null },
|
|
28
|
+
lastSyncedAt: { type: Date, default: null },
|
|
29
|
+
},
|
|
30
|
+
{ timestamps: true },
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
quickBooksLeaseDepositMappingSchema.index({ facilityId: 1, qbConfigId: 1, invoiceId: 1 }, { unique: true });
|
|
34
|
+
|
|
35
|
+
module.exports = { schema: quickBooksLeaseDepositMappingSchema };
|