payservedb 10.2.3 → 10.2.6

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
@@ -288,6 +288,7 @@ const models = {
288
288
  QuickBooksCdcSweepState: require("./src/models/quickbooks_cdc_sweep_state"),
289
289
  QuickBooksBackfillState: require("./src/models/quickbooks_backfill_state"),
290
290
  QuickBooksInvoiceRouting: require("./src/models/quickbooks_invoice_routing"),
291
+ QuickBooksLog: require("./src/models/quickbooks_log"),
291
292
  DahuaIntegration: require("./src/models/dahuaIntegration"),
292
293
  PrivacyPolicy: require("./src/models/privacy_policy"),
293
294
  TermsAndConditions: require("./src/models/terms_and_conditions"),
@@ -467,4 +468,4 @@ module.exports = {
467
468
  initializeService,
468
469
  ...models,
469
470
  moveIn: moveInModels,
470
- };
471
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "payservedb",
3
- "version": "10.2.3",
3
+ "version": "10.2.6",
4
4
  "main": "index.js",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -71,6 +71,22 @@ const powerMeterAccountSchema = new mongoose.Schema({
71
71
  accountBalance: {
72
72
  type: Number,
73
73
  default: 0
74
+ },
75
+ // Tariff name used to bill this account. At billing time the
76
+ // PowerMeterPowerCharge for { facilityId, yearMonth, tariff } is used.
77
+ tariff: {
78
+ type: String,
79
+ trim: true,
80
+ enum: [
81
+ 'Domestic Lifeline',
82
+ 'Domestic Ordinary 1',
83
+ 'Domestic Ordinary 2',
84
+ 'Commercial Low Voltage',
85
+ 'Commercial Medium Voltage',
86
+ 'Industrial Low Voltage',
87
+ 'Industrial Medium Voltage',
88
+ 'Industrial High Voltage'
89
+ ]
74
90
  }
75
91
  }, {
76
92
  timestamps: true
@@ -0,0 +1,40 @@
1
+ const mongoose = require("mongoose");
2
+
3
+ // Per-call QuickBooks API request/response log for a facility/realm.
4
+ const quickBooksLogSchema = new mongoose.Schema(
5
+ {
6
+ facilityId: {
7
+ type: mongoose.Schema.Types.ObjectId,
8
+ ref: "Facility",
9
+ required: true,
10
+ index: true,
11
+ },
12
+ qbConfigId: {
13
+ type: mongoose.Schema.Types.ObjectId,
14
+ ref: "QuickBooksConfig",
15
+ required: true,
16
+ index: true,
17
+ },
18
+ realmId: { type: String, index: true },
19
+ environment: { type: String },
20
+ direction: { type: String, enum: ["outbound", "inbound"], default: "outbound" },
21
+ method: { type: String, default: "GET" },
22
+ path: { type: String, required: true },
23
+ params: { type: mongoose.Schema.Types.Mixed },
24
+ requestBody: { type: mongoose.Schema.Types.Mixed },
25
+ responseBody: { type: mongoose.Schema.Types.Mixed },
26
+ statusCode: { type: Number },
27
+ errorMessage: { type: String },
28
+ faultCode: { type: String },
29
+ startedAt: { type: Date, default: Date.now, index: true },
30
+ endedAt: { type: Date },
31
+ durationMs: { type: Number },
32
+ correlationId: { type: String, index: true },
33
+ qbRequestId: { type: String },
34
+ },
35
+ { timestamps: true },
36
+ );
37
+
38
+ quickBooksLogSchema.index({ facilityId: 1, qbConfigId: 1, startedAt: -1 });
39
+
40
+ module.exports = { schema: quickBooksLogSchema };