payservedb 5.1.6 → 5.1.8

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": "5.1.6",
3
+ "version": "5.1.8",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -26,10 +26,37 @@ const leaseAgreementSchema = new mongoose.Schema({
26
26
  ref: 'Customer',
27
27
  required: true
28
28
  },
29
- doubleEntryAccount: {
29
+ // GL Account configurations
30
+ invoiceDoubleEntryAccount: {
30
31
  type: mongoose.Schema.Types.ObjectId,
31
- ref: 'GLAccountDoubleEntries',
32
- required: true
32
+ ref: 'GLAccountDoubleEntries'
33
+ },
34
+ paymentDoubleEntryAccount: {
35
+ type: mongoose.Schema.Types.ObjectId,
36
+ ref: 'GLAccountDoubleEntries'
37
+ },
38
+ // GL Account direct configurations (used when creating double entry records)
39
+ glAccounts: {
40
+ invoice: {
41
+ debit: {
42
+ type: mongoose.Schema.Types.ObjectId,
43
+ ref: 'GLAccount'
44
+ },
45
+ credit: {
46
+ type: mongoose.Schema.Types.ObjectId,
47
+ ref: 'GLAccount'
48
+ }
49
+ },
50
+ payment: {
51
+ debit: {
52
+ type: mongoose.Schema.Types.ObjectId,
53
+ ref: 'GLAccount'
54
+ },
55
+ credit: {
56
+ type: mongoose.Schema.Types.ObjectId,
57
+ ref: 'GLAccount'
58
+ }
59
+ }
33
60
  },
34
61
  leaseTerms: {
35
62
  startDate: { type: Date, required: true },
@@ -73,7 +100,22 @@ const leaseAgreementSchema = new mongoose.Schema({
73
100
  businessNumber: String,
74
101
  accountNumber: String,
75
102
  phoneNumber: String
76
- }
103
+ },
104
+ escalations: [{
105
+ _id: { type: mongoose.Schema.Types.ObjectId, auto: true },
106
+ effectiveDate: { type: Date, required: true },
107
+ type: {
108
+ type: String,
109
+ enum: ['percentage', 'fixed'],
110
+ required: true
111
+ },
112
+ value: { type: Number, required: true },
113
+ status: {
114
+ type: String,
115
+ enum: ['scheduled', 'applied', 'cancelled'],
116
+ default: 'scheduled'
117
+ }
118
+ }]
77
119
  },
78
120
  billingCycle: {
79
121
  frequency: {
@@ -82,7 +124,8 @@ const leaseAgreementSchema = new mongoose.Schema({
82
124
  required: true
83
125
  },
84
126
  nextInvoiceDate: { type: Date },
85
- autoSend: { type: Boolean, default: false }
127
+ autoSend: { type: Boolean, default: false },
128
+ lastInvoiceDate: { type: Date }
86
129
  },
87
130
  invoices: [
88
131
  { type: mongoose.Schema.Types.ObjectId, ref: 'Invoice' }
@@ -117,6 +160,10 @@ const leaseAgreementSchema = new mongoose.Schema({
117
160
  enum: ['Active', 'Pending', 'Expired', 'Terminated'],
118
161
  default: 'Active'
119
162
  },
163
+ requireLandlordApproval: {
164
+ type: Boolean,
165
+ default: false
166
+ },
120
167
  payments: [
121
168
  {
122
169
  invoiceId: {
@@ -65,8 +65,8 @@ const waterMeterSchema = new mongoose.Schema({
65
65
  status: {
66
66
  type: String,
67
67
  required: true,
68
- enum: ['open', 'closed', 'maintenance', 'faulty'],
69
- default: 'open',
68
+ enum: ['opened', 'closed', 'maintenance', 'faulty'],
69
+ default: 'opened',
70
70
  },
71
71
  customerType: {
72
72
  type: String,