flykup_model_development 3.1.76 → 3.1.77

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.
@@ -13,14 +13,13 @@ const paymentSchema = new mongoose.Schema({
13
13
  },
14
14
  paymentGateway: {
15
15
  type: String,
16
- enum: ['RAZORPAY', 'CASHFREE'],
16
+ enum: ['RAZORPAY', 'CASHFREE','WALLET'],
17
17
  required: true
18
18
  },
19
19
 
20
20
  // Razorpay-specific fields
21
21
  razorpayOrderId: {
22
22
  type: String,
23
- // ✅ This field is now required only if the gateway is RAZORPAY
24
23
  required: function() {
25
24
  return this.paymentGateway === 'RAZORPAY';
26
25
  }
@@ -33,14 +32,12 @@ const paymentSchema = new mongoose.Schema({
33
32
  // Cashfree-specific fields
34
33
  cfPaymentSessionId: {
35
34
  type: String,
36
- // ✅ This field is now required only if the gateway is CASHFREE
37
35
  required: function() {
38
36
  return this.paymentGateway === 'CASHFREE';
39
37
  }
40
38
  },
41
39
  cfOrderId: {
42
40
  type: String,
43
- // ✅ This field is now required only if the gateway is CASHFREE
44
41
  required: function() {
45
42
  return this.paymentGateway === 'CASHFREE';
46
43
  }
@@ -62,24 +59,24 @@ const paymentSchema = new mongoose.Schema({
62
59
  paymentMethod: String,
63
60
  transactionTime: Date,
64
61
 
65
- // ✅ SELLER PAYMENTS FIELD - Now matching package model
62
+ // ✅ SELLER PAYMENTS - Only 4 new fields added
66
63
  sellerPayments: [{
67
64
  sellerId: {
68
65
  type: mongoose.Schema.Types.ObjectId,
69
66
  ref: 'users',
70
67
  required: true
71
68
  },
72
- payableAmount: { // Amount for products only
69
+ payableAmount: {
73
70
  type: Number,
74
71
  required: true,
75
72
  default: 0
76
73
  },
77
- deliveryCharge: { // Delivery fee for this seller's shipment
74
+ deliveryCharge: {
78
75
  type: Number,
79
76
  required: true,
80
77
  default: 0
81
78
  },
82
- totalAmount: { // The sum of payableAmount + deliveryCharge
79
+ totalAmount: {
83
80
  type: Number,
84
81
  required: true,
85
82
  default: 0
@@ -88,6 +85,24 @@ const paymentSchema = new mongoose.Schema({
88
85
  type: String,
89
86
  enum: ['PENDING', 'SETTLED', 'FAILED'],
90
87
  default: 'PENDING'
88
+ },
89
+ // ✅ NEW FIELDS (All optional with defaults - production safe)
90
+ settledAt: {
91
+ type: Date,
92
+ default: null
93
+ },
94
+ settledBy: {
95
+ type: mongoose.Schema.Types.ObjectId,
96
+ ref: 'Admin',
97
+ default: null
98
+ },
99
+ transactionReference: {
100
+ type: String,
101
+ default: null
102
+ },
103
+ failureReason: {
104
+ type: String,
105
+ default: null
91
106
  }
92
107
  }]
93
108
  }, {
@@ -97,6 +112,8 @@ const paymentSchema = new mongoose.Schema({
97
112
  // Create indexes for better performance
98
113
  paymentSchema.index({ razorpayOrderId: 1 });
99
114
  paymentSchema.index({ orderId: 1 });
115
+ paymentSchema.index({ 'sellerPayments.sellerId': 1 });
116
+ paymentSchema.index({ 'sellerPayments.settlementStatus': 1 });
100
117
 
101
118
  const OrderPayment =
102
119
  mongoose.models.OrderPayment || mongoose.model('orderPayment', paymentSchema);
@@ -111,7 +128,6 @@ export default OrderPayment;
111
128
 
112
129
 
113
130
 
114
-
115
131
  // import mongoose from 'mongoose';
116
132
 
117
133
  // const paymentSchema = new mongoose.Schema({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flykup_model_development",
3
- "version": "3.1.76",
3
+ "version": "3.1.77",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "private": false,
@@ -1,30 +0,0 @@
1
- name: Publish to npm
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
-
8
- jobs:
9
- release:
10
- runs-on: ubuntu-latest
11
-
12
- steps:
13
- - uses: actions/checkout@v3
14
-
15
- - name: Set node
16
- uses: actions/setup-node@v3
17
- with:
18
- node-version: "18"
19
- registry-url: "https://registry.npmjs.org/"
20
-
21
- - name: Install dependencies
22
- run: npm install
23
-
24
- - name: Build project
25
- run: npm run build || echo "No build step"
26
-
27
- - name: Publish to npm
28
- run: npm publish --access public
29
- env:
30
- NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
@@ -1,4 +0,0 @@
1
- Seller Name,Owner Name,Email,Mobile,Total Amount,Total Orders,Total Products,Account Number,IFSC Code,Bank Name
2
- "HARISH A","HARISH A","thebrandspot@gmail.com","THEBRANDSPOT","1270","38","38","","",""
3
- "Shanthi","Shanthi","shanthiaravindan81@gmail.com","+919500060775","450","1","1","","",""
4
- "Gokul Krishnan","Gokul Krishnan","gkgokul1817@gmail.com","gokul_krishnan","55","1","1","","",""
@@ -1,4 +0,0 @@
1
- Seller Name,Owner Name,Email,Mobile,Total Amount,Total Orders,Total Products,Account Number,IFSC Code,Bank Name
2
- "HARISH A","HARISH A","thebrandspot@gmail.com","THEBRANDSPOT","1270","38","38","","",""
3
- "Shanthi","Shanthi","shanthiaravindan81@gmail.com","+919500060775","450","1","1","","",""
4
- "Gokul Krishnan","Gokul Krishnan","gkgokul1817@gmail.com","gokul_krishnan","55","1","1","","",""