@sellout/models 0.0.428 → 0.0.429

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellout/models",
3
- "version": "0.0.428",
3
+ "version": "0.0.429",
4
4
  "description": "Sellout.io models",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@apollo/client": "^3.9.6",
20
20
  "@hapi/joi": "^17.1.1",
21
- "@sellout/utils": "^0.0.428",
21
+ "@sellout/utils": "^0.0.429",
22
22
  "@types/hapi__joi": "^16.0.1",
23
23
  "@types/shortid": "^0.0.29",
24
24
  "@types/zen-observable": "^0.8.7",
@@ -33,5 +33,5 @@
33
33
  "protobufjs": "^6.11.2",
34
34
  "typescript": "^4.9.5"
35
35
  },
36
- "gitHead": "87d220762b3a60a47737eb967c321a2cb5e50913"
36
+ "gitHead": "29265758859924c2be553ccb66ee046872964ba7"
37
37
  }
@@ -0,0 +1,45 @@
1
+ export enum DisputeStatusEnum {
2
+ WarningNeedsResponse = 'warning_needs_response',
3
+ WarningUnderReview = 'warning_under_review',
4
+ WarningClosed = 'warning_closed',
5
+ NeedsResponse = 'needs_response',
6
+ UnderReview = 'under_review',
7
+ Won = 'won',
8
+ Lost = 'lost',
9
+ Prevented = 'prevented',
10
+ }
11
+
12
+ export const CLOSED_DISPUTE_STATUSES: string[] = [
13
+ DisputeStatusEnum.Won,
14
+ DisputeStatusEnum.Lost,
15
+ DisputeStatusEnum.WarningClosed,
16
+ ];
17
+
18
+ export function isInquiryStatus(status: string): boolean {
19
+ return typeof status === 'string' && status.startsWith('warning_');
20
+ }
21
+
22
+ export interface IDisputeEmailedAt {
23
+ created?: number;
24
+ closed?: number;
25
+ }
26
+
27
+ export default interface IDispute {
28
+ _id?: string;
29
+ stripeDisputeId: string;
30
+ stripeAccountId?: string;
31
+ stripeChargeId?: string;
32
+ paymentIntentId?: string;
33
+ orgId?: string;
34
+ orderId?: string;
35
+ amount?: number;
36
+ currency?: string;
37
+ reason?: string;
38
+ status?: string;
39
+ isInquiry?: boolean;
40
+ dueBy?: number;
41
+ emailedAt?: IDisputeEmailedAt;
42
+ processedEventIds?: string[];
43
+ createdAt?: number;
44
+ updatedAt?: number;
45
+ }
@@ -429,6 +429,25 @@ message orderExportIssueEmailRequest {
429
429
  repeated dayIdsTimeObj dayIdsTime = 14;
430
430
  }
431
431
 
