payservedb 10.1.8 → 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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "10.1.8",
3
+ "version": "10.1.9",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -29,6 +29,8 @@ const quickBooksInvoiceMappingSchema = new mongoose.Schema(
29
29
  enum: [
30
30
  "rent_lease",
31
31
  "security_deposit",
32
+ "security_deposit_lease",
33
+ "security_deposit_levy",
32
34
  "service_charge",
33
35
  "utility_power",
34
36
  "utility_water",
@@ -16,6 +16,8 @@ const quickBooksInvoiceRoutingSchema = new mongoose.Schema(
16
16
  enum: [
17
17
  "rent_lease",
18
18
  "security_deposit",
19
+ "security_deposit_lease",
20
+ "security_deposit_levy",
19
21
  "service_charge",
20
22
  "utility_power",
21
23
  "utility_water",
@@ -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 };