-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPaymentIntent.model.ts
82 lines (79 loc) · 1.39 KB
/
PaymentIntent.model.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
const mongoose = require("mongoose");
const PaymentIntentSchema = new mongoose.Schema({
accountID: {
type: String,
required: true,
},
total: {
type: Number,
required: true,
},
clientSecret: {
type: String,
required: true,
},
type: {
type: String,
required: true,
},
cashbackCompany: {
type: Number,
required: true,
},
cashbackAccumulated: {
type: Number,
required: true,
},
cashbackUsed: {
type: Number,
required: true,
},
shopID: {
type: mongoose.Types.ObjectId,
required: true,
},
shopName: {
type: String,
required: true,
},
firebaseCompanyID: {
type: String,
required: true,
},
firebaseUserID: {
type: String,
required: true,
},
fee: {
type: Number,
required: true,
},
isActive: {
type: Boolean,
required: true,
},
products: [
{
id: {
type: mongoose.Types.ObjectId,
required: true,
},
name: {
type: String,
required: true,
},
quantity: {
type: Number,
required: true,
},
price: { type: Number, required: true },
weight: {
type: Number,
required: true,
},
},
],
});
PaymentIntentSchema.index({ firebaseUserID: 1, shopID: 1 });
const PaymentIntent = mongoose.model("payment_intent", PaymentIntentSchema);
export default PaymentIntent;