flykup_model_development 2.0.9 → 3.0.1
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 +1 -3
- package/models/order.modal.js +9 -17
- package/models/orderPayment.model.js +66 -0
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -32,7 +32,7 @@ import ShoppableVideoInteraction from './models/ShoppableInteraction.model.js';
|
|
|
32
32
|
import SellerDraft from './models/sellerDraft.model.js';
|
|
33
33
|
import AadhaarVerification from './models/AadhaarVerification.js';
|
|
34
34
|
import BankVerification from './models/BankVerification.js';
|
|
35
|
-
import GSTVerification from './models/GSTVerification.js'
|
|
35
|
+
import GSTVerification from './models/GSTVerification.js';
|
|
36
36
|
let initialized = false;
|
|
37
37
|
|
|
38
38
|
export async function initializeSharedModels({ token, dbUri }) {
|
|
@@ -134,6 +134,4 @@ export {
|
|
|
134
134
|
AadhaarVerificationModel as AadhaarVerification,
|
|
135
135
|
BankVerificationModel as BankVerification,
|
|
136
136
|
GSTVerificationModel as GSTVerification
|
|
137
|
-
|
|
138
|
-
|
|
139
137
|
};
|
package/models/order.modal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// order.modal.js
|
|
2
|
-
import mongoose
|
|
2
|
+
import mongoose from 'mongoose';
|
|
3
3
|
import { nanoid } from 'nanoid';
|
|
4
4
|
|
|
5
5
|
const orderSchema = new mongoose.Schema(
|
|
@@ -48,17 +48,6 @@ const orderSchema = new mongoose.Schema(
|
|
|
48
48
|
type: String,
|
|
49
49
|
enum: ['CGST+SGST', 'IGST',"NON-GST"],
|
|
50
50
|
required: true
|
|
51
|
-
},
|
|
52
|
-
isFlashSale: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
default: false
|
|
55
|
-
},
|
|
56
|
-
flashSaleId: {
|
|
57
|
-
type: mongoose.Schema.Types.ObjectId,
|
|
58
|
-
ref: 'FlashSale'
|
|
59
|
-
},
|
|
60
|
-
flashPrice: {
|
|
61
|
-
type: Number
|
|
62
51
|
}
|
|
63
52
|
}],
|
|
64
53
|
totalBaseAmount: {
|
|
@@ -147,7 +136,7 @@ const orderSchema = new mongoose.Schema(
|
|
|
147
136
|
}],
|
|
148
137
|
paymentMethod: {
|
|
149
138
|
type: String,
|
|
150
|
-
enum: ['CARD', 'UPI', 'NETBANKING', 'WALLET', 'COD', "PENDING_PAYMENT", "CASHFREE", "Online"],
|
|
139
|
+
enum: ['CARD', 'UPI', 'NETBANKING', 'WALLET', 'COD', "PENDING_PAYMENT", "CASHFREE","RAZORPAY", "Online"],
|
|
151
140
|
required: true
|
|
152
141
|
},
|
|
153
142
|
paymentStatus: {
|
|
@@ -177,9 +166,9 @@ const orderSchema = new mongoose.Schema(
|
|
|
177
166
|
// default: 'ORDERED', // Default should be the initial state
|
|
178
167
|
required: true
|
|
179
168
|
},
|
|
180
|
-
|
|
169
|
+
sourceType: {
|
|
181
170
|
type: String,
|
|
182
|
-
enum: ['static', 'shoppable_video', 'livestream', 'auction'
|
|
171
|
+
enum: ['static', 'shoppable_video', 'livestream', 'auction'],
|
|
183
172
|
required: true
|
|
184
173
|
},
|
|
185
174
|
sourceRefId: String,
|
|
@@ -288,6 +277,9 @@ payment: {
|
|
|
288
277
|
);
|
|
289
278
|
|
|
290
279
|
|
|
291
|
-
|
|
292
|
-
const Order = mongoose.models.Order || mongoose.model('Order', orderSchema);
|
|
280
|
+
const Order = mongoose.model('Order', orderSchema);
|
|
293
281
|
export default Order;
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
// const Order = mongoose.models.Order || mongoose.model('Order', orderSchema);
|
|
285
|
+
// export default Order;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import mongoose from 'mongoose';
|
|
2
|
+
|
|
3
|
+
const paymentSchema = new mongoose.Schema({
|
|
4
|
+
orderId: {
|
|
5
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
6
|
+
ref: 'Order',
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
cfOrderId: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: false,
|
|
12
|
+
default: null
|
|
13
|
+
},
|
|
14
|
+
cfPaymentSessionId: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: false,
|
|
17
|
+
default: null
|
|
18
|
+
},
|
|
19
|
+
// Razorpay fields
|
|
20
|
+
razorpayOrderId: {
|
|
21
|
+
type: String,
|
|
22
|
+
required: false,
|
|
23
|
+
default: null
|
|
24
|
+
},
|
|
25
|
+
razorpayPaymentId: {
|
|
26
|
+
type: String,
|
|
27
|
+
required: false,
|
|
28
|
+
default: null
|
|
29
|
+
},
|
|
30
|
+
userId: {
|
|
31
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
32
|
+
ref: 'users',
|
|
33
|
+
required: true
|
|
34
|
+
},
|
|
35
|
+
amount: {
|
|
36
|
+
type: Number,
|
|
37
|
+
required: true
|
|
38
|
+
},
|
|
39
|
+
currency: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: 'INR'
|
|
42
|
+
},
|
|
43
|
+
status: {
|
|
44
|
+
type: String,
|
|
45
|
+
enum: ['PENDING', 'SUCCESS', 'FAILED',"REFUNDED"],
|
|
46
|
+
default: 'PENDING'
|
|
47
|
+
},
|
|
48
|
+
paymentMethod: String,
|
|
49
|
+
transactionId: String,
|
|
50
|
+
transactionTime: Date,
|
|
51
|
+
sellerPayments: [{
|
|
52
|
+
sellerId: {
|
|
53
|
+
type: mongoose.Schema.Types.ObjectId,
|
|
54
|
+
ref: 'users',
|
|
55
|
+
required: true
|
|
56
|
+
},
|
|
57
|
+
amount: Number,
|
|
58
|
+
settlementStatus: {
|
|
59
|
+
type: String,
|
|
60
|
+
enum: ['PENDING', 'SETTLED'],
|
|
61
|
+
default: 'PENDING'
|
|
62
|
+
}
|
|
63
|
+
}]
|
|
64
|
+
}, { timestamps: true });
|
|
65
|
+
const OrderPayment = mongoose.model('orderPayment', paymentSchema);
|
|
66
|
+
export default OrderPayment;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "flykup_model_development",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"bcrypt": "^5.1.0",
|
|
12
12
|
"crypto": "^1.0.1",
|
|
13
13
|
"dotenv": "^16.4.5",
|
|
14
|
+
"flykup_model_development": "^2.0.9",
|
|
14
15
|
"jsonwebtoken": "^9.0.0",
|
|
15
16
|
"mongoose": "^8.0.0",
|
|
16
17
|
"nanoid": "^5.1.5"
|