432
+ message QueueChargebackEmailRequest {
433
+ string spanContext = 1;
434
+ string toAddress = 2;
435
+ string orderId = 3;
436
+ string eventName = 4;
437
+ int32 amount = 5;
438
+ string currency = 6;
439
+ string reason = 7;
440
+ string status = 8;
441
+ string customerName = 9;
442
+ int32 dueBy = 10;
443
+ bool isClosed = 11;
444
+ string ordersUrl = 12;
445
+ string orgName = 13;
446
+ string disputeId = 14;
447
+ bool livemode = 15;
448
+ repeated string ccAddresses = 16;
449
+ }
450
+
432
451
  service EmailService {
433
452
  // User
434
453
  rpc queueUserWelcomeEmail (QueueUserWelcomeEmailRequest) returns (google.protobuf.Empty) {}
@@ -452,5 +471,6 @@ service EmailService {
452
471
  rpc immediateNotifyEmail (QueueOrderQRCodeEmailRequest) returns (google.protobuf.Empty) {}
453
472
  rpc emailTicketHolder (emailTicketHolderRequest) returns (google.protobuf.Empty) {}
454
473
  rpc orderExportIssueEmail (orderExportIssueEmailRequest) returns (google.protobuf.Empty) {}
474
+ rpc queueChargebackEmail (QueueChargebackEmailRequest) returns (google.protobuf.Empty) {}
455
475
 
456
476
  }
@@ -1106,6 +1106,34 @@ message FindMobileCheckInOrderResponse {
1106
1106
  MobileCheckInOrder order = 3;
1107
1107
  }
1108
1108
 
1109
+ message ProcessStripeDisputeRequest {
1110
+ string spanContext = 0;
1111
+ // Stripe's event id, used to make redeliveries a no-op.
1112
+ string eventId = 1;
1113
+ // charge.dispute.created or charge.dispute.closed.
1114
+ string eventType = 2;
1115
+ // The connected account the dispute was raised on. Empty for platform charges.
1116
+ string stripeAccountId = 3;
1117
+ string disputeId = 4;
1118
+ string chargeId = 5;
1119
+ string paymentIntentId = 6;
1120
+ // The disputed amount, which can differ from the order total.
1121
+ int32 amount = 7;
1122
+ string currency = 8;
1123
+ string reason = 9;
1124
+ string status = 10;
1125
+ // Deadline for responding to the issuer.
1126
+ int32 dueBy = 11;
1127
+ // A production Connect endpoint receives test events too - only live ones
1128
+ // should reach a promoter's inbox.
1129
+ bool livemode = 12;
1130
+ }
1131
+
1132
+ message ProcessStripeDisputeResponse {
1133
+ StatusCode status = 0;
1134
+ repeated Error errors = 1;
1135
+ }
1136
+
1109
1137
  service OrderService {
1110
1138
  // Create
1111
1139
  rpc createOrder(CreateOrderRequest) returns (CreateOrderResponse) {}
@@ -1173,4 +1201,6 @@ service OrderService {
1173
1201
  // On-Demand Wallet Pass Generation
1174
1202
  rpc generateWalletPass(GenerateWalletPassRequest) returns(GenerateWalletPassResponse){}
1175
1203
  rpc resendTicketShareOffer(ResendTicketShareOfferRequest) returns(UpdateOrderResponse){}
1204
+ // Stripe Disputes (Chargebacks)
1205
+ rpc processStripeDispute(ProcessStripeDisputeRequest) returns(ProcessStripeDisputeResponse){}
1176
1206
  }
@@ -123,6 +123,17 @@ message FindOrganizationResponse {
123
123
  Organization organization = 2;
124
124
  }
125
125
 
126
+ message FindOrganizationByStripeIdRequest {
127
+ string spanContext = 0;
128
+ string stripeId = 1;
129
+ }
130
+
131
+ message FindOrganizationByStripeIdResponse {
132
+ StatusCode status = 0;
133
+ repeated Error errors = 1;
134
+ Organization organization = 2;
135
+ }
136
+
126
137
  // Delete Organization
127
138
  message DeleteOrganizationRequest {
128
139
  string spanContext = 0;
@@ -194,7 +205,8 @@ service OrganizationService {
194
205
  rpc updateOrganization(UpdateOrganizationRequest) returns (UpdateOrganizationResponse) {}
195
206
  rpc updateOrgEmailWebhook(UpdateOrgEmailWebhookRequest) returns (UpdateOrgEmailWebhookResponse) {}
196
207
  // Find
197
- rpc findOrganization(FindOrganizationRequest) returns (FindOrganizationResponse) {}
208
+ rpc findOrganization(FindOrganizationRequest) returns (FindOrganizationResponse) {}
209
+ rpc findOrganizationByStripeId(FindOrganizationByStripeIdRequest) returns (FindOrganizationByStripeIdResponse) {}
198
210
  // Delete
199
211
  rpc deleteOrganization(DeleteOrganizationRequest) returns (DeleteOrganizationResponse) {}
200
212
  // Remove Stripe ID
@@ -0,0 +1,86 @@
1
+ import shortid from 'shortid';
2
+
3
+ export default {
4
+ _id: {
5
+ type: String,
6
+ default: shortid.generate,
7
+ },
8
+ stripeDisputeId: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+ stripeAccountId: {
13
+ type: String,
14
+ required: false,
15
+ },
16
+ stripeChargeId: {
17
+ type: String,
18
+ required: false,
19
+ index: true,
20
+ },
21
+ paymentIntentId: {
22
+ type: String,
23
+ required: false,
24
+ },
25
+ orgId: {
26
+ type: String,
27
+ required: false,
28
+ index: true,
29
+ },
30
+ orderId: {
31
+ type: String,
32
+ required: false,
33
+ index: true,
34
+ },
35
+ amount: {
36
+ type: Number,
37
+ required: false,
38
+ },
39
+ currency: {
40
+ type: String,
41
+ required: false,
42
+ },
43
+ reason: {
44
+ type: String,
45
+ required: false,
46
+ },
47
+ status: {
48
+ type: String,
49
+ required: false,
50
+ },
51
+ isInquiry: {
52
+ type: Boolean,
53
+ required: false,
54
+ default: false,
55
+ },
56
+ dueBy: {
57
+ type: Number,
58
+ required: false,
59
+ default: null,
60
+ },
61
+ emailedAt: {
62
+ created: {
63
+ type: Number,
64
+ required: false,
65
+ default: null,
66
+ },
67
+ closed: {
68
+ type: Number,
69
+ required: false,
70
+ default: null,
71
+ },
72
+ },
73
+ processedEventIds: {
74
+ type: [String],
75
+ required: false,
76
+ default: [],
77
+ },
78
+ createdAt: {
79
+ type: Number,
80
+ required: false,
81
+ },
82
+ updatedAt: {
83
+ type: Number,
84
+ required: false,
85
+ },
86
+ };