payservedb 9.1.3 → 9.1.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.1.3",
3
+ "version": "9.1.4",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -32,6 +32,24 @@ const DepositSchema = new Schema(
32
32
  type: Date,
33
33
  required: [true, 'Date paid is required']
34
34
  },
35
+ // NEW FIELDS FOR DEPOSIT/UPFRONT PAYMENT
36
+ receiptNumber: {
37
+ type: String,
38
+ trim: true
39
+ },
40
+ paymentReference: {
41
+ type: String,
42
+ trim: true
43
+ },
44
+ // For upfront payment tracking
45
+ upfrontPaymentId: {
46
+ type: String,
47
+ trim: true
48
+ },
49
+ billingPeriods: [{
50
+ type: String
51
+ }],
52
+ // Status fields
35
53
  status: {
36
54
  type: String,
37
55
  enum: ['Held', 'Refunded', 'Partially Refunded', 'Forfeited'],
@@ -92,21 +110,17 @@ DepositSchema.pre('save', function (next) {
92
110
  ) {
93
111
  this.refundDate = new Date();
94
112
  }
95
-
96
113
  // Guard against refunded amount exceeding original amount
97
114
  if ((this.refundedAmount || 0) > this.amount) {
98
115
  return next(new Error('Refunded amount cannot exceed deposit amount'));
99
116
  }
100
-
101
117
  // Auto-flip to fully Refunded when refundedAmount covers the amount
102
118
  if (this.refundedAmount >= this.amount) {
103
119
  this.status = 'Refunded';
104
120
  }
105
-
106
121
  next();
107
122
  });
108
123
 
109
-
110
124
  module.exports = {
111
125
  schema: DepositSchema,
112
126
  name: 'Deposit'