@sellout/models 0.0.395 → 0.0.397

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.
Files changed (47) hide show
  1. package/.dist/graphql/queries/eventsAdminCalender.query.js +0 -3
  2. package/.dist/graphql/queries/eventsAdminCalender.query.js.map +1 -1
  3. package/.dist/graphql/queries/eventsListOptimized.query.js +1 -4
  4. package/.dist/graphql/queries/eventsListOptimized.query.js.map +1 -1
  5. package/.dist/interfaces/IAnalytics.d.ts +0 -1
  6. package/.dist/interfaces/IAnalytics.js.map +1 -1
  7. package/.dist/interfaces/IEvent.d.ts +0 -1
  8. package/.dist/interfaces/IOrder.d.ts +0 -12
  9. package/.dist/interfaces/IOrder.js.map +1 -1
  10. package/.dist/interfaces/ITask.d.ts +1 -2
  11. package/.dist/interfaces/ITask.js +0 -1
  12. package/.dist/interfaces/ITask.js.map +1 -1
  13. package/.dist/schemas/Event.d.ts +0 -5
  14. package/.dist/schemas/Event.js +0 -5
  15. package/.dist/schemas/Event.js.map +1 -1
  16. package/.dist/schemas/Order.d.ts +0 -34
  17. package/.dist/schemas/Order.js +0 -36
  18. package/.dist/schemas/Order.js.map +1 -1
  19. package/.dist/sellout-proto.js +341 -5771
  20. package/.dist/utils/OrderUtil.js +79 -0
  21. package/.dist/utils/OrderUtil.js.map +1 -1
  22. package/.dist/utils/PaymentUtil.js +12 -0
  23. package/.dist/utils/PaymentUtil.js.map +1 -1
  24. package/package.json +3 -3
  25. package/src/graphql/queries/eventsAdminCalender.query.ts +0 -3
  26. package/src/graphql/queries/eventsListOptimized.query.ts +1 -4
  27. package/src/interfaces/IAnalytics.ts +0 -1
  28. package/src/interfaces/IEvent.ts +0 -1
  29. package/src/interfaces/IOrder.ts +7 -21
  30. package/src/interfaces/ITask.ts +0 -1
  31. package/src/proto/broadcast.proto +0 -14
  32. package/src/proto/email.proto +0 -2
  33. package/src/proto/event.proto +0 -30
  34. package/src/proto/file-upload.proto +1 -16
  35. package/src/proto/order.proto +0 -77
  36. package/src/schemas/Event.ts +0 -5
  37. package/src/schemas/Order.ts +1 -39
  38. package/src/utils/OrderUtil.ts +93 -0
  39. package/src/utils/PaymentUtil.ts +15 -0
  40. package/.dist/interfaces/IPassKitDeviceRegistration.d.ts +0 -11
  41. package/.dist/interfaces/IPassKitDeviceRegistration.js +0 -3
  42. package/.dist/interfaces/IPassKitDeviceRegistration.js.map +0 -1
  43. package/.dist/schemas/WalletPassDevice.d.ts +0 -45
  44. package/.dist/schemas/WalletPassDevice.js +0 -51
  45. package/.dist/schemas/WalletPassDevice.js.map +0 -1
  46. package/src/interfaces/IPassKitDeviceRegistration.ts +0 -11
  47. package/src/schemas/WalletPassDevice.ts +0 -46
@@ -48,8 +48,6 @@ message Order {
48
48
  string parentOrderId = 37;
49
49
  repeated SharingOrderInfo sharing = 38;
50
50
  ParentOrderDetails parentOrderDetails = 39;
51
- AppleWallet appleWallet = 40;
52
- GoogleWallet googleWallet = 41;
53
51
  }
54
52
 
