@eventcatalog/create-eventcatalog 3.0.10 → 3.0.11

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 (34) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
  3. package/templates/default/domains/Orders/entities/CartItem/index.mdx +121 -0
  4. package/templates/default/domains/Orders/entities/Customer/index.mdx +57 -0
  5. package/templates/default/domains/Orders/entities/Order/index.mdx +96 -0
  6. package/templates/default/domains/Orders/entities/OrderItem/index.mdx +59 -0
  7. package/templates/default/domains/Orders/entities/ShoppingCart/index.mdx +148 -0
  8. package/templates/default/domains/Orders/index.mdx +13 -0
  9. package/templates/default/domains/Payment/entities/Address/index.mdx +162 -0
  10. package/templates/default/domains/Payment/entities/Invoice/index.mdx +89 -0
  11. package/templates/default/domains/Payment/entities/Payment/index.mdx +137 -0
  12. package/templates/default/domains/Payment/entities/PaymentMethod/index.mdx +77 -0
  13. package/templates/default/domains/Payment/entities/Transaction/index.mdx +77 -0
  14. package/templates/default/domains/Payment/index.mdx +17 -1
  15. package/templates/default/domains/Payment/services/FraudDetectionService/events/FraudCheckCompleted/index.mdx +48 -0
  16. package/templates/default/domains/Payment/services/FraudDetectionService/events/FraudCheckCompleted/schema.json +44 -0
  17. package/templates/default/domains/Payment/services/FraudDetectionService/index.mdx +59 -0
  18. package/templates/default/domains/Payment/services/PaymentGatewayService/commands/ProcessPayment/index.mdx +72 -0
  19. package/templates/default/domains/Payment/services/PaymentGatewayService/commands/ProcessPayment/schema.json +58 -0
  20. package/templates/default/domains/Payment/services/PaymentGatewayService/events/PaymentFailed/index.mdx +60 -0
  21. package/templates/default/domains/Payment/services/PaymentGatewayService/events/PaymentFailed/schema.json +68 -0
  22. package/templates/default/domains/Payment/services/PaymentGatewayService/index.mdx +78 -0
  23. package/templates/default/domains/ProductCatalog/entities/Category/index.mdx +124 -0
  24. package/templates/default/domains/ProductCatalog/entities/Inventory/index.mdx +116 -0
  25. package/templates/default/domains/ProductCatalog/entities/Product/index.mdx +115 -0
  26. package/templates/default/domains/ProductCatalog/entities/Review/index.mdx +154 -0
  27. package/templates/default/domains/ProductCatalog/index.mdx +74 -0
  28. package/templates/default/domains/Subscriptions/entities/BillingProfile/index.mdx +68 -0
  29. package/templates/default/domains/Subscriptions/entities/SubscriptionPeriod/index.mdx +73 -0
  30. package/templates/default/domains/Subscriptions/index.mdx +13 -2
  31. package/templates/default/domains/Subscriptions/services/BillingService/events/SubscriptionPaymentDue/index.mdx +60 -0
  32. package/templates/default/domains/Subscriptions/services/BillingService/events/SubscriptionPaymentDue/schema.json +54 -0
  33. package/templates/default/domains/Subscriptions/services/BillingService/index.mdx +86 -0
  34. package/templates/default/domains/Subscriptions/services/PlanManagementService/index.mdx +93 -0
