payservedb 8.4.1 → 8.4.3

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": "8.4.1",
3
+ "version": "8.4.3",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -17,6 +17,11 @@ const bookingInvoiceSchema = new mongoose.Schema({
17
17
  required: true,
18
18
  unique: true
19
19
  },
20
+ accountNumber: {
21
+ type: String,
22
+ unique: true,
23
+ sparse: true // Allow null/undefined values while maintaining uniqueness for non-null values
24
+ },
20
25
  bookingReservationId: {
21
26
  type: mongoose.Schema.Types.ObjectId,
22
27
  ref: 'BookingReservation',
@@ -127,6 +132,15 @@ const bookingInvoiceSchema = new mongoose.Schema({
127
132
  ref: 'Currency',
128
133
  required: true
129
134
  },
135
+ // Payment details for M-Pesa STK push
136
+ paymentDetails: {
137
+ paybillNumber: String,
138
+ paybillAccountName: String,
139
+ facilityPaymentDetailsId: {
140
+ type: mongoose.Schema.Types.ObjectId,
141
+ ref: 'FacilityPaymentDetails'
142
+ }
143
+ },
130
144
  status: {
131
145
  type: String,
132
146
  enum: ['active', 'cancelled', 'void'],
@@ -12,6 +12,15 @@ const bookingPropertySchema = new mongoose.Schema({
12
12
  ref: 'Unit',
13
13
  required: true
14
14
  },
15
+ propertyName: {
16
+ type: String,
17
+ required: true
18
+ },
19
+ propertyType: {
20
+ type: String,
21
+ enum: ['Apartment', 'Villa', 'Hotel', 'Resort', 'Guesthouse', 'Other'],
22
+ default: 'Apartment'
23
+ },
15
24
  managedByLandlord: {
16
25
  type: Boolean,
17
26
  default: false
@@ -24,6 +33,24 @@ const bookingPropertySchema = new mongoose.Schema({
24
33
  type: String,
25
34
  required: false
26
35
  },
36
+ location: {
37
+ address: String,
38
+ city: String,
39
+ country: String,
40
+ coordinates: {
41
+ latitude: Number,
42
+ longitude: Number
43
+ }
44
+ },
45
+ images: [{
46
+ url: String,
47
+ caption: String,
48
+ isPrimary: Boolean
49
+ }],
50
+ maxOccupancy: {
51
+ type: Number,
52
+ default: 2
53
+ },
27
54
  amenities: [{
28
55
  type: String
29
56
  }],
@@ -61,6 +88,26 @@ const bookingPropertySchema = new mongoose.Schema({
61
88
  enum: ['Flexible', 'Moderate', 'Strict'],
62
89
  default: 'Moderate'
63
90
  },
91
+ // Detailed cancellation policy information for display and API
92
+ cancellationPolicyDetails: {
93
+ description: {
94
+ type: String,
95
+ default: ''
96
+ },
97
+ refundRules: [{
98
+ daysBeforeCheckIn: {
99
+ type: Number,
100
+ required: false
101
+ },
102
+ refundPercentage: {
103
+ type: Number,
104
+ required: false
105
+ },
106
+ description: {
107
+ type: String
108
+ }
109
+ }]
110
+ },
64
111
  isListed: {
65
112
  type: Boolean,
66
113
  default: false
@@ -110,8 +157,12 @@ const bookingPropertySchema = new mongoose.Schema({
110
157
  }],
111
158
  status: {
112
159
  type: String,
113
- enum: ['Active', 'Inactive', 'Pending Approval'],
114
- default: 'Active'
160
+ enum: ['active', 'inactive', 'maintenance', 'Active', 'Inactive', 'Pending Approval'],
161
+ default: 'active'
162
+ },
163
+ reservationId: {
164
+ type: mongoose.Schema.Types.ObjectId,
165
+ ref: 'BookingReservation'
115
166
  }
116
167
  }, {
117
168
  timestamps: true
@@ -155,13 +155,13 @@ const bookingReservationSchema = new mongoose.Schema({
155
155
  },
156
156
  status: {
157
157
  type: String,
158
- enum: ['new', 'confirmed', 'cancelled', 'completed'],
159
- default: 'new'
158
+ enum: ['reserved', 'booked', 'canceled', 'completed'],
159
+ default: 'reserved'
160
160
  },
161
161
  statusHistory: [{
162
162
  status: {
163
163
  type: String,
164
- enum: ['new', 'confirmed', 'cancelled', 'completed'],
164
+ enum: ['reserved', 'booked', 'canceled', 'completed'],
165
165
  required: true
166
166
  },
167
167
  timestamp: {
@@ -170,6 +170,23 @@ const bookingReservationSchema = new mongoose.Schema({
170
170
  },
171
171
  updatedBy: mongoose.Schema.Types.ObjectId
172
172
  }],
173
+ // Partial payment and reservation settings
174
+ partialPaymentAllowed: {
175
+ type: Boolean,
176
+ default: true
177
+ },
178
+ paymentDeadline: {
179
+ type: Date
180
+ },
181
+ reassignmentAllowed: {
182
+ type: Boolean,
183
+ default: true
184
+ },
185
+ // Reservation policy details
186
+ reservationPolicy: {
187
+ type: String,
188
+ default: 'Units can be reserved with partial payment. Full payment required before check-in. Reserved units may be reassigned if payment deadline is not met.'
189
+ },
173
190
  cancellationDetails: {
174
191
  date: Date,
175
192
  reason: String,
@@ -11,7 +11,7 @@ const facilityPaymentDetailsSchema = new mongoose.Schema({
11
11
  },
12
12
  module: {
13
13
  type: String,
14
- enum: ["All", "Water", "Electricity", "Levy","Lease"],
14
+ enum: ["All", "Water", "Electricity", "Levy","Lease","Booking"],
15
15
  default: "All"
16
16
  },
17
17
  });