@eventcatalog/create-eventcatalog 4.3.12 → 4.3.14-beta.0

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 (72) hide show
  1. package/LICENSE +0 -10
  2. package/dist/index.js +1 -1
  3. package/package.json +1 -1
  4. package/templates/amazon-api-gateway/README-template.md +4 -0
  5. package/templates/asyncapi/README-template.md +4 -0
  6. package/templates/asyncapi/env +0 -5
  7. package/templates/confluent/README-template.md +4 -0
  8. package/templates/default/README-template.md +4 -0
  9. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/CreateProduct/examples/index.mdx +194 -0
  10. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/DeleteProduct/examples/index.mdx +161 -0
  11. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/commands/UpdateProduct/examples/index.mdx +182 -0
  12. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductCreated/examples/index.mdx +227 -0
  13. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductDeleted/examples/index.mdx +175 -0
  14. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/events/ProductUpdated/examples/index.mdx +205 -0
  15. package/templates/default/domains/Catalog/systems/product-catalog-system/services/ProductAPI/queries/GetProduct/examples/index.mdx +205 -0
  16. package/templates/default/domains/Catalog/systems/search-system/services/SearchAPI/queries/SearchProducts/examples/index.mdx +369 -0
  17. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/commands/RegisterCustomer/examples/index.mdx +168 -0
  18. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/commands/UpdateCustomer/examples/index.mdx +168 -0
  19. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/events/CustomerRegistered/examples/index.mdx +201 -0
  20. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/events/CustomerUpdated/examples/index.mdx +194 -0
  21. package/templates/default/domains/Customer/systems/customer-management-system/services/CustomerAPI/queries/GetCustomer/examples/index.mdx +194 -0
  22. package/templates/default/domains/Customer/systems/identity-provider/services/OAuthAPI/commands/AuthenticateCustomer/examples/index.mdx +198 -0
  23. package/templates/default/domains/Customer/systems/identity-provider/services/OAuthAPI/events/CustomerAuthenticated/examples/index.mdx +276 -0
  24. package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentCreated/examples/index.mdx +184 -0
  25. package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentDelivered/examples/index.mdx +173 -0
  26. package/templates/default/domains/Fulfilment/systems/carrier/services/CarrierTrackingAPI/events/ShipmentFailed/examples/index.mdx +265 -0
  27. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/commands/ReleaseInventory/examples/index.mdx +246 -0
  28. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/events/InventoryReserved/examples/index.mdx +227 -0
  29. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/events/InventoryUnavailable/examples/index.mdx +229 -0
  30. package/templates/default/domains/Fulfilment/systems/inventory-system/services/InventoryService/queries/GetStockLevel/examples/index.mdx +186 -0
  31. package/templates/default/domains/Fulfilment/systems/shipping-system/services/CarrierAdapter/commands/CreateShipment/examples/index.mdx +206 -0
  32. package/templates/default/domains/Fulfilment/systems/warehouse-system/services/PickingWorker/events/OrderPacked/examples/index.mdx +172 -0
  33. package/templates/default/domains/Fulfilment/systems/warehouse-system/services/WarehouseService/events/OrderReadyForShipping/examples/index.mdx +208 -0
  34. package/templates/default/domains/Ordering/systems/checkout-system/services/CheckoutOrchestrator/commands/AuthorizePayment/examples/index.mdx +179 -0
  35. package/templates/default/domains/Ordering/systems/checkout-system/services/CheckoutOrchestrator/commands/ReserveInventory/examples/index.mdx +215 -0
  36. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/commands/CancelOrder/examples/index.mdx +163 -0
  37. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/commands/CreateOrder/examples/index.mdx +246 -0
  38. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCancelled/examples/index.mdx +267 -0
  39. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCompleted/examples/index.mdx +171 -0
  40. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/events/OrderCreated/examples/index.mdx +190 -0
  41. package/templates/default/domains/Ordering/systems/order-management-system/services/OrderService/queries/GetOrder/examples/index.mdx +343 -0
  42. package/templates/default/domains/Payments/systems/fraud-detection/services/FraudAPI/events/FraudCheckFailed/examples/index.mdx +271 -0
  43. package/templates/default/domains/Payments/systems/fraud-detection/services/FraudAPI/events/FraudCheckPassed/examples/index.mdx +173 -0
  44. package/templates/default/domains/Payments/systems/payment-processing-system/services/PaymentWorker/events/PaymentRequested/examples/index.mdx +191 -0
  45. package/templates/default/domains/Payments/systems/payment-processing-system/services/PaymentWorker/events/RefundRequested/examples/index.mdx +194 -0
  46. package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/PaymentFailed/examples/index.mdx +265 -0
  47. package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/PaymentSucceeded/examples/index.mdx +190 -0
  48. package/templates/default/domains/Payments/systems/stripe/services/StripeWebhookEndpoint/events/RefundProcessed/examples/index.mdx +186 -0
  49. package/templates/default/domains/Reviews/services/RatingAggregator/events/rating-updated/examples/index.mdx +183 -0
  50. package/templates/default/domains/Reviews/services/ReviewAPI/commands/flag-review/examples/index.mdx +183 -0
  51. package/templates/default/domains/Reviews/services/ReviewAPI/commands/submit-review/examples/index.mdx +195 -0
  52. package/templates/default/domains/Reviews/services/ReviewAPI/commands/vote-review-helpful/examples/index.mdx +178 -0
  53. package/templates/default/domains/Reviews/services/ReviewAPI/events/review-flagged/examples/index.mdx +186 -0
  54. package/templates/default/domains/Reviews/services/ReviewAPI/events/review-helpful-voted/examples/index.mdx +177 -0
  55. package/templates/default/domains/Reviews/services/ReviewAPI/events/review-submitted/examples/index.mdx +194 -0
  56. package/templates/default/domains/Reviews/services/ReviewAPI/queries/get-product-reviews/examples/index.mdx +259 -0
  57. package/templates/default/domains/Reviews/services/ReviewModerationWorker/events/review-published/examples/index.mdx +183 -0
  58. package/templates/default/domains/Reviews/services/ReviewModerationWorker/events/review-rejected/examples/index.mdx +178 -0
  59. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/AddItemToCart/examples/index.mdx +171 -0
  60. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/CheckoutCart/examples/index.mdx +168 -0
  61. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/commands/RemoveItemFromCart/examples/index.mdx +170 -0
  62. package/templates/default/domains/Shopping/systems/cart-system/services/CartAPI/events/CartCheckedOut/examples/index.mdx +275 -0
  63. package/templates/default/domains/Shopping/systems/promotion-system/services/PromotionService/commands/CalculateDiscount/examples/index.mdx +207 -0
  64. package/templates/default/domains/Shopping/systems/promotion-system/services/PromotionService/events/DiscountCalculated/examples/index.mdx +190 -0
  65. package/templates/default/env +0 -5
  66. package/templates/empty/README-template.md +4 -0
  67. package/templates/empty/env +0 -5
  68. package/templates/eventbridge/README-template.md +4 -0
  69. package/templates/graphql/README-template.md +4 -0
  70. package/templates/graphql/env +0 -5
  71. package/templates/openapi/README-template.md +4 -0
  72. package/templates/openapi/env +0 -5