55
53
  message ParentOrderDetails {
@@ -58,18 +56,6 @@ message ParentOrderDetails {
58
56
  string eventName = 2;
59
57
  }
60
58
 
61
- message AppleWallet {
62
- string url = 0;
63
- string serialNumber = 1;
64
- string authToken = 2;
65
- int32 lastModified = 3;
66
- }
67
-
68
- message GoogleWallet {
69
- string url = 0;
70
- string objectId = 1;
71
- }
72
-
73
59
  message OrderIntegrationResponse {
74
60
  bool success = 0;
75
61
  string title = 1;
@@ -692,7 +678,6 @@ message OrderAnalyticsQuery {
692
678
  string interval = 6;
693
679
  repeated string types = 7;
694
680
  string seasonId = 8;
695
- bool isEventCalendar = 9;
696
681
  }
697
682
 
698
683
  message QueryOrderAnalyticsRequest {
@@ -861,63 +846,6 @@ message QueryOrgDeletableResponse {
861
846
  bool isOrgDeletable = 2;
862
847
  }
863
848
 
864
- /****************************************************************************************
865
- Apple Wallet PassKit Device Registration
866
- ****************************************************************************************/
867
-
868
- message RegisterPassKitDeviceRequest {
869
- string spanContext = 0;
870
- string deviceLibraryIdentifier = 1;
871
- string pushToken = 2;
872
- string passTypeIdentifier = 3;
873
- string serialNumber = 4;
874
- string orderId = 5;
875
- string orgId = 6;
876
- }
877
-
878
- message RegisterPassKitDeviceResponse {
879
- StatusCode status = 0;
880
- repeated Error errors = 1;
881
- bool alreadyExists = 2;
882
- }
883
-
884
- message UnregisterPassKitDeviceRequest {
885
- string spanContext = 0;
886
- string deviceLibraryIdentifier = 1;
887
- string passTypeIdentifier = 2;
888
- string serialNumber = 3;
889
- }
890
-
891
- message UnregisterPassKitDeviceResponse {
892
- StatusCode status = 0;
893
- repeated Error errors = 1;
894
- bool deleted = 2;
895
- }
896
-
897
- message GetPassKitSerialNumbersRequest {
898
- string spanContext = 0;
899
- string deviceLibraryIdentifier = 1;
900
- string passTypeIdentifier = 2;
901
- int64 passesUpdatedSince = 3;
902
- }
903
-
904
- message GetPassKitSerialNumbersResponse {
905
- StatusCode status = 0;
906
- repeated Error errors = 1;
907
- repeated string serialNumbers = 2;
908
- string lastUpdated = 3;
909
- }
910
-
911
- message GetPassKitPushTokensRequest {
912
- string spanContext = 0;
913
- string orderId = 1;
914
- }
915
-
916
- message GetPassKitPushTokensResponse {
917
- StatusCode status = 0;
918
- repeated Error errors = 1;
919
- repeated string pushTokens = 2;
920
- }
921
849
 
922
850
  service OrderService {
923
851
  // Create
@@ -969,9 +897,4 @@ service OrderService {
969
897
  rpc orderIntegrationUpdate(OrderIntegrationUpdateRequest) returns(OrderIntegrationUpdateResponse){}
970
898
  rpc emailTicketHolders(EmailTicketHolderRequest) returns(EmailTicketHolderResponse){}
971
899
  rpc queryOrgDeletable(QueryOrgDeletableRequest) returns(QueryOrgDeletableResponse){}
972
- // Apple Wallet PassKit Device Registration
973
- rpc registerPassKitDevice(RegisterPassKitDeviceRequest) returns(RegisterPassKitDeviceResponse){}
974
- rpc unregisterPassKitDevice(UnregisterPassKitDeviceRequest) returns(UnregisterPassKitDeviceResponse){}
975
- rpc getPassKitSerialNumbers(GetPassKitSerialNumbersRequest) returns(GetPassKitSerialNumbersResponse){}
976
- rpc getPassKitPushTokens(GetPassKitPushTokensRequest) returns(GetPassKitPushTokensResponse){}
977
900
  }
@@ -654,9 +654,4 @@ export default {
654
654
  required: false,
655
655
  default: null,
656
656
  },
657
- googleWalletClassId: {
658
- type: String,
659
- required: false,
660
- default: null,
661
- },
662
657
  };
@@ -218,7 +218,7 @@ const OrderTicket = {
218
218
  guestTicket: {
219
219
  type: Boolean,
220
220
  required: false
221
- },
221
+ },
222
222
  isTicketSharing: {
223
223
  type: Boolean,
224
224
  required: false,
@@ -453,42 +453,6 @@ const Payment = {
453
453
  billingAddress: BillingAddress,
454
454
  }
455
455
 
456
- const AppleWallet = {
457
- url: {
458
- type: String,
459
- required: false,
460
- default: null,
461
- },
462
- serialNumber: {
463
- type: String,
464
- required: false,
465
- default: null,
466
- },
467
- authToken: {
468
- type: String,
469
- required: false,
470
- default: null,
471
- },
472
- lastModified: {
473
- type: Number,
474
- required: false,
475
- default: null,
476
- },
477
- }
478
-
479
- const GoogleWallet = {
480
- url: {
481
- type: String,
482
- required: false,
483
- default: null,
484
- },
485
- objectId: {
486
- type: String,
487
- required: false,
488
- default: null,
489
- }
490
- }
491
-
492
456
  const orderIntegrationResponse = {
493
457
  _id: {
494
458
  type: String,
@@ -701,6 +665,4 @@ export default {
701
665
  required: false,
702
666
  default: null,
703
667
  },
704
- appleWallet: AppleWallet,
705
- googleWallet: GoogleWallet,
706
668
  };
@@ -44,6 +44,99 @@ 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
+
47
140
  const ticketTotal = order.tickets.reduce(
48
141
  (cur, ticket) => cur + ticket.price,
49
142
  0
@@ -793,6 +793,21 @@ class PaymentUtil {
793
793
 
794
794
  //TODO Group by label and sum the amount
795
795
  const feeMap = new Map<string, number>();
796
+
797
+ // filteredFees?.forEach((fee) => {
798
+ // const amount =
799
+ // fee?.type === FeeTypeEnum.Flat
800
+ // ? fee.value
801
+ // : (fee.value / 100) * price;
802
+
803
+ // const label =
804
+ // fee?.appliedBy === FeeAppliedByEnum.Sellout
805
+ // ? "Sellout service fees"
806
+ // : fee.name;
807
+
808
+ // const current = feeMap.get(label) || 0;
809
+ // feeMap.set(label, current + amount);
810
+ // });
796
811
  filteredFees.forEach((fee) => {
797
812
  const amount =
798
813
  fee.type === FeeTypeEnum.Flat
@@ -1,11 +0,0 @@
1
- export default interface IPassKitDeviceRegistration {
2
- _id?: string;
3
- deviceLibraryIdentifier: string;
4
- pushToken: string;
5
- passTypeIdentifier: string;
6
- serialNumber: string;
7
- orderId: string;
8
- orgId: string;
9
- createdAt: number;
10
- updatedAt?: number;
11
- }
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=IPassKitDeviceRegistration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"IPassKitDeviceRegistration.js","sourceRoot":"","sources":["../../src/interfaces/IPassKitDeviceRegistration.ts"],"names":[],"mappings":""}
@@ -1,45 +0,0 @@
1
- declare const _default: {
2
- _id: {
3
- type: StringConstructor;
4
- default: () => string;
5
- };
6
- deviceLibraryIdentifier: {
7
- type: StringConstructor;
8
- required: boolean;
9
- index: boolean;
10
- };
11
- pushToken: {
12
- type: StringConstructor;
13
- required: boolean;
14
- };
15
- passTypeIdentifier: {
16
- type: StringConstructor;
17
- required: boolean;
18
- index: boolean;
19
- };
20
- serialNumber: {
21
- type: StringConstructor;
22
- required: boolean;
23
- index: boolean;
24
- };
25
- orderId: {
26
- type: StringConstructor;
27
- required: boolean;
28
- index: boolean;
29
- };
30
- orgId: {
31
- type: StringConstructor;
32
- required: boolean;
33
- index: boolean;
34
- };
35
- createdAt: {
36
- type: NumberConstructor;
37
- required: boolean;
38
- };
39
- updatedAt: {
40
- type: NumberConstructor;
41
- required: boolean;
42
- default: null;
43
- };
44
- };
45
- export default _default;
@@ -1,51 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const shortid_1 = __importDefault(require("shortid"));
7
- exports.default = {
8
- _id: {
9
- type: String,
10
- default: shortid_1.default.generate,
11
- },
12
- deviceLibraryIdentifier: {
13
- type: String,
14
- required: true,
15
- index: true,
16
- },
17
- pushToken: {
18
- type: String,
19
- required: true,
20
- },
21
- passTypeIdentifier: {
22
- type: String,
23
- required: true,
24
- index: true,
25
- },
26
- serialNumber: {
27
- type: String,
28
- required: true,
29
- index: true,
30
- },
31
- orderId: {
32
- type: String,
33
- required: true,
34
- index: true,
35
- },
36
- orgId: {
37
- type: String,
38
- required: true,
39
- index: true,
40
- },
41
- createdAt: {
42
- type: Number,
43
- required: true,
44
- },
45
- updatedAt: {
46
- type: Number,
47
- required: false,
48
- default: null,
49
- },
50
- };
51
- //# sourceMappingURL=WalletPassDevice.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"WalletPassDevice.js","sourceRoot":"","sources":["../../src/schemas/WalletPassDevice.ts"],"names":[],"mappings":";;;;;AAAA,sDAA8B;AAE9B,kBAAe;IACb,GAAG,EAAE;QACH,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,iBAAO,CAAC,QAAQ;KAC1B;IACD,uBAAuB,EAAE;QACvB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ;IACD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACf;IACD,kBAAkB,EAAE;QAClB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ;IACD,OAAO,EAAE;QACP,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ;IACD,KAAK,EAAE;QACL,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,IAAI;KACZ;IACD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACf;IACD,SAAS,EAAE;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,IAAI;KACd;CACF,CAAC"}
@@ -1,11 +0,0 @@
1
- export default interface IPassKitDeviceRegistration {
2
- _id?: string;
3
- deviceLibraryIdentifier: string;
4
- pushToken: string;
5
- passTypeIdentifier: string;
6
- serialNumber: string;
7
- orderId: string;
8
- orgId: string;
9
- createdAt: number;
10
- updatedAt?: number;
11
- }
@@ -1,46 +0,0 @@
1
- import shortid from 'shortid';
2
-
3
- export default {
4
- _id: {
5
- type: String,
6
- default: shortid.generate,
7
- },
8
- deviceLibraryIdentifier: {
9
- type: String,
10
- required: true,
11
- index: true,
12
- },
13
- pushToken: {
14
- type: String,
15
- required: true,
16
- },
17
- passTypeIdentifier: {
18
- type: String,
19
- required: true,
20
- index: true,
21
- },
22
- serialNumber: {
23
- type: String,
24
- required: true,
25
- index: true,
26
- },
27
- orderId: {
28
- type: String,
29
- required: true,
30
- index: true,
31
- },
32
- orgId: {
33
- type: String,
34
- required: true,
35
- index: true,
36
- },
37
- createdAt: {
38
- type: Number,
39
- required: true,
40
- },
41
- updatedAt: {
42
- type: Number,
43
- required: false,
44
- default: null,
45
- },
46
- };