payservedb 8.4.0 → 8.4.2

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
@@ -236,6 +236,8 @@ const models = {
236
236
  DocumentType: require("./src/models/document_type"),
237
237
  Counter: require("./src/models/counter_schema"),
238
238
  ZohoIntegration: require("./src/models/zohoIntegration"),
239
+ PrivacyPolicy: require("./src/models/privacy_policy"),
240
+ TermsAndConditions: require("./src/models/terms_and_conditions")
239
241
  };
240
242
 
241
243
  // Function to get models dynamically from a specific database connection
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "8.4.0",
3
+ "version": "8.4.2",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -127,6 +127,15 @@ const bookingInvoiceSchema = new mongoose.Schema({
127
127
  ref: 'Currency',
128
128
  required: true
129
129
  },
130
+ // Payment details for M-Pesa STK push
131
+ paymentDetails: {
132
+ paybillNumber: String,
133
+ paybillAccountName: String,
134
+ facilityPaymentDetailsId: {
135
+ type: mongoose.Schema.Types.ObjectId,
136
+ ref: 'FacilityPaymentDetails'
137
+ }
138
+ },
130
139
  status: {
131
140
  type: String,
132
141
  enum: ['active', 'cancelled', 'void'],
@@ -1,123 +1,21 @@
1
- const mongoose = require('mongoose');
1
+ const mongoose = require("mongoose");
2
2
 
3
- // Define the schema for Booking Properties (listing configuration)
4
- const bookingPropertySchema = new mongoose.Schema({
5
- facilityId: {
3
+ const facilityPaymentDetailsSchema = new mongoose.Schema({
4
+ facility: {
6
5
  type: mongoose.Schema.Types.ObjectId,
7
- ref: 'Facility',
8
- required: true
9
6
  },
10
- unitId: {
11
- type: mongoose.Schema.Types.ObjectId,
12
- ref: 'Unit',
13
- required: true
14
- },
15
- managedByLandlord: {
16
- type: Boolean,
17
- default: false
18
- },
19
- division: {
7
+ shortCode: { type: String },
8
+ passkey: { type: String },
9
+ authorizationKey: {
20
10
  type: String,
21
- required: false
22
11
  },
23
- description: {
12
+ module: {
24
13
  type: String,
25
- required: false
26
- },
27
- amenities: [{
28
- type: String
29
- }],
30
- basePrice: {
31
- type: Number,
32
- required: function () {
33
- return !this.managedByLandlord;
34
- }
35
- },
36
- currencyId: {
37
- type: mongoose.Schema.Types.ObjectId,
38
- ref: 'Currency',
39
- required: function () {
40
- return !this.managedByLandlord;
41
- }
42
- },
43
- weekendPriceAdjustment: {
44
- type: Number,
45
- default: 0
46
- },
47
- minimumStay: {
48
- type: Number,
49
- default: 1
14
+ enum: ["All", "Water", "Electricity", "Levy","Lease","Booking"],
15
+ default: "All"
50
16
  },
51
- maximumStay: {
52
- type: Number,
53
- default: 30
54
- },
55
- advanceBookingDays: {
56
- type: Number,
57
- default: 0
58
- },
59
- cancellationPolicy: {
60
- type: String,
61
- enum: ['Flexible', 'Moderate', 'Strict'],
62
- default: 'Moderate'
63
- },
64
- isListed: {
65
- type: Boolean,
66
- default: false
67
- },
68
- commission: {
69
- type: Number,
70
- required: function () {
71
- return !this.managedByLandlord;
72
- },
73
- default: 10 // Default commission percentage
74
- },
75
- blockedDates: [{
76
- startDate: {
77
- type: Date,
78
- required: true
79
- },
80
- endDate: {
81
- type: Date,
82
- required: true
83
- },
84
- reason: {
85
- type: String,
86
- enum: ['Reservation', 'Renovation', 'Owner Use'],
87
- required: true
88
- },
89
- notes: {
90
- type: String
91
- }
92
- }],
93
- // For seasonal pricing or custom date ranges
94
- specialPricing: [{
95
- startDate: {
96
- type: Date,
97
- required: true
98
- },
99
- endDate: {
100
- type: Date,
101
- required: true
102
- },
103
- price: {
104
- type: Number,
105
- required: true
106
- },
107
- name: {
108
- type: String
109
- }
110
- }],
111
- status: {
112
- type: String,
113
- enum: ['Active', 'Inactive', 'Pending Approval'],
114
- default: 'Active'
115
- }
116
- }, {
117
- timestamps: true
118
17
  });
119
18
 
120
- // Create model from schema
121
- const BookingProperty = mongoose.model('BookingProperty', bookingPropertySchema);
19
+ const FacilityPaymentDetails = mongoose.model('FacilityPaymentDetails', facilityPaymentDetailsSchema);
122
20
 
123
- module.exports = BookingProperty;
21
+ module.exports = FacilityPaymentDetails;
@@ -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
  });
@@ -0,0 +1,20 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const privacyPolicySchema = new mongoose.Schema({
4
+ title: {
5
+ type: String,
6
+ default: "Privacy Policy",
7
+ },
8
+ content: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+ },
13
+ {
14
+ timestamps: true,
15
+ }
16
+ );
17
+
18
+ const PrivacyPolicy = mongoose.model('PrivacyPolicy', privacyPolicySchema);
19
+
20
+ module.exports = PrivacyPolicy;
@@ -0,0 +1,20 @@
1
+ const mongoose = require('mongoose');
2
+
3
+ const termsAndConditionsSchema = new mongoose.Schema({
4
+ title: {
5
+ type: String,
6
+ default: "Terms & Conditions",
7
+ },
8
+ content: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+ },
13
+ {
14
+ timestamps: true,
15
+ }
16
+ );
17
+
18
+ const TermsAndConditions = mongoose.model('TermsAndConditions', termsAndConditionsSchema);
19
+
20
+ module.exports = TermsAndConditions;