-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathevents.proto
More file actions
178 lines (135 loc) · 7.57 KB
/
events.proto
File metadata and controls
178 lines (135 loc) · 7.57 KB
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
syntax = "proto3";
package meridian.financial_gateway_events.v1;
import "buf/validate/validate.proto";
import "google/protobuf/timestamp.proto";
option go_package = "github.com/meridianhub/meridian/api/proto/meridian/financial_gateway_events/v1;financialgatewayeventsv1";
// PaymentCapturedEvent is published when a Stripe payment_intent.succeeded webhook
// is received and validated. It signals that a payment has been successfully captured
// by the payment provider.
message PaymentCapturedEvent {
// event_id uniquely identifies this event instance (UUID).
string event_id = 1 [(buf.validate.field).string.uuid = true];
// correlation_id links all events across services for a single user request.
string correlation_id = 2 [(buf.validate.field).string.max_len = 255];
// causation_id identifies the provider event that caused this domain event.
string causation_id = 3 [(buf.validate.field).string.max_len = 255];
// version is the event schema version for forward compatibility.
int32 version = 4 [(buf.validate.field).int32.gte = 1];
// payment_order_id is the Meridian payment order associated with this capture.
// May be empty if the Stripe payment was not created via Meridian (no payment_order_id in metadata).
string payment_order_id = 5 [(buf.validate.field).string.max_len = 255];
// provider_reference_id is the payment provider's identifier (e.g., Stripe PaymentIntent ID).
string provider_reference_id = 6 [(buf.validate.field).string = {
min_len: 1
max_len: 255
}];
// amount_minor_units is the captured amount in the smallest currency unit (e.g., cents for USD).
int64 amount_minor_units = 7 [(buf.validate.field).int64.gte = 0];
// currency is the ISO 4217 currency code (e.g., "USD", "GBP").
// May be empty if the provider did not include currency in the webhook payload.
string currency = 8 [(buf.validate.field).string.max_len = 3];
// captured_at is when the payment was captured by the provider.
google.protobuf.Timestamp captured_at = 9;
// provider_event_id is the payment provider's webhook event ID (e.g., Stripe evt_ ID).
// Used for idempotency and deduplication.
string provider_event_id = 10 [(buf.validate.field).string = {
min_len: 1
max_len: 255
}];
// metadata contains additional key-value pairs from the provider event.
map<string, string> metadata = 11 [(buf.validate.field).map = {
max_pairs: 64
keys: {string: {max_len: 128}}
values: {string: {max_len: 1024}}
}];
}
// PaymentFailedEvent is published when a Stripe payment_intent.payment_failed webhook
// is received and validated. It signals that a payment attempt was rejected by the provider.
message PaymentFailedEvent {
// event_id uniquely identifies this event instance (UUID).
string event_id = 1 [(buf.validate.field).string.uuid = true];
// correlation_id links all events across services for a single user request.
string correlation_id = 2 [(buf.validate.field).string.max_len = 255];
// causation_id identifies the provider event that caused this domain event.
string causation_id = 3 [(buf.validate.field).string.max_len = 255];
// version is the event schema version for forward compatibility.
int32 version = 4 [(buf.validate.field).int32.gte = 1];
// payment_order_id is the Meridian payment order associated with this failure.
// May be empty if the Stripe payment was not created via Meridian (no payment_order_id in metadata).
string payment_order_id = 5 [(buf.validate.field).string.max_len = 255];
// provider_reference_id is the payment provider's identifier (e.g., Stripe PaymentIntent ID).
string provider_reference_id = 6 [(buf.validate.field).string = {
min_len: 1
max_len: 255
}];
// failure_reason is a human-readable description of why the payment failed.
string failure_reason = 7 [(buf.validate.field).string.max_len = 1024];
// failure_code is the provider's machine-readable failure code (e.g., Stripe decline code).
string failure_code = 8 [(buf.validate.field).string.max_len = 255];
// provider_event_id is the payment provider's webhook event ID (e.g., Stripe evt_ ID).
// Used for idempotency and deduplication.
string provider_event_id = 9 [(buf.validate.field).string = {
min_len: 1
max_len: 255
}];
// failed_at is when the payment failure occurred.
google.protobuf.Timestamp failed_at = 10;
}
// PaymentRefundedEvent is published when a Stripe charge.refunded webhook
// is received and validated. It signals that a payment has been partially or fully refunded.
message PaymentRefundedEvent {
// event_id uniquely identifies this event instance (UUID).
string event_id = 1 [(buf.validate.field).string.uuid = true];
// correlation_id links all events across services for a single user request.
string correlation_id = 2 [(buf.validate.field).string.max_len = 255];
// causation_id identifies the provider event that caused this domain event.
string causation_id = 3 [(buf.validate.field).string.max_len = 255];
// version is the event schema version for forward compatibility.
int32 version = 4 [(buf.validate.field).int32.gte = 1];
// payment_order_id is the Meridian payment order associated with this refund.
string payment_order_id = 5 [(buf.validate.field).string.max_len = 255];
// provider_reference_id is the payment provider's identifier (e.g., Stripe Charge ID).
string provider_reference_id = 6 [(buf.validate.field).string = {
min_len: 1
max_len: 255
}];
// amount_refunded_minor_units is the refunded amount in the smallest currency unit (e.g., cents for USD).
int64 amount_refunded_minor_units = 7 [(buf.validate.field).int64.gte = 0];
// currency is the ISO 4217 currency code (e.g., "USD", "GBP").
string currency = 8 [(buf.validate.field).string.max_len = 3];
// provider_event_id is the payment provider's webhook event ID (e.g., Stripe evt_ ID).
string provider_event_id = 9 [(buf.validate.field).string = {
min_len: 1
max_len: 255
}];
// refunded_at is when the refund was processed by the provider.
google.protobuf.Timestamp refunded_at = 10;
}
// PaymentDisputedEvent is published when a Stripe charge.dispute.created webhook
// is received and validated. It signals that a payment has been disputed by the cardholder.
message PaymentDisputedEvent {
// event_id uniquely identifies this event instance (UUID).
string event_id = 1 [(buf.validate.field).string.uuid = true];
// correlation_id links all events across services for a single user request.
string correlation_id = 2 [(buf.validate.field).string.max_len = 255];
// causation_id identifies the provider event that caused this domain event.
string causation_id = 3 [(buf.validate.field).string.max_len = 255];
// version is the event schema version for forward compatibility.
int32 version = 4 [(buf.validate.field).int32.gte = 1];
// payment_order_id is the Meridian payment order associated with this dispute.
string payment_order_id = 5 [(buf.validate.field).string.max_len = 255];
// provider_reference_id is the payment provider's identifier (e.g., Stripe Charge ID).
string provider_reference_id = 6 [(buf.validate.field).string = {
min_len: 1
max_len: 255
}];
// dispute_reason is the provider's reason for the dispute (e.g., "fraudulent", "product_not_received").
string dispute_reason = 7 [(buf.validate.field).string.max_len = 255];
// provider_event_id is the payment provider's webhook event ID (e.g., Stripe evt_ ID).
string provider_event_id = 8 [(buf.validate.field).string = {
min_len: 1
max_len: 255
}];
// disputed_at is when the dispute was created by the provider.
google.protobuf.Timestamp disputed_at = 9;
}