@sellout/models 0.0.388 → 0.0.389
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/.dist/graphql/queries/eventsAdminCalender.query.js +3 -0
- package/.dist/graphql/queries/eventsAdminCalender.query.js.map +1 -1
- package/.dist/graphql/queries/eventsListOptimized.query.js +4 -1
- package/.dist/graphql/queries/eventsListOptimized.query.js.map +1 -1
- package/.dist/interfaces/IAnalytics.d.ts +1 -0
- package/.dist/interfaces/IAnalytics.js.map +1 -1
- package/.dist/interfaces/IEvent.d.ts +1 -0
- package/.dist/interfaces/IOrder.d.ts +12 -0
- package/.dist/interfaces/IOrder.js.map +1 -1
- package/.dist/interfaces/IPassKitDeviceRegistration.d.ts +11 -0
- package/.dist/interfaces/IPassKitDeviceRegistration.js +3 -0
- package/.dist/interfaces/IPassKitDeviceRegistration.js.map +1 -0
- package/.dist/interfaces/ITask.d.ts +2 -1
- package/.dist/interfaces/ITask.js +1 -0
- package/.dist/interfaces/ITask.js.map +1 -1
- package/.dist/schemas/Event.d.ts +5 -0
- package/.dist/schemas/Event.js +5 -0
- package/.dist/schemas/Event.js.map +1 -1
- package/.dist/schemas/Order.d.ts +34 -0
- package/.dist/schemas/Order.js +36 -0
- package/.dist/schemas/Order.js.map +1 -1
- package/.dist/schemas/WalletPassDevice.d.ts +45 -0
- package/.dist/schemas/WalletPassDevice.js +51 -0
- package/.dist/schemas/WalletPassDevice.js.map +1 -0
- package/.dist/sellout-proto.js +5151 -341
- package/.dist/utils/OrderUtil.js +0 -79
- package/.dist/utils/OrderUtil.js.map +1 -1
- package/package.json +3 -3
- package/src/graphql/queries/eventsAdminCalender.query.ts +3 -0
- package/src/graphql/queries/eventsListOptimized.query.ts +4 -1
- package/src/interfaces/IAnalytics.ts +1 -0
- package/src/interfaces/IEvent.ts +1 -0
- package/src/interfaces/IOrder.ts +21 -7
- package/src/interfaces/IPassKitDeviceRegistration.ts +11 -0
- package/src/interfaces/ITask.ts +1 -0
- package/src/proto/broadcast.proto +14 -0
- package/src/proto/email.proto +2 -0
- package/src/proto/event.proto +30 -0
- package/src/proto/order.proto +77 -0
- package/src/schemas/Event.ts +5 -0
- package/src/schemas/Order.ts +39 -1
- package/src/schemas/WalletPassDevice.ts +46 -0
- package/src/utils/OrderUtil.ts +0 -93
package/src/utils/OrderUtil.ts
CHANGED
|
@@ -44,99 +44,6 @@ export default {
|
|
|
44
44
|
if (!order.tickets) order.tickets = [];
|
|
45
45
|
if (!order.upgrades) order.upgrades = [];
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
// const ticketFees = fees.filter(f => f.appliedTo === "Ticket");
|
|
49
|
-
// const upgradeFees = fees.filter(f => f.appliedTo === "Upgrade");
|
|
50
|
-
// let orderFees = fees.filter(f => f.appliedTo === "Order");
|
|
51
|
-
|
|
52
|
-
// function applyTicketFee(ticket, fee) {
|
|
53
|
-
// if (fee.filters.includes("Seated") && !ticket.seat) return 0;
|
|
54
|
-
// const noMax = fee.maxAppliedToPrice === 0;
|
|
55
|
-
// if (
|
|
56
|
-
// (fee.minAppliedToPrice <= ticket.price &&
|
|
57
|
-
// ticket.price <= fee.maxAppliedToPrice) ||
|
|
58
|
-
// noMax
|
|
59
|
-
// ) {
|
|
60
|
-
// if (fee.type === "Flat") {
|
|
61
|
-
// return fee.value;
|
|
62
|
-
// }
|
|
63
|
-
// if (fee.type === "Percent") {
|
|
64
|
-
// return (ticket.price * fee.value) / 100;
|
|
65
|
-
// }
|
|
66
|
-
// } else {
|
|
67
|
-
// return 0;
|
|
68
|
-
// }
|
|
69
|
-
// }
|
|
70
|
-
|
|
71
|
-
// function applyUpgradeFee(upgrade, fee) {
|
|
72
|
-
// const noMax = fee.maxAppliedToPrice === 0;
|
|
73
|
-
// if (
|
|
74
|
-
// (fee.minAppliedToPrice <= upgrade.price &&
|
|
75
|
-
// upgrade.price <= fee.minAppliedToPrice) ||
|
|
76
|
-
// noMax
|
|
77
|
-
// ) {
|
|
78
|
-
// if (fee.type === "Flat") {
|
|
79
|
-
// return fee.value;
|
|
80
|
-
// }
|
|
81
|
-
// if (fee.type === "Percent") {
|
|
82
|
-
// return (upgrade.price * fee.value) / 100;
|
|
83
|
-
// }
|
|
84
|
-
// } else {
|
|
85
|
-
// return 0;
|
|
86
|
-
// }
|
|
87
|
-
// }
|
|
88
|
-
|
|
89
|
-
// function applyOrderFee(orderSubtotal, fee) {
|
|
90
|
-
// if (fee.type === "Flat") {
|
|
91
|
-
// return orderSubtotal + fee.value;
|
|
92
|
-
// }
|
|
93
|
-
// if (fee.type === "Percent") {
|
|
94
|
-
// return orderSubtotal / (1 - fee.value / 100);
|
|
95
|
-
// }
|
|
96
|
-
// }
|
|
97
|
-
|
|
98
|
-
// const ticketTotal = order.tickets.reduce(
|
|
99
|
-
// (cur, ticket) => cur + ticket.price,
|
|
100
|
-
// 0
|
|
101
|
-
// );
|
|
102
|
-
|
|
103
|
-
// const ticketFeeTotal = order.tickets.reduce((cur, ticket) => {
|
|
104
|
-
// return (
|
|
105
|
-
// cur +
|
|
106
|
-
// ticketFees.reduce((cur, fee) => cur + applyTicketFee(ticket, fee), 0)
|
|
107
|
-
// );
|
|
108
|
-
// }, 0);
|
|
109
|
-
|
|
110
|
-
// const upgradeTotal = order.upgrades.reduce(
|
|
111
|
-
// (cur, upgrade) => cur + upgrade.price,
|
|
112
|
-
// 0
|
|
113
|
-
// );
|
|
114
|
-
|
|
115
|
-
// const upgradeFeeTotal = order.upgrades.reduce((cur, upgrade) => {
|
|
116
|
-
// return (
|
|
117
|
-
// cur +
|
|
118
|
-
// upgradeFees.reduce((cur, fee) => cur + applyUpgradeFee(upgrade, fee), 0)
|
|
119
|
-
// );
|
|
120
|
-
// }, 0);
|
|
121
|
-
// const orderSubtotal =
|
|
122
|
-
// ticketTotal + ticketFeeTotal + upgradeTotal + upgradeFeeTotal;
|
|
123
|
-
|
|
124
|
-
// // Order matters here. Flat type fees must be
|
|
125
|
-
// // applied before Percent type fees
|
|
126
|
-
// orderFees = orderFees.sort(({ type }) => {
|
|
127
|
-
// if (type === "Flat") return -1;
|
|
128
|
-
// return 1;
|
|
129
|
-
// });
|
|
130
|
-
|
|
131
|
-
// const orderTotal = orderFees.reduce((cur, fee) => {
|
|
132
|
-
// return applyOrderFee(cur, fee);
|
|
133
|
-
// }, orderSubtotal) || 0;
|
|
134
|
-
|
|
135
|
-
// console.log("orderTotal orderTotal+++++>>",orderTotal );
|
|
136
|
-
|
|
137
|
-
// return Math.round(orderTotal);
|
|
138
|
-
|
|
139
|
-
|
|
140
47
|
const ticketTotal = order.tickets.reduce(
|
|
141
48
|
(cur, ticket) => cur + ticket.price,
|
|
142
49
|
0
|