database-connector 2.5.1 → 2.5.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/models/Plan.js CHANGED
@@ -21,8 +21,17 @@ const mongoose = require('mongoose');
21
21
  * type: number
22
22
  * description: Number of months in the plan
23
23
  * price:
24
- * type: number
25
- * description: Plan price for one store
24
+ * type: array
25
+ * items:
26
+ * type: object
27
+ * properties:
28
+ * currency:
29
+ * type: string
30
+ * description: Currency code (EUR, USD, DZD, etc.)
31
+ * amount:
32
+ * type: number
33
+ * description: Price amount in the specified currency
34
+ * description: Array of prices in different currencies
26
35
  * storeReductionRules:
27
36
  * type: array
28
37
  * items:
@@ -49,7 +58,13 @@ const mongoose = require('mongoose');
49
58
  * id: "507f1f77bcf86cd799439011"
50
59
  * type: "Annual"
51
60
  * months: 12
52
- * price: 99.99
61
+ * price:
62
+ * - currency: "EUR"
63
+ * amount: 99.99
64
+ * - currency: "USD"
65
+ * amount: 109.99
66
+ * - currency: "DZD"
67
+ * amount: 13999.99
53
68
  * storeReductionRules:
54
69
  * - storeNumber: 2
55
70
  * reductionPercentage: 10
@@ -71,10 +86,18 @@ const planSchema = new mongoose.Schema(
71
86
  required: true,
72
87
  unique: false
73
88
  },
74
- price: {
75
- type: Number,
76
- required: true,
77
- },
89
+ price: [
90
+ {
91
+ currency: {
92
+ type: String,
93
+ required: true,
94
+ },
95
+ amount: {
96
+ type: Number,
97
+ required: true,
98
+ },
99
+ }
100
+ ],
78
101
  storeReductionRules: [
79
102
  {
80
103
  storeNumber: {
@@ -7,6 +7,7 @@ const buildSubscriptionHistorySnapshot = (subscriptionDoc) => ({
7
7
  planTypeId: subscriptionDoc.planTypeId,
8
8
  subscriptionOfferId: subscriptionDoc.subscriptionOfferId,
9
9
  paymentAmount: subscriptionDoc.paymentAmount,
10
+ paymentCurrency: subscriptionDoc.paymentCurrency,
10
11
  paymentTypeId: subscriptionDoc.paymentTypeId,
11
12
  paymentIntentId: subscriptionDoc.paymentIntentId,
12
13
  reductionOfferId: subscriptionDoc.reductionOfferId,
@@ -89,6 +90,10 @@ const recordSubscriptionHistory = async (oldSubscriptionDoc, updatedSubscription
89
90
  * paymentAmount:
90
91
  * type: number
91
92
  * description: Payment amount
93
+ * paymentCurrency:
94
+ * type: string
95
+ * default: EUR
96
+ * description: Payment currency (EUR, USD, DZD, etc.)
92
97
  * paymentTypeId:
93
98
  * type: string
94
99
  * description: Reference to payment type
@@ -136,6 +141,7 @@ const recordSubscriptionHistory = async (oldSubscriptionDoc, updatedSubscription
136
141
  * sellerId: "507f1f77bcf86cd799439012"
137
142
  * planId: "507f1f77bcf86cd799439013"
138
143
  * paymentAmount: 99.99
144
+ * paymentCurrency: "EUR"
139
145
  * paymentIntentId: "507f1f77bcf86cd799439099"
140
146
  * status: "active"
141
147
  * startDate: "2025-12-01T00:00:00.000Z"
@@ -201,6 +207,10 @@ const subscriptionSchema = new mongoose.Schema(
201
207
  type: Number,
202
208
  required: true,
203
209
  },
210
+ paymentCurrency: {
211
+ type: String,
212
+ default: 'EUR',
213
+ },
204
214
  paymentTypeId: {
205
215
  type: mongoose.Schema.Types.ObjectId,
206
216
  required: false,
@@ -266,6 +276,10 @@ const subscriptionSchema = new mongoose.Schema(
266
276
  type: Number,
267
277
  required: false,
268
278
  },
279
+ paymentCurrency: {
280
+ type: String,
281
+ default: 'EUR',
282
+ },
269
283
  paymentTypeId: {
270
284
  type: mongoose.Schema.Types.ObjectId,
271
285
  required: false,
@@ -363,6 +377,10 @@ const subscriptionSchema = new mongoose.Schema(
363
377
  type: Number,
364
378
  required: false,
365
379
  },
380
+ paymentCurrency: {
381
+ type: String,
382
+ default: 'EUR',
383
+ },
366
384
  paymentTypeId: {
367
385
  type: mongoose.Schema.Types.ObjectId,
368
386
  required: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "database-connector",
3
- "version": "2.5.1",
3
+ "version": "2.5.2",
4
4
  "description": "MongoDB models package with Mongoose schemas for e-commerce applications. Includes User, Product, Store, Order and more with built-in validation and virtual properties.",
5
5
  "main": "models/index.js",
6
6
  "scripts": {