@@ -0,0 +1,271 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Fail a payment with a high risk score
6
+
7
+ A new account places a large order for hoodies from an unusual location. The risk model scores it highly, and the FraudAPI publishes `FraudCheckFailed` so the Payment Processing System blocks the charge and cancels the order.
8
+
9
+ ### Payload details
10
+
11
+ - `reason` is `HIGH_RISK_SCORE`: the model score is above the block threshold.
12
+ - `score` is `0.93` on a 0 to 1 scale, where higher is riskier.
13
+ - `paymentId` and `orderId` identify the blocked payment and order.
14
+
15
+ ### Using this example
16
+
17
+ Consumers should stop the charge for `paymentId` and cancel `orderId`. Tests can assert that the score is kept for review.
18
+
19
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the FraudCheckFailed schema. The package names and publish methods are illustrative.
20
+
21
+ </Column>
22
+
23
+ <Column>
24
+
25
+ <CodeGroup dropdown>
26
+
27
+ ```typescript publish-fraud-check-failed.ts
28
+ import { EventsClient } from '@acme/events';
29
+ import type { FraudCheckFailed } from './schemas/fraud-check-failed';
30
+
31
+ const client = new EventsClient({
32
+ apiKey: process.env.ACME_API_KEY!,
33
+ });
34
+
35
+ const event: FraudCheckFailed = {
36
+ paymentId: '428dc169-43a6-479d-9661-5b07984cb556',
37
+ orderId: '2d7ef31b-211a-4dbc-898a-0b095e7b909c',
38
+ score: 0.93,
39
+ reason: 'HIGH_RISK_SCORE',
40
+ checkedAt: '2026-09-16T02:47:13Z',
41
+ };
42
+
43
+ await client.publish('FraudCheckFailed', event);
44
+ ```
45
+
46
+ ```python publish_fraud_check_failed.py
47
+ import os
48
+ from acme_events import EventsClient
49
+
50
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
51
+
52
+ event = {
53
+ "paymentId": "428dc169-43a6-479d-9661-5b07984cb556",
54
+ "orderId": "2d7ef31b-211a-4dbc-898a-0b095e7b909c",
55
+ "score": 0.93,
56
+ "reason": "HIGH_RISK_SCORE",
57
+ "checkedAt": "2026-09-16T02:47:13Z",
58
+ }
59
+
60
+ client.publish("FraudCheckFailed", event)
61
+ ```
62
+
63
+ ```java PublishFraudCheckFailed.java
64
+ import com.acme.events.EventsClient;
65
+ import java.util.Map;
66
+
67
+ public class PublishFraudCheckFailed {
68
+ public static void main(String[] args) {
69
+ var client = new EventsClient(
70
+ System.getenv("ACME_API_KEY")
71
+ );
72
+
73
+ var event = Map.of(
74
+ "paymentId", "428dc169-43a6-479d-9661-5b07984cb556",
75
+ "orderId", "2d7ef31b-211a-4dbc-898a-0b095e7b909c",
76
+ "score", 0.93,
77
+ "reason", "HIGH_RISK_SCORE",
78
+ "checkedAt", "2026-09-16T02:47:13Z"
79
+ );
80
+
81
+ client.publish("FraudCheckFailed", event);
82
+ }
83
+ }
84
+ ```
85
+
86
+ </CodeGroup>
87
+
88
+ </Column>
89
+
90
+ </Columns>
91
+
92
+ ---
93
+
94
+ <Columns cols={2}>
95
+
96
+ <Column>
97
+
98
+ ## 2. Fail a payment from a blocklisted card
99
+
100
+ A cap order is paid with a card on the blocklist. The FraudAPI rejects it straight away without running the risk model.
101
+
102
+ ### Payload details
103
+
104
+ - `reason` is `BLOCKLISTED`: the card or customer matched a blocklist entry.
105
+ - `score` is omitted because a rule, not the model, made the decision.
106
+
107
+ ### Using this example
108
+
109
+ Use this payload to check that consumers block the payment even when `score` is missing.
110
+
111
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the FraudCheckFailed schema. The package names and publish methods are illustrative.
112
+
113
+ </Column>
114
+
115
+ <Column>
116
+
117
+ <CodeGroup dropdown>
118
+
119
+ ```typescript publish-fraud-check-failed.ts
120
+ import { EventsClient } from '@acme/events';
121
+ import type { FraudCheckFailed } from './schemas/fraud-check-failed';
122
+
123
+ const client = new EventsClient({
124
+ apiKey: process.env.ACME_API_KEY!,
125
+ });
126
+
127
+ const event: FraudCheckFailed = {
128
+ paymentId: 'dfdffee1-3e4d-4fa3-b86e-ebe0cd93ca60',
129
+ orderId: '76d60366-d78a-4e10-b1ad-832445febfa1',
130
+ reason: 'BLOCKLISTED',
131
+ checkedAt: '2026-09-17T11:20:05Z',
132
+ };
133
+
134
+ await client.publish('FraudCheckFailed', event);
135
+ ```
136
+
137
+ ```python publish_fraud_check_failed.py
138
+ import os
139
+ from acme_events import EventsClient
140
+
141
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
142
+
143
+ event = {
144
+ "paymentId": "dfdffee1-3e4d-4fa3-b86e-ebe0cd93ca60",
145
+ "orderId": "76d60366-d78a-4e10-b1ad-832445febfa1",
146
+ "reason": "BLOCKLISTED",
147
+ "checkedAt": "2026-09-17T11:20:05Z",
148
+ }
149
+
150
+ client.publish("FraudCheckFailed", event)
151
+ ```
152
+
153
+ ```java PublishFraudCheckFailed.java
154
+ import com.acme.events.EventsClient;
155
+ import java.util.Map;
156
+
157
+ public class PublishFraudCheckFailed {
158
+ public static void main(String[] args) {
159
+ var client = new EventsClient(
160
+ System.getenv("ACME_API_KEY")
161
+ );
162
+
163
+ var event = Map.of(
164
+ "paymentId", "dfdffee1-3e4d-4fa3-b86e-ebe0cd93ca60",
165
+ "orderId", "76d60366-d78a-4e10-b1ad-832445febfa1",
166
+ "reason", "BLOCKLISTED",
167
+ "checkedAt", "2026-09-17T11:20:05Z"
168
+ );
169
+
170
+ client.publish("FraudCheckFailed", event);
171
+ }
172
+ }
173
+ ```
174
+
175
+ </CodeGroup>
176
+
177
+ </Column>
178
+
179
+ </Columns>
180
+
181
+ ---
182
+
183
+ <Columns cols={2}>
184
+
185
+ <Column>
186
+
187
+ ## 3. Fail a payment for too many attempts
188
+
189
+ The same card is used for many T-shirt orders within a few minutes. The FraudAPI flags the pattern and publishes `FraudCheckFailed`.
190
+
191
+ ### Payload details
192
+
193
+ - `reason` is `VELOCITY`: too many payment attempts in a short time.
194
+ - `score` is `0.67`, which is moderate on its own; the velocity rule caused the failure.
195
+
196
+ ### Using this example
197
+
198
+ Consumers should block this payment. Tests can check that the order is cancelled based on `reason`, not on `score` alone.
199
+
200
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the FraudCheckFailed schema. The package names and publish methods are illustrative.
201
+
202
+ </Column>
203
+
204
+ <Column>
205
+
206
+ <CodeGroup dropdown>
207
+
208
+ ```typescript publish-fraud-check-failed.ts
209
+ import { EventsClient } from '@acme/events';
210
+ import type { FraudCheckFailed } from './schemas/fraud-check-failed';
211
+
212
+ const client = new EventsClient({
213
+ apiKey: process.env.ACME_API_KEY!,
214
+ });
215
+
216
+ const event: FraudCheckFailed = {
217
+ paymentId: '0c3b8e41-5a7f-4d26-9e18-b4f2a6d09c75',
218
+ orderId: '99027891-075d-4561-91f8-da95f34e4a57',
219
+ score: 0.67,
220
+ reason: 'VELOCITY',
221
+ checkedAt: '2026-09-18T16:55:41Z',
222
+ };
223
+
224
+ await client.publish('FraudCheckFailed', event);
225
+ ```
226
+
227
+ ```python publish_fraud_check_failed.py
228
+ import os
229
+ from acme_events import EventsClient
230
+
231
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
232
+
233
+ event = {
234
+ "paymentId": "0c3b8e41-5a7f-4d26-9e18-b4f2a6d09c75",
235
+ "orderId": "99027891-075d-4561-91f8-da95f34e4a57",
236
+ "score": 0.67,
237
+ "reason": "VELOCITY",
238
+ "checkedAt": "2026-09-18T16:55:41Z",
239
+ }
240
+
241
+ client.publish("FraudCheckFailed", event)
242
+ ```
243
+
244
+ ```java PublishFraudCheckFailed.java
245
+ import com.acme.events.EventsClient;
246
+ import java.util.Map;
247
+
248
+ public class PublishFraudCheckFailed {
249
+ public static void main(String[] args) {
250
+ var client = new EventsClient(
251
+ System.getenv("ACME_API_KEY")
252
+ );
253
+
254
+ var event = Map.of(
255
+ "paymentId", "0c3b8e41-5a7f-4d26-9e18-b4f2a6d09c75",
256
+ "orderId", "99027891-075d-4561-91f8-da95f34e4a57",
257
+ "score", 0.67,
258
+ "reason", "VELOCITY",
259
+ "checkedAt", "2026-09-18T16:55:41Z"
260
+ );
261
+
262
+ client.publish("FraudCheckFailed", event);
263
+ }
264
+ }
265
+ ```
266
+
267
+ </CodeGroup>
268
+
269
+ </Column>
270
+
271
+ </Columns>
@@ -0,0 +1,173 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Pass a low-risk payment with a score
6
+
7
+ Fraud Detection screens the T-shirt and cap payment from a returning customer and finds it low risk. The FraudAPI publishes `FraudCheckPassed` so the Payment Processing System lets the charge go ahead.
8
+
9
+ ### Payload details
10
+
11
+ - `paymentId` and `orderId` match the `PaymentRequested` event that was screened.
12
+ - `score` is `0.08` on a 0 to 1 scale, where lower is safer.
13
+ - `checkedAt` is when the screening finished.
14
+
15
+ ### Using this example
16
+
17
+ Consumers should mark the payment as cleared for `paymentId`. Tests can also assert that `score` is between 0 and 1.
18
+
19
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the FraudCheckPassed schema. The package names and publish methods are illustrative.
20
+
21
+ </Column>
22
+
23
+ <Column>
24
+
25
+ <CodeGroup dropdown>
26
+
27
+ ```typescript publish-fraud-check-passed.ts
28
+ import { EventsClient } from '@acme/events';
29
+ import type { FraudCheckPassed } from './schemas/fraud-check-passed';
30
+
31
+ const client = new EventsClient({
32
+ apiKey: process.env.ACME_API_KEY!,
33
+ });
34
+
35
+ const event: FraudCheckPassed = {
36
+ paymentId: '586e57ab-77a9-406a-945d-4619c76a582e',
37
+ orderId: '971b5a4b-6885-405c-899b-5e0f428016c1',
38
+ score: 0.08,
39
+ checkedAt: '2026-09-11T08:12:47Z',
40
+ };
41
+
42
+ await client.publish('FraudCheckPassed', event);
43
+ ```
44
+
45
+ ```python publish_fraud_check_passed.py
46
+ import os
47
+ from acme_events import EventsClient
48
+
49
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
50
+
51
+ event = {
52
+ "paymentId": "586e57ab-77a9-406a-945d-4619c76a582e",
53
+ "orderId": "971b5a4b-6885-405c-899b-5e0f428016c1",
54
+ "score": 0.08,
55
+ "checkedAt": "2026-09-11T08:12:47Z",
56
+ }
57
+
58
+ client.publish("FraudCheckPassed", event)
59
+ ```
60
+
61
+ ```java PublishFraudCheckPassed.java
62
+ import com.acme.events.EventsClient;
63
+ import java.util.Map;
64
+
65
+ public class PublishFraudCheckPassed {
66
+ public static void main(String[] args) {
67
+ var client = new EventsClient(
68
+ System.getenv("ACME_API_KEY")
69
+ );
70
+
71
+ var event = Map.of(
72
+ "paymentId", "586e57ab-77a9-406a-945d-4619c76a582e",
73
+ "orderId", "971b5a4b-6885-405c-899b-5e0f428016c1",
74
+ "score", 0.08,
75
+ "checkedAt", "2026-09-11T08:12:47Z"
76
+ );
77
+
78
+ client.publish("FraudCheckPassed", event);
79
+ }
80
+ }
81
+ ```
82
+
83
+ </CodeGroup>
84
+
85
+ </Column>
86
+
87
+ </Columns>
88
+
89
+ ---
90
+
91
+ <Columns cols={2}>
92
+
93
+ <Column>
94
+
95
+ ## 2. Pass a payment without a score
96
+
97
+ The guest hoodie order is cleared by an allowlist rule, so no risk model runs. The FraudAPI publishes `FraudCheckPassed` with only the required fields.
98
+
99
+ ### Payload details
100
+
101
+ - `score` is optional and omitted because no model scored the payment.
102
+ - `paymentId` and `orderId` identify the guest payment that was screened.
103
+
104
+ ### Using this example
105
+
106
+ Use this payload to check that consumers do not depend on `score` being present.
107
+
108
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the FraudCheckPassed schema. The package names and publish methods are illustrative.
109
+
110
+ </Column>
111
+
112
+ <Column>
113
+
114
+ <CodeGroup dropdown>
115
+
116
+ ```typescript publish-fraud-check-passed.ts
117
+ import { EventsClient } from '@acme/events';
118
+ import type { FraudCheckPassed } from './schemas/fraud-check-passed';
119
+
120
+ const client = new EventsClient({
121
+ apiKey: process.env.ACME_API_KEY!,
122
+ });
123
+
124
+ const event: FraudCheckPassed = {
125
+ paymentId: '41651c3f-fa8e-40fc-a217-a83929d15081',
126
+ orderId: 'e39a80be-526e-4009-a22a-40c847cff088',
127
+ checkedAt: '2026-09-14T19:03:29Z',
128
+ };
129
+
130
+ await client.publish('FraudCheckPassed', event);
131
+ ```
132
+
133
+ ```python publish_fraud_check_passed.py
134
+ import os
135
+ from acme_events import EventsClient
136
+
137
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
138
+
139
+ event = {
140
+ "paymentId": "41651c3f-fa8e-40fc-a217-a83929d15081",
141
+ "orderId": "e39a80be-526e-4009-a22a-40c847cff088",
142
+ "checkedAt": "2026-09-14T19:03:29Z",
143
+ }
144
+
145
+ client.publish("FraudCheckPassed", event)
146
+ ```
147
+
148
+ ```java PublishFraudCheckPassed.java
149
+ import com.acme.events.EventsClient;
150
+ import java.util.Map;
151
+
152
+ public class PublishFraudCheckPassed {
153
+ public static void main(String[] args) {
154
+ var client = new EventsClient(
155
+ System.getenv("ACME_API_KEY")
156
+ );
157
+
158
+ var event = Map.of(
159
+ "paymentId", "41651c3f-fa8e-40fc-a217-a83929d15081",
160
+ "orderId", "e39a80be-526e-4009-a22a-40c847cff088",
161
+ "checkedAt", "2026-09-14T19:03:29Z"
162
+ );
163
+
164
+ client.publish("FraudCheckPassed", event);
165
+ }
166
+ }
167
+ ```
168
+
169
+ </CodeGroup>
170
+
171
+ </Column>
172
+
173
+ </Columns>
@@ -0,0 +1,191 @@
1
+ <Columns cols={2}>
2
+
3
+ <Column>
4
+
5
+ ## 1. Request a charge for a signed-in customer
6
+
7
+ A signed-in customer checks out a T-shirt and a cap. The PaymentWorker publishes `PaymentRequested` so Stripe charges the card, and Fraud Detection screens the payment in parallel.
8
+
9
+ ### Payload details
10
+
11
+ - `paymentId` is the new payment created by the PaymentWorker; `orderId` links it back to the order.
12
+ - `customerId` is included because the shopper has an account, which lets Fraud Detection use their history.
13
+ - `amount` is in minor units: a £24.99 T-shirt plus a £17.99 cap.
14
+ - `currency` is the ISO 4217 code `GBP`.
15
+
16
+ The charge is **4,298 pence (£42.98)**.
17
+
18
+ ### Using this example
19
+
20
+ Consumers should charge exactly `amount` in `currency` and carry `paymentId` through to the `PaymentSucceeded` or `PaymentFailed` reply.
21
+
22
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the PaymentRequested schema. The package names and publish methods are illustrative.
23
+
24
+ </Column>
25
+
26
+ <Column>
27
+
28
+ <CodeGroup dropdown>
29
+
30
+ ```typescript publish-payment-requested.ts
31
+ import { EventsClient } from '@acme/events';
32
+ import type { PaymentRequested } from './schemas/payment-requested';
33
+
34
+ const client = new EventsClient({
35
+ apiKey: process.env.ACME_API_KEY!,
36
+ });
37
+
38
+ const event: PaymentRequested = {
39
+ paymentId: '586e57ab-77a9-406a-945d-4619c76a582e',
40
+ orderId: '971b5a4b-6885-405c-899b-5e0f428016c1',
41
+ customerId: '74ea26c5-fb6c-4000-a036-f1749f67032c',
42
+ amount: 4298,
43
+ currency: 'GBP',
44
+ requestedAt: '2026-09-11T08:12:45Z',
45
+ };
46
+
47
+ await client.publish('PaymentRequested', event);
48
+ ```
49
+
50
+ ```python publish_payment_requested.py
51
+ import os
52
+ from acme_events import EventsClient
53
+
54
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
55
+
56
+ event = {
57
+ "paymentId": "586e57ab-77a9-406a-945d-4619c76a582e",
58
+ "orderId": "971b5a4b-6885-405c-899b-5e0f428016c1",
59
+ "customerId": "74ea26c5-fb6c-4000-a036-f1749f67032c",
60
+ "amount": 4298,
61
+ "currency": "GBP",
62
+ "requestedAt": "2026-09-11T08:12:45Z",
63
+ }
64
+
65
+ client.publish("PaymentRequested", event)
66
+ ```
67
+
68
+ ```java PublishPaymentRequested.java
69
+ import com.acme.events.EventsClient;
70
+ import java.util.Map;
71
+
72
+ public class PublishPaymentRequested {
73
+ public static void main(String[] args) {
74
+ var client = new EventsClient(
75
+ System.getenv("ACME_API_KEY")
76
+ );
77
+
78
+ var event = Map.of(
79
+ "paymentId", "586e57ab-77a9-406a-945d-4619c76a582e",
80
+ "orderId", "971b5a4b-6885-405c-899b-5e0f428016c1",
81
+ "customerId", "74ea26c5-fb6c-4000-a036-f1749f67032c",
82
+ "amount", 4298,
83
+ "currency", "GBP",
84
+ "requestedAt", "2026-09-11T08:12:45Z"
85
+ );
86
+
87
+ client.publish("PaymentRequested", event);
88
+ }
89
+ }
90
+ ```
91
+
92
+ </CodeGroup>
93
+
94
+ </Column>
95
+
96
+ </Columns>
97
+
98
+ ---
99
+
100
+ <Columns cols={2}>
101
+
102
+ <Column>
103
+
104
+ ## 2. Request a charge for a guest checkout
105
+
106
+ A guest shopper in Ireland buys three hoodies without an account. The PaymentWorker publishes `PaymentRequested` with only the required fields.
107
+
108
+ ### Payload details
109
+
110
+ - `customerId` is omitted because guest checkouts have no customer account.
111
+ - `amount` is three hoodies at €54.99 each, in cents.
112
+ - `currency` is `EUR`.
113
+
114
+ The charge is **16,497 cents (€164.97)**.
115
+
116
+ ### Using this example
117
+
118
+ Use this payload to check that Fraud Detection and Stripe handle a missing `customerId` without failing.
119
+
120
+ The examples use a **fictional Acme Events SDK** to publish a payload matching the PaymentRequested schema. The package names and publish methods are illustrative.
121
+
122
+ </Column>
123
+
124
+ <Column>
125
+
126
+ <CodeGroup dropdown>
127
+
128
+ ```typescript publish-payment-requested.ts
129
+ import { EventsClient } from '@acme/events';
130
+ import type { PaymentRequested } from './schemas/payment-requested';
131
+
132
+ const client = new EventsClient({
133
+ apiKey: process.env.ACME_API_KEY!,
134
+ });
135
+
136
+ const event: PaymentRequested = {
137
+ paymentId: '41651c3f-fa8e-40fc-a217-a83929d15081',
138
+ orderId: 'e39a80be-526e-4009-a22a-40c847cff088',
139
+ amount: 16497,
140
+ currency: 'EUR',
141
+ requestedAt: '2026-09-14T19:03:27Z',
142
+ };
143
+
144
+ await client.publish('PaymentRequested', event);
145
+ ```
146
+
147
+ ```python publish_payment_requested.py
148
+ import os
149
+ from acme_events import EventsClient
150
+
151
+ client = EventsClient(api_key=os.environ["ACME_API_KEY"])
152
+
153
+ event = {
154
+ "paymentId": "41651c3f-fa8e-40fc-a217-a83929d15081",
155
+ "orderId": "e39a80be-526e-4009-a22a-40c847cff088",
156
+ "amount": 16497,
157
+ "currency": "EUR",
158
+ "requestedAt": "2026-09-14T19:03:27Z",
159
+ }
160
+
161
+ client.publish("PaymentRequested", event)
162
+ ```
163
+
164
+ ```java PublishPaymentRequested.java
165
+ import com.acme.events.EventsClient;
166
+ import java.util.Map;
167
+
168
+ public class PublishPaymentRequested {
169
+ public static void main(String[] args) {
170
+ var client = new EventsClient(
171
+ System.getenv("ACME_API_KEY")
172
+ );
173
+
174
+ var event = Map.of(
175
+ "paymentId", "41651c3f-fa8e-40fc-a217-a83929d15081",
176
+ "orderId", "e39a80be-526e-4009-a22a-40c847cff088",
177
+ "amount", 16497,
178
+ "currency", "EUR",
179
+ "requestedAt", "2026-09-14T19:03:27Z"
180
+ );
181
+
182
+ client.publish("PaymentRequested", event);
183
+ }
184
+ }
185
+ ```
186
+
187
+ </CodeGroup>
188
+
189
+ </Column>
190
+
191
+ </Columns>