payservedb 9.5.2 → 9.5.4

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.5.2",
3
+ "version": "9.5.4",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -56,6 +56,13 @@ const bookingConfigSchema = new mongoose.Schema({
56
56
  listingFeeCurrencyId: {
57
57
  type: mongoose.Schema.Types.ObjectId,
58
58
  ref: 'Currency'
59
+ },
60
+ // How many minutes before dayEndTime a "Per Night" guest gets
61
+ // reminded to pay for the current night's stay.
62
+ reminderMinutesBeforeDayEnd: {
63
+ type: Number,
64
+ default: 60,
65
+ min: 0
59
66
  }
60
67
  }
61
68
  }, {
@@ -126,8 +126,33 @@ const bookingPropertySchema = new mongoose.Schema({
126
126
  required: function () {
127
127
  return !this.managedByLandlord;
128
128
  },
129
- default: 10 // Default commission percentage
130
- },
129
+ default: 10 // Default commission percentage - fallback when no commissionTiers entry matches the stay length
130
+ },
131
+ // Length-of-stay-based commission overrides (e.g. 1-2 nights at 5%,
132
+ // 3-6 nights at 10%, 7+ nights at a fixed amount). Internal-only -
133
+ // never surfaced to the guest. Falls back to `commission` above when
134
+ // a reservation's night count doesn't fall into any tier.
135
+ commissionTiers: [{
136
+ minNights: {
137
+ type: Number,
138
+ required: true,
139
+ min: 1
140
+ },
141
+ maxNights: {
142
+ type: Number,
143
+ default: null // null = no upper bound
144
+ },
145
+ type: {
146
+ type: String,
147
+ enum: ['percentage', 'fixed'],
148
+ default: 'percentage'
149
+ },
150
+ value: {
151
+ type: Number,
152
+ required: true,
153
+ min: 0
154
+ }
155
+ }],
131
156
  blockedDates: [{
132
157
  startDate: {
133
158
  type: Date,
@@ -184,4 +209,4 @@ const bookingPropertySchema = new mongoose.Schema({
184
209
  // Create model from schema
185
210
  const BookingProperty = mongoose.model('BookingProperty', bookingPropertySchema);
186
211
 
187
- module.exports = BookingProperty;
212
+ module.exports = BookingProperty;
@@ -128,6 +128,14 @@ const bookingReservationSchema = new mongoose.Schema({
128
128
  type: Number,
129
129
  required: false
130
130
  },
131
+ // Running total of confirmed payments applied to this reservation's
132
+ // invoice - kept in sync by applyBookingInvoicePayment.js so the
133
+ // booking list can gate check-in eligibility (paymentTiming rules)
134
+ // without an extra invoice lookup per row.
135
+ totalPaidAmount: {
136
+ type: Number,
137
+ default: 0
138
+ },
131
139
  commission: {
132
140
  type: Number,
133
141
  required: false
@@ -148,9 +156,23 @@ const bookingReservationSchema = new mongoose.Schema({
148
156
  },
149
157
  paymentTiming: {
150
158
  type: String,
151
- enum: ['Before', 'After', 'Split'],
159
+ enum: ['Before', 'After', 'Split', 'PerNight'],
152
160
  default: 'Before'
153
161
  },
162
+ // Only used when paymentTiming is 'Split' - guest must pay at least
163
+ // this percentage of the total before check-in is allowed.
164
+ splitPaymentPercentage: {
165
+ type: Number,
166
+ min: 1,
167
+ max: 100,
168
+ default: null
169
+ },
170
+ // Only used when paymentTiming is 'PerNight' - prevents sending more
171
+ // than one payment reminder per business day.
172
+ lastPerNightReminderSentAt: {
173
+ type: Date,
174
+ default: null
175
+ },
154
176
  invoiceId: {
155
177
  type: String
156
178
  },
@@ -263,4 +285,4 @@ const bookingReservationSchema = new mongoose.Schema({
263
285
  // Create model from schema
264
286
  const BookingReservation = mongoose.model('BookingReservation', bookingReservationSchema);
265
287
 
266
- module.exports = BookingReservation;
288
+ module.exports = BookingReservation;