payservedb 5.3.3 → 5.3.5

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
@@ -156,6 +156,7 @@ const models = {
156
156
  GLAccount: require('./src/models/gl_accounts'),
157
157
  GLEntry: require('./src/models/gl_entries'),
158
158
  GLAccountDoubleEntries: require('./src/models/gl_account_double_entries'),
159
+ PendingCredential: require('./src/models/pendingCredentials')
159
160
  };
160
161
 
161
162
  // 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": "5.3.3",
3
+ "version": "5.3.5",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,29 @@
1
+ const pendingCredentialSchema = new mongoose.Schema({
2
+ userId: {
3
+ type: mongoose.Schema.Types.ObjectId,
4
+ ref: 'User',
5
+ required: true
6
+ },
7
+ email: String,
8
+ phoneNumber: String,
9
+ fullName: String,
10
+ userType: String,
11
+ password: String, // Temporary storage of plain password for sending
12
+ facilityId: mongoose.Schema.Types.ObjectId,
13
+ status: {
14
+ type: String,
15
+ enum: ['pending', 'sent', 'failed'],
16
+ default: 'pending'
17
+ },
18
+ retryCount: {
19
+ type: Number,
20
+ default: 0
21
+ },
22
+ createdAt: {
23
+ type: Date,
24
+ default: Date.now,
25
+ expires: '7d' // Auto-delete after 7 days
26
+ }
27
+ });
28
+
29
+ module.exports = mongoose.model('PendingCredential', pendingCredentialSchema);
@@ -1,5 +1,4 @@
1
1
  const mongoose = require('mongoose');
2
-
3
2
  // Define the schema for ValueAddedServices
4
3
  const valueAddedServiceSchema = new mongoose.Schema({
5
4
  facilityId: {
@@ -27,11 +26,55 @@ const valueAddedServiceSchema = new mongoose.Schema({
27
26
  },
28
27
  taxName: String,
29
28
  taxRate: Number
30
- }]
29
+ }],
30
+ // GL Account configurations
31
+ invoiceDoubleEntryAccount: {
32
+ type: mongoose.Schema.Types.ObjectId,
33
+ ref: 'GLAccountDoubleEntries'
34
+ },
35
+ paymentDoubleEntryAccount: {
36
+ type: mongoose.Schema.Types.ObjectId,
37
+ ref: 'GLAccountDoubleEntries'
38
+ },
39
+ taxDoubleEntryAccount: {
40
+ type: mongoose.Schema.Types.ObjectId,
41
+ ref: 'GLAccountDoubleEntries'
42
+ },
43
+ // GL Account direct configurations (used when creating double entry records)
44
+ glAccounts: {
45
+ invoice: {
46
+ debit: {
47
+ type: mongoose.Schema.Types.ObjectId,
48
+ ref: 'GLAccount'
49
+ },
50
+ credit: {
51
+ type: mongoose.Schema.Types.ObjectId,
52
+ ref: 'GLAccount'
53
+ }
54
+ },
55
+ payment: {
56
+ debit: {
57
+ type: mongoose.Schema.Types.ObjectId,
58
+ ref: 'GLAccount'
59
+ },
60
+ credit: {
61
+ type: mongoose.Schema.Types.ObjectId,
62
+ ref: 'GLAccount'
63
+ }
64
+ },
65
+ tax: {
66
+ debit: {
67
+ type: mongoose.Schema.Types.ObjectId,
68
+ ref: 'GLAccount'
69
+ },
70
+ credit: {
71
+ type: mongoose.Schema.Types.ObjectId,
72
+ ref: 'GLAccount'
73
+ }
74
+ }
75
+ }
31
76
  }, {
32
77
  timestamps: true
33
78
  });
34
-
35
79
  const ValueAddedService = mongoose.model('ValueAddedService', valueAddedServiceSchema);
36
-
37
80
  module.exports = ValueAddedService;
@@ -139,7 +139,40 @@ const vasInvoiceSchema = new mongoose.Schema({
139
139
  overpay: {
140
140
  type: Number,
141
141
  default: 0
142
- }
142
+ },
143
+ // GL Integration Fields
144
+ invoiceGLEntryId: {
145
+ type: mongoose.Schema.Types.ObjectId,
146
+ ref: 'GLEntry'
147
+ },
148
+ taxGLEntryId: {
149
+ type: mongoose.Schema.Types.ObjectId,
150
+ ref: 'GLEntry'
151
+ },
152
+ glDoubleEntryId: {
153
+ type: mongoose.Schema.Types.ObjectId,
154
+ ref: 'GLAccountDoubleEntries'
155
+ },
156
+ // Tax GL details
157
+ taxDetails: [{
158
+ taxId: {
159
+ type: mongoose.Schema.Types.ObjectId,
160
+ ref: 'CountryTaxRate'
161
+ },
162
+ taxName: {
163
+ type: String
164
+ },
165
+ taxRate: {
166
+ type: Number
167
+ },
168
+ taxAmount: {
169
+ type: Number
170
+ },
171
+ glEntryId: {
172
+ type: mongoose.Schema.Types.ObjectId,
173
+ ref: 'GLEntry'
174
+ }
175
+ }]
143
176
  }, {
144
177
  timestamps: true
145
178
  });