@@ -0,0 +1,60 @@
1
+ ---
2
+ id: PaymentFailed
3
+ version: 0.0.1
4
+ name: Payment Failed
5
+ summary: Emitted when a payment attempt fails
6
+ badges:
7
+ - content: Error Event
8
+ backgroundColor: red
9
+ textColor: white
10
+ schemaPath: schema.json
11
+ ---
12
+
13
+ import Footer from '@catalog/components/footer.astro'
14
+
15
+ ## Overview
16
+
17
+ The `PaymentFailed` event is emitted when a payment attempt fails for any reason. This event is consumed by various services to handle payment failures appropriately.
18
+
19
+ ## Consumers
20
+
21
+ This event is consumed by:
22
+ - **BillingService** (Subscriptions Domain) - To handle subscription payment failures
23
+ - **OrdersService** (Orders Domain) - To handle order payment failures
24
+ - **NotificationService** (Orders Domain) - To notify customers of payment failures
25
+
26
+ ## Failure Reasons
27
+
28
+ Common failure reasons include:
29
+ - **insufficient_funds** - Card has insufficient funds
30
+ - **card_declined** - Card was declined by issuer
31
+ - **expired_card** - Card has expired
32
+ - **fraud_suspected** - Payment flagged as potentially fraudulent
33
+ - **network_error** - Payment gateway network error
34
+ - **invalid_payment_method** - Payment method is invalid
35
+
36
+ ## Schema
37
+
38
+ <SchemaViewer title="PaymentFailed Schema" schemaPath={frontmatter.schemaPath} />
39
+
40
+ ## Example Payload
41
+
42
+ ```json
43
+ {
44
+ "paymentId": "pay_123456",
45
+ "amount": 49.99,
46
+ "currency": "USD",
47
+ "failureReason": "insufficient_funds",
48
+ "failureMessage": "Your card has insufficient funds",
49
+ "metadata": {
50
+ "subscriptionId": "sub_ABC123",
51
+ "invoiceId": "inv_123456",
52
+ "customerId": "cust_XYZ789"
53
+ },
54
+ "canRetry": true,
55
+ "nextRetryAt": "2024-02-02T00:00:00Z",
56
+ "timestamp": "2024-02-01T10:30:00Z"
57
+ }
58
+ ```
59
+
60
+ <Footer />
@@ -0,0 +1,68 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "paymentId": {
6
+ "type": "string",
7
+ "description": "Unique identifier for the failed payment"
8
+ },
9
+ "amount": {
10
+ "type": "number",
11
+ "description": "Payment amount that failed"
12
+ },
13
+ "currency": {
14
+ "type": "string",
15
+ "description": "Currency code (ISO 4217)"
16
+ },
17
+ "failureReason": {
18
+ "type": "string",
19
+ "enum": [
20
+ "insufficient_funds",
21
+ "card_declined",
22
+ "expired_card",
23
+ "fraud_suspected",
24
+ "network_error",
25
+ "invalid_payment_method",
26
+ "authentication_required",
27
+ "other"
28
+ ],
29
+ "description": "Reason for payment failure"
30
+ },
31
+ "failureMessage": {
32
+ "type": "string",
33
+ "description": "Human-readable failure message"
34
+ },
35
+ "metadata": {
36
+ "type": "object",
37
+ "properties": {
38
+ "subscriptionId": {
39
+ "type": "string"
40
+ },
41
+ "invoiceId": {
42
+ "type": "string"
43
+ },
44
+ "customerId": {
45
+ "type": "string"
46
+ },
47
+ "orderId": {
48
+ "type": "string"
49
+ }
50
+ }
51
+ },
52
+ "canRetry": {
53
+ "type": "boolean",
54
+ "description": "Whether this payment can be retried"
55
+ },
56
+ "nextRetryAt": {
57
+ "type": "string",
58
+ "format": "date-time",
59
+ "description": "Suggested time for next retry attempt"
60
+ },
61
+ "timestamp": {
62
+ "type": "string",
63
+ "format": "date-time",
64
+ "description": "When the failure occurred"
65
+ }
66
+ },
67
+ "required": ["paymentId", "amount", "currency", "failureReason", "timestamp"]
68
+ }
@@ -0,0 +1,78 @@
1
+ ---
2
+ id: PaymentGatewayService
3
+ version: 0.0.1
4
+ name: Payment Gateway Service
5
+ summary: Manages integration with external payment processors (Stripe, PayPal, etc.)
6
+ tags:
7
+ - payment
8
+ - gateway
9
+ - integration
10
+ repository:
11
+ url: https://github.com/eventcatalog/payment-gateway-service
12
+ receives:
13
+ - id: ProcessPayment
14
+ version: 0.0.1
15
+ - id: RefundPayment
16
+ version: 0.0.1
17
+ - id: FraudCheckCompleted
18
+ version: 0.0.1
19
+ sends:
20
+ - id: PaymentAuthorized
21
+ version: 0.0.1
22
+ - id: PaymentCaptured
23
+ version: 0.0.1
24
+ - id: PaymentFailed
25
+ version: 0.0.1
26
+ - id: RefundProcessed
27
+ version: 0.0.1
28
+ owners:
29
+ - paymentsTeam
30
+ ---
31
+
32
+ import Footer from '@catalog/components/footer.astro'
33
+
34
+ ## Overview
35
+
36
+ The Payment Gateway Service acts as an abstraction layer between our payment system and external payment processors. It handles the complexity of integrating with multiple payment providers and provides a unified interface for payment operations.
37
+
38
+ ## Supported Payment Providers
39
+
40
+ - **Stripe**: Credit/debit cards, digital wallets
41
+ - **PayPal**: PayPal accounts, PayPal Credit
42
+ - **Square**: In-person and online payments
43
+ - **Adyen**: Global payment processing
44
+ - **Braintree**: Multiple payment methods
45
+
46
+ ## Key Features
47
+
48
+ - **Multi-provider Support**: Switch between providers seamlessly
49
+ - **Retry Logic**: Automatic retry for failed transactions
50
+ - **Tokenization**: Secure card data handling
51
+ - **Webhook Management**: Handles provider webhooks
52
+ - **Currency Conversion**: Support for 150+ currencies
53
+
54
+ ## API Endpoints
55
+
56
+ ### REST API
57
+ - `POST /api/gateway/authorize` - Authorize a payment
58
+ - `POST /api/gateway/capture` - Capture an authorized payment
59
+ - `POST /api/gateway/refund` - Process a refund
60
+ - `GET /api/gateway/status/{transactionId}` - Get transaction status
61
+
62
+ ## Configuration
63
+
64
+ ```yaml
65
+ payment_gateway:
66
+ providers:
67
+ stripe:
68
+ api_key: ${STRIPE_API_KEY}
69
+ webhook_secret: ${STRIPE_WEBHOOK_SECRET}
70
+ paypal:
71
+ client_id: ${PAYPAL_CLIENT_ID}
72
+ client_secret: ${PAYPAL_CLIENT_SECRET}
73
+ retry:
74
+ max_attempts: 3
75
+ backoff_ms: 1000
76
+ ```
77
+
78
+ <Footer />
@@ -0,0 +1,124 @@
1
+ ---
2
+ id: Category
3
+ name: Category
4
+ version: 1.0.0
5
+ identifier: categoryId
6
+ aggregateRoot: true
7
+ summary: Represents a product category with hierarchical structure support.
8
+ properties:
9
+ - name: categoryId
10
+ type: UUID
11
+ required: true
12
+ description: Unique identifier for the category
13
+ - name: name
14
+ type: string
15
+ required: true
16
+ description: Name of the category
17
+ - name: description
18
+ type: string
19
+ required: false
20
+ description: Description of the category
21
+ - name: slug
22
+ type: string
23
+ required: true
24
+ description: URL-friendly identifier for the category
25
+ - name: parentCategoryId
26
+ type: UUID
27
+ required: false
28
+ description: Parent category for hierarchical structure
29
+ references: Category
30
+ referencesIdentifier: categoryId
31
+ relationType: hasOne
32
+ - name: childCategories
33
+ type: array
34
+ items:
35
+ type: Category
36
+ required: false
37
+ description: Subcategories under this category
38
+ references: Category
39
+ referencesIdentifier: parentCategoryId
40
+ relationType: hasMany
41
+ - name: level
42
+ type: integer
43
+ required: true
44
+ description: Depth level in the category hierarchy (0 = root)
45
+ - name: isActive
46
+ type: boolean
47
+ required: true
48
+ description: Whether the category is currently active
49
+ - name: sortOrder
50
+ type: integer
51
+ required: false
52
+ description: Display order within the same level
53
+ - name: icon
54
+ type: string
55
+ required: false
56
+ description: Icon URL or identifier for the category
57
+ - name: imageUrl
58
+ type: string
59
+ required: false
60
+ description: Category banner or thumbnail image
61
+ - name: seoTitle
62
+ type: string
63
+ required: false
64
+ description: SEO-optimized title for the category page
65
+ - name: seoDescription
66
+ type: string
67
+ required: false
68
+ description: SEO meta description for the category page
69
+ - name: products
70
+ type: array
71
+ items:
72
+ type: Product
73
+ required: false
74
+ description: Products belonging to this category
75
+ references: Product
76
+ referencesIdentifier: categoryId
77
+ relationType: hasMany
78
+ - name: createdAt
79
+ type: DateTime
80
+ required: true
81
+ description: Date and time when the category was created
82
+ - name: updatedAt
83
+ type: DateTime
84
+ required: false
85
+ description: Date and time when the category was last updated
86
+ ---
87
+
88
+ ## Overview
89
+
90
+ The Category entity organizes products into a hierarchical structure, supporting multi-level categorization. It enables efficient product discovery and navigation through the e-commerce catalog.
91
+
92
+ ### Entity Properties
93
+ <EntityPropertiesTable />
94
+
95
+ ## Relationships
96
+
97
+ * **Parent Category:** Each category can have one parent `Category` (identified by `parentCategoryId`).
98
+ * **Child Categories:** A category can have multiple child `Category` entities creating a hierarchy.
99
+ * **Products:** A category contains multiple `Product` entities (identified by `categoryId`).
100
+
101
+ ## Hierarchy Examples
102
+
103
+ ```
104
+ Electronics (Level 0)
105
+ ├── Computers (Level 1)
106
+ │ ├── Laptops (Level 2)
107
+ │ ├── Desktops (Level 2)
108
+ │ └── Tablets (Level 2)
109
+ ├── Mobile Phones (Level 1)
110
+ │ ├── Smartphones (Level 2)
111
+ │ └── Feature Phones (Level 2)
112
+ └── Audio (Level 1)
113
+ ├── Headphones (Level 2)
114
+ └── Speakers (Level 2)
115
+ ```
116
+
117
+ ## Business Rules
118
+
119
+ * Root categories have `parentCategoryId` as null and `level` as 0
120
+ * Child categories must have a valid `parentCategoryId`
121
+ * Category slugs must be unique across the entire catalog
122
+ * Categories cannot be deleted if they contain products or subcategories
123
+ * Inactive categories should hide all associated products from public view
124
+ * Maximum hierarchy depth should be limited (e.g., 5 levels)
@@ -0,0 +1,116 @@
1
+ ---
2
+ id: Inventory
3
+ name: Inventory
4
+ version: 1.0.0
5
+ identifier: inventoryId
6
+ summary: Tracks stock levels and availability for products.
7
+ properties:
8
+ - name: inventoryId
9
+ type: UUID
10
+ required: true
11
+ description: Unique identifier for the inventory record
12
+ - name: productId
13
+ type: UUID
14
+ required: true
15
+ description: Product this inventory record tracks
16
+ references: Product
17
+ referencesIdentifier: productId
18
+ relationType: hasOne
19
+ - name: sku
20
+ type: string
21
+ required: true
22
+ description: Stock Keeping Unit matching the product SKU
23
+ - name: quantityOnHand
24
+ type: integer
25
+ required: true
26
+ description: Current available stock quantity
27
+ - name: quantityReserved
28
+ type: integer
29
+ required: true
30
+ description: Quantity reserved for pending orders
31
+ - name: quantityAvailable
32
+ type: integer
33
+ required: true
34
+ description: Calculated available quantity (onHand - reserved)
35
+ - name: minimumStockLevel
36
+ type: integer
37
+ required: true
38
+ description: Minimum stock level before reorder alert
39
+ - name: maximumStockLevel
40
+ type: integer
41
+ required: false
42
+ description: Maximum stock level for inventory management
43
+ - name: reorderPoint
44
+ type: integer
45
+ required: true
46
+ description: Stock level that triggers reorder process
47
+ - name: reorderQuantity
48
+ type: integer
49
+ required: true
50
+ description: Quantity to order when restocking
51
+ - name: unitCost
52
+ type: decimal
53
+ required: false
54
+ description: Cost per unit for inventory valuation
55
+ - name: warehouseLocation
56
+ type: string
57
+ required: false
58
+ description: Physical location or bin where item is stored
59
+ - name: lastRestockedAt
60
+ type: DateTime
61
+ required: false
62
+ description: Date and time of last restock
63
+ - name: lastSoldAt
64
+ type: DateTime
65
+ required: false
66
+ description: Date and time of last sale
67
+ - name: isTrackingEnabled
68
+ type: boolean
69
+ required: true
70
+ description: Whether inventory tracking is enabled for this product
71
+ - name: backorderAllowed
72
+ type: boolean
73
+ required: true
74
+ description: Whether backorders are allowed when out of stock
75
+ - name: createdAt
76
+ type: DateTime
77
+ required: true
78
+ description: Date and time when the inventory record was created
79
+ - name: updatedAt
80
+ type: DateTime
81
+ required: false
82
+ description: Date and time when the inventory record was last updated
83
+ ---
84
+
85
+ ## Overview
86
+
87
+ The Inventory entity manages stock levels and availability for products in the e-commerce system. It tracks current quantities, reserved stock, and provides reorder management capabilities.
88
+
89
+ ### Entity Properties
90
+ <EntityPropertiesTable />
91
+
92
+ ## Relationships
93
+
94
+ * **Product:** Each inventory record belongs to one `Product` (identified by `productId`).
95
+ * **OrderItem:** Inventory quantities are affected by `OrderItem` entities when orders are placed.
96
+
97
+ ## Stock Calculations
98
+
99
+ * **Available Quantity** = Quantity On Hand - Quantity Reserved
100
+ * **Reorder Needed** = Quantity Available &lt;= Reorder Point
101
+ * **Stock Value** = Quantity On Hand × Unit Cost
102
+
103
+ ## Examples
104
+
105
+ * **Inventory #1:** iPhone 15 Pro - 25 on hand, 5 reserved, 20 available, reorder at 10 units.
106
+ * **Inventory #2:** Running Shoes Size 9 - 0 on hand, 2 reserved, backorder allowed.
107
+
108
+ ## Business Rules
109
+
110
+ * Quantity on hand cannot be negative
111
+ * Quantity reserved cannot exceed quantity on hand
112
+ * Available quantity is automatically calculated
113
+ * Reorder alerts are triggered when available = reorder point
114
+ * Stock reservations are created when orders are placed
115
+ * Stock is decremented when orders are shipped
116
+ * Inventory adjustments must be logged for audit trail
@@ -0,0 +1,115 @@
1
+ ---
2
+ id: Product
3
+ name: Product
4
+ version: 1.0.0
5
+ identifier: productId
6
+ aggregateRoot: true
7
+ summary: Represents a product or service available for purchase in the e-commerce system.
8
+ properties:
9
+ - name: productId
10
+ type: UUID
11
+ required: true
12
+ description: Unique identifier for the product
13
+ - name: name
14
+ type: string
15
+ required: true
16
+ description: Name of the product
17
+ - name: description
18
+ type: string
19
+ required: false
20
+ description: Detailed description of the product
21
+ - name: sku
22
+ type: string
23
+ required: true
24
+ description: Stock Keeping Unit - unique product identifier
25
+ - name: price
26
+ type: decimal
27
+ required: true
28
+ description: Current selling price of the product
29
+ - name: categoryId
30
+ type: UUID
31
+ required: true
32
+ description: Category this product belongs to
33
+ references: Category
34
+ referencesIdentifier: categoryId
35
+ relationType: hasOne
36
+ - name: brand
37
+ type: string
38
+ required: false
39
+ description: Brand name of the product
40
+ - name: weight
41
+ type: decimal
42
+ required: false
43
+ description: Weight of the product in kilograms
44
+ - name: dimensions
45
+ type: object
46
+ required: false
47
+ description: Product dimensions (length, width, height)
48
+ properties:
49
+ - name: length
50
+ type: decimal
51
+ - name: width
52
+ type: decimal
53
+ - name: height
54
+ type: decimal
55
+ - name: isActive
56
+ type: boolean
57
+ required: true
58
+ description: Whether the product is currently available for sale
59
+ - name: createdAt
60
+ type: DateTime
61
+ required: true
62
+ description: Date and time when the product was created
63
+ - name: updatedAt
64
+ type: DateTime
65
+ required: false
66
+ description: Date and time when the product was last updated
67
+ - name: images
68
+ type: array
69
+ items:
70
+ type: string
71
+ required: false
72
+ description: URLs of product images
73
+ - name: inventory
74
+ type: Inventory
75
+ required: false
76
+ description: Inventory information for this product
77
+ references: Inventory
78
+ referencesIdentifier: productId
79
+ relationType: hasOne
80
+ - name: reviews
81
+ type: array
82
+ items:
83
+ type: Review
84
+ required: false
85
+ description: Customer reviews for this product
86
+ references: Review
87
+ referencesIdentifier: productId
88
+ relationType: hasMany
89
+ ---
90
+
91
+ ## Overview
92
+
93
+ The Product entity represents items or services available for purchase in the e-commerce system. It serves as an aggregate root containing all product-related information including pricing, categorization, inventory details, and customer reviews.
94
+
95
+ ### Entity Properties
96
+ <EntityPropertiesTable />
97
+
98
+ ## Relationships
99
+
100
+ * **Category:** Each product belongs to one `Category` (identified by `categoryId`).
101
+ * **Inventory:** Each product has one `Inventory` record tracking stock levels.
102
+ * **Review:** A product can have multiple `Review` entities from customers.
103
+ * **OrderItem:** Products are referenced in `OrderItem` entities when included in orders.
104
+
105
+ ## Examples
106
+
107
+ * **Product #1:** "iPhone 15 Pro" - Electronics category, $999.99, with 50 units in stock and 4.5-star reviews.
108
+ * **Product #2:** "Running Shoes" - Sports category, $129.99, various sizes available, with detailed size chart.
109
+
110
+ ## Business Rules
111
+
112
+ * Products must have a unique SKU across the entire catalog
113
+ * Products cannot be deleted if they have associated order items
114
+ * Price changes should be tracked for audit purposes
115
+ * Products must belong to an active category to be purchasable