payservedb 9.3.9 → 9.4.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "9.3.9",
3
+ "version": "9.4.1",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -18,9 +18,10 @@ const feeRuleSchema = new mongoose.Schema(
18
18
 
19
19
  // Per-facility property management revenue settings.
20
20
  // Booking commission is configured in the booking module (BookingConfig /
21
- // BookingProperty), and the management fee is billed per PM contract
21
+ // BookingProperty), and management commission is billed per PM contract
22
22
  // (PropertyManagerContract.managementFee) via its own invoice, so only
23
- // lease fee has a facility-wide default here.
23
+ // lease commission (the one-time new-tenant placement fee) has a
24
+ // facility-wide default here.
24
25
  const propertyManagementSettingsSchema = new mongoose.Schema(
25
26
  {
26
27
  facility: {
@@ -29,7 +30,8 @@ const propertyManagementSettingsSchema = new mongoose.Schema(
29
30
  required: true,
30
31
  unique: true
31
32
  },
32
- // One-time fee earned on the first rent payment after a property manager places a tenant
33
+ // One-time fee earned when the first rent payment lands after the
34
+ // property manager places a new tenant
33
35
  leaseFee: {
34
36
  type: feeRuleSchema,
35
37
  default: () => ({ type: 'percentage', value: 0 })
@@ -94,25 +94,27 @@ const PropertyManagerContractSchema = new Schema(
94
94
  }
95
95
  }
96
96
  },
97
- // Per-contract revenue overrides — when set (value present) they take
98
- // precedence over the facility-wide PropertyManagementSettings defaults
99
- // Note: This overrides the LEASE FEE for the units on this contract
100
- leaseFeeOverride: {
97
+ // Per-contract lease commission override — when set (value present)
98
+ // it takes precedence over the facility-wide
99
+ // PropertyManagementSettings default. Lease commission is the
100
+ // one-time fee earned when the property manager places a new
101
+ // tenant (first paid rent invoice).
102
+ leaseFee: {
101
103
  type: {
102
104
  type: String,
103
105
  enum: ['percentage', 'amount']
104
106
  },
105
107
  value: {
106
108
  type: Number,
107
- min: [0, 'Lease fee value cannot be negative'],
109
+ min: [0, 'Lease commission value cannot be negative'],
108
110
  validate: {
109
111
  validator: function (value) {
110
- if (this.leaseFeeOverride && this.leaseFeeOverride.type === 'percentage') {
112
+ if (this.leaseFee && this.leaseFee.type === 'percentage') {
111
113
  return value <= 100;
112
114
  }
113
115
  return true;
114
116
  },
115
- message: 'Lease fee percentage cannot exceed 100%'
117
+ message: 'Lease commission percentage cannot exceed 100%'
116
118
  }
117
119
  }
118
120
  },
@@ -1,7 +1,8 @@
1
1
  const mongoose = require('mongoose');
2
2
 
3
3
  // One document per revenue event earned by a property manager.
4
- // Sources: booking commission, lease fee (first rent payment), and management fee
4
+ // Sources: booking commission, lease commission (first rent payment on a new
5
+ // tenancy) and management commission (the property management fee).
5
6
  const propertyManagerRevenueEntrySchema = new mongoose.Schema({
6
7
  facility: {
7
8
  type: mongoose.Schema.Types.ObjectId,
@@ -62,7 +63,7 @@ const propertyManagerRevenueEntrySchema = new mongoose.Schema({
62
63
  reference: {
63
64
  kind: {
64
65
  type: String,
65
- enum: ['invoice', 'reservation'],
66
+ enum: ['invoice', 'reservation', 'booking_invoice'],
66
67
  required: true
67
68
  },
68
69
  id: {
@@ -33,7 +33,7 @@ const walletTransactionSchema = new mongoose.Schema(
33
33
  },
34
34
 
35
35
  balanceAfter: {
36
- type: String,
36
+ type: Number,
37
37
  },
38
38
 
39
39
  status: {