@eventcatalog/create-eventcatalog 3.0.9 → 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.
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/amazon-api-gateway/eventcatalog.config.js +3 -0
- package/templates/asyncapi/eventcatalog.config.js +3 -0
- package/templates/confluent/eventcatalog.config.js +3 -0
- package/templates/default/domains/Orders/entities/CartItem/index.mdx +121 -0
- package/templates/default/domains/Orders/entities/Customer/index.mdx +57 -0
- package/templates/default/domains/Orders/entities/Order/index.mdx +96 -0
- package/templates/default/domains/Orders/entities/OrderItem/index.mdx +59 -0
- package/templates/default/domains/Orders/entities/ShoppingCart/index.mdx +148 -0
- package/templates/default/domains/Orders/index.mdx +13 -0
- package/templates/default/domains/Payment/entities/Address/index.mdx +162 -0
- package/templates/default/domains/Payment/entities/Invoice/index.mdx +89 -0
- package/templates/default/domains/Payment/entities/Payment/index.mdx +137 -0
- package/templates/default/domains/Payment/entities/PaymentMethod/index.mdx +77 -0
- package/templates/default/domains/Payment/entities/Transaction/index.mdx +77 -0
- package/templates/default/domains/Payment/index.mdx +17 -1
- package/templates/default/domains/Payment/services/FraudDetectionService/events/FraudCheckCompleted/index.mdx +48 -0
- package/templates/default/domains/Payment/services/FraudDetectionService/events/FraudCheckCompleted/schema.json +44 -0
- package/templates/default/domains/Payment/services/FraudDetectionService/index.mdx +59 -0
- package/templates/default/domains/Payment/services/PaymentGatewayService/commands/ProcessPayment/index.mdx +72 -0
- package/templates/default/domains/Payment/services/PaymentGatewayService/commands/ProcessPayment/schema.json +58 -0
- package/templates/default/domains/Payment/services/PaymentGatewayService/events/PaymentFailed/index.mdx +60 -0
- package/templates/default/domains/Payment/services/PaymentGatewayService/events/PaymentFailed/schema.json +68 -0
- package/templates/default/domains/Payment/services/PaymentGatewayService/index.mdx +78 -0
- package/templates/default/domains/ProductCatalog/entities/Category/index.mdx +124 -0
- package/templates/default/domains/ProductCatalog/entities/Inventory/index.mdx +116 -0
- package/templates/default/domains/ProductCatalog/entities/Product/index.mdx +115 -0
- package/templates/default/domains/ProductCatalog/entities/Review/index.mdx +154 -0
- package/templates/default/domains/ProductCatalog/index.mdx +74 -0
- package/templates/default/domains/Subscriptions/entities/BillingProfile/index.mdx +68 -0
- package/templates/default/domains/Subscriptions/entities/SubscriptionPeriod/index.mdx +73 -0
- package/templates/default/domains/Subscriptions/index.mdx +13 -2
- package/templates/default/domains/Subscriptions/services/BillingService/events/SubscriptionPaymentDue/index.mdx +60 -0
- package/templates/default/domains/Subscriptions/services/BillingService/events/SubscriptionPaymentDue/schema.json +54 -0
- package/templates/default/domains/Subscriptions/services/BillingService/index.mdx +86 -0
- package/templates/default/domains/Subscriptions/services/PlanManagementService/index.mdx +93 -0
- package/templates/default/eventcatalog.config.js +3 -0
- package/templates/empty/eventcatalog.config.js +3 -0
- package/templates/eventbridge/eventcatalog.config.js +3 -0
- package/templates/openapi/eventcatalog.config.js +3 -0
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Address
|
|
3
|
+
name: Address
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
identifier: addressId
|
|
6
|
+
summary: Represents shipping and billing addresses for customers and orders.
|
|
7
|
+
properties:
|
|
8
|
+
- name: addressId
|
|
9
|
+
type: UUID
|
|
10
|
+
required: true
|
|
11
|
+
description: Unique identifier for the address
|
|
12
|
+
- name: customerId
|
|
13
|
+
type: UUID
|
|
14
|
+
required: false
|
|
15
|
+
description: Customer this address belongs to
|
|
16
|
+
references: Customer
|
|
17
|
+
referencesIdentifier: customerId
|
|
18
|
+
relationType: hasOne
|
|
19
|
+
- name: type
|
|
20
|
+
type: string
|
|
21
|
+
required: true
|
|
22
|
+
description: Type of address
|
|
23
|
+
enum: ['billing', 'shipping', 'both']
|
|
24
|
+
- name: firstName
|
|
25
|
+
type: string
|
|
26
|
+
required: true
|
|
27
|
+
description: First name of the recipient
|
|
28
|
+
- name: lastName
|
|
29
|
+
type: string
|
|
30
|
+
required: true
|
|
31
|
+
description: Last name of the recipient
|
|
32
|
+
- name: company
|
|
33
|
+
type: string
|
|
34
|
+
required: false
|
|
35
|
+
description: Company name if applicable
|
|
36
|
+
- name: addressLine1
|
|
37
|
+
type: string
|
|
38
|
+
required: true
|
|
39
|
+
description: Primary address line (street address)
|
|
40
|
+
- name: addressLine2
|
|
41
|
+
type: string
|
|
42
|
+
required: false
|
|
43
|
+
description: Secondary address line (apartment, suite, etc.)
|
|
44
|
+
- name: city
|
|
45
|
+
type: string
|
|
46
|
+
required: true
|
|
47
|
+
description: City name
|
|
48
|
+
- name: state
|
|
49
|
+
type: string
|
|
50
|
+
required: true
|
|
51
|
+
description: State or province
|
|
52
|
+
- name: postalCode
|
|
53
|
+
type: string
|
|
54
|
+
required: true
|
|
55
|
+
description: Postal or ZIP code
|
|
56
|
+
- name: country
|
|
57
|
+
type: string
|
|
58
|
+
required: true
|
|
59
|
+
description: Country code (ISO 3166-1 alpha-2)
|
|
60
|
+
- name: phone
|
|
61
|
+
type: string
|
|
62
|
+
required: false
|
|
63
|
+
description: Phone number for delivery contact
|
|
64
|
+
- name: isDefault
|
|
65
|
+
type: boolean
|
|
66
|
+
required: true
|
|
67
|
+
description: Whether this is the default address for the customer
|
|
68
|
+
- name: isValidated
|
|
69
|
+
type: boolean
|
|
70
|
+
required: true
|
|
71
|
+
description: Whether the address has been validated
|
|
72
|
+
- name: validationDetails
|
|
73
|
+
type: object
|
|
74
|
+
required: false
|
|
75
|
+
description: Address validation details
|
|
76
|
+
properties:
|
|
77
|
+
- name: validatedAt
|
|
78
|
+
type: DateTime
|
|
79
|
+
description: When the address was validated
|
|
80
|
+
- name: validationService
|
|
81
|
+
type: string
|
|
82
|
+
description: Service used for validation
|
|
83
|
+
- name: confidence
|
|
84
|
+
type: decimal
|
|
85
|
+
description: Validation confidence score
|
|
86
|
+
- name: geocoordinates
|
|
87
|
+
type: object
|
|
88
|
+
required: false
|
|
89
|
+
description: Geographic coordinates for the address
|
|
90
|
+
properties:
|
|
91
|
+
- name: latitude
|
|
92
|
+
type: decimal
|
|
93
|
+
description: Latitude coordinate
|
|
94
|
+
- name: longitude
|
|
95
|
+
type: decimal
|
|
96
|
+
description: Longitude coordinate
|
|
97
|
+
- name: deliveryInstructions
|
|
98
|
+
type: string
|
|
99
|
+
required: false
|
|
100
|
+
description: Special delivery instructions
|
|
101
|
+
- name: orders
|
|
102
|
+
type: array
|
|
103
|
+
items:
|
|
104
|
+
type: Order
|
|
105
|
+
required: false
|
|
106
|
+
description: Orders using this address
|
|
107
|
+
references: Order
|
|
108
|
+
referencesIdentifier: shippingAddress
|
|
109
|
+
relationType: hasMany
|
|
110
|
+
- name: payments
|
|
111
|
+
type: array
|
|
112
|
+
items:
|
|
113
|
+
type: Payment
|
|
114
|
+
required: false
|
|
115
|
+
description: Payments using this as billing address
|
|
116
|
+
references: Payment
|
|
117
|
+
referencesIdentifier: billingAddress
|
|
118
|
+
relationType: hasMany
|
|
119
|
+
- name: createdAt
|
|
120
|
+
type: DateTime
|
|
121
|
+
required: true
|
|
122
|
+
description: Date and time when the address was created
|
|
123
|
+
- name: updatedAt
|
|
124
|
+
type: DateTime
|
|
125
|
+
required: false
|
|
126
|
+
description: Date and time when the address was last updated
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Overview
|
|
130
|
+
|
|
131
|
+
The Address entity stores shipping and billing addresses for customers, orders, and payments. It supports address validation, geocoding, and delivery instructions to ensure accurate order fulfillment.
|
|
132
|
+
|
|
133
|
+
### Entity Properties
|
|
134
|
+
<EntityPropertiesTable />
|
|
135
|
+
|
|
136
|
+
## Relationships
|
|
137
|
+
|
|
138
|
+
* **Customer:** An address can belong to one `Customer` (identified by `customerId`).
|
|
139
|
+
* **Order:** An address can be used by multiple `Order` entities for shipping.
|
|
140
|
+
* **Payment:** An address can be used by multiple `Payment` entities for billing.
|
|
141
|
+
|
|
142
|
+
## Address Types
|
|
143
|
+
|
|
144
|
+
* **Billing:** Used for payment processing and invoicing
|
|
145
|
+
* **Shipping:** Used for order delivery
|
|
146
|
+
* **Both:** Can be used for both billing and shipping
|
|
147
|
+
|
|
148
|
+
## Examples
|
|
149
|
+
|
|
150
|
+
* **Address #1:** John Doe's home address - default shipping and billing address.
|
|
151
|
+
* **Address #2:** Corporate office address - billing only, validated with high confidence.
|
|
152
|
+
* **Address #3:** Gift recipient address - shipping only, with special delivery instructions.
|
|
153
|
+
|
|
154
|
+
## Business Rules
|
|
155
|
+
|
|
156
|
+
* Each customer can have only one default address per type
|
|
157
|
+
* Addresses must be validated before being marked as default
|
|
158
|
+
* International addresses require country-specific validation
|
|
159
|
+
* Geocoordinates are automatically populated when available
|
|
160
|
+
* Address changes should create new versions for audit trail
|
|
161
|
+
* PO Box addresses may have shipping restrictions
|
|
162
|
+
* Address validation improves delivery success rates
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Invoice
|
|
3
|
+
name: Invoice
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
identifier: invoiceId
|
|
6
|
+
summary: Represents a bill issued to a customer, detailing charges for products or services.
|
|
7
|
+
|
|
8
|
+
properties:
|
|
9
|
+
- name: invoiceId
|
|
10
|
+
type: UUID
|
|
11
|
+
required: true
|
|
12
|
+
description: Unique identifier for the invoice.
|
|
13
|
+
- name: customerId
|
|
14
|
+
type: UUID
|
|
15
|
+
required: true
|
|
16
|
+
description: Identifier of the customer being invoiced
|
|
17
|
+
references: Customer
|
|
18
|
+
relationType: hasOne
|
|
19
|
+
- name: orderId # Optional, if invoice is directly tied to a single order
|
|
20
|
+
type: UUID
|
|
21
|
+
required: false
|
|
22
|
+
description: Identifier of the associated order, if applicable.
|
|
23
|
+
- name: subscriptionId # Optional, if invoice is for a subscription period
|
|
24
|
+
type: UUID
|
|
25
|
+
required: false
|
|
26
|
+
description: Identifier of the associated subscription, if applicable.
|
|
27
|
+
- name: invoiceNumber
|
|
28
|
+
type: string
|
|
29
|
+
required: true
|
|
30
|
+
description: Human-readable, sequential identifier for the invoice (may have specific format).
|
|
31
|
+
- name: issueDate
|
|
32
|
+
type: Date
|
|
33
|
+
required: true
|
|
34
|
+
description: Date the invoice was generated and issued.
|
|
35
|
+
- name: dueDate
|
|
36
|
+
type: Date
|
|
37
|
+
required: true
|
|
38
|
+
description: Date by which the payment for the invoice is due.
|
|
39
|
+
- name: totalAmount
|
|
40
|
+
type: decimal
|
|
41
|
+
required: true
|
|
42
|
+
description: The total amount due on the invoice.
|
|
43
|
+
- name: currency
|
|
44
|
+
type: string # ISO 4217 code
|
|
45
|
+
required: true
|
|
46
|
+
description: Currency of the invoice amount.
|
|
47
|
+
- name: status
|
|
48
|
+
type: string # (e.g., Draft, Sent, Paid, Overdue, Void)
|
|
49
|
+
required: true
|
|
50
|
+
description: Current status of the invoice.
|
|
51
|
+
- name: billingAddressId # Address used for this specific invoice
|
|
52
|
+
type: UUID
|
|
53
|
+
required: true
|
|
54
|
+
description: Identifier for the billing address used on this invoice.
|
|
55
|
+
- name: lineItems
|
|
56
|
+
type: array
|
|
57
|
+
items:
|
|
58
|
+
type: InvoiceLineItem # Assuming a value object or separate entity for line items
|
|
59
|
+
required: true
|
|
60
|
+
description: List of individual items or services being charged on the invoice.
|
|
61
|
+
- name: createdAt
|
|
62
|
+
type: DateTime
|
|
63
|
+
required: true
|
|
64
|
+
description: Timestamp when the invoice record was created.
|
|
65
|
+
- name: paidAt # Timestamp when payment was confirmed
|
|
66
|
+
type: DateTime
|
|
67
|
+
required: false
|
|
68
|
+
description: Timestamp when the invoice was marked as paid.
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Overview
|
|
72
|
+
|
|
73
|
+
The Invoice entity represents a formal request for payment issued by the business to a customer. It details the products, services, quantities, prices, taxes, and total amount due, along with payment terms.
|
|
74
|
+
|
|
75
|
+
### Entity Properties
|
|
76
|
+
<EntityPropertiesTable />
|
|
77
|
+
|
|
78
|
+
## Relationships
|
|
79
|
+
|
|
80
|
+
* **Customer:** An invoice is issued to one `Customer`.
|
|
81
|
+
* **Order/Subscription:** An invoice may be related to one or more `Order`s or a specific `Subscription` period.
|
|
82
|
+
* **Payment:** An invoice is settled by one or more `Payment` transactions.
|
|
83
|
+
* **InvoiceLineItem:** An invoice contains multiple `InvoiceLineItem`s detailing the charges.
|
|
84
|
+
* **BillingProfile:** Invoice generation often uses details from the customer's `BillingProfile`.
|
|
85
|
+
|
|
86
|
+
## Examples
|
|
87
|
+
|
|
88
|
+
* Invoice #INV-00123 issued to Jane Doe for her monthly subscription renewal, due in 15 days.
|
|
89
|
+
* Invoice #INV-00124 issued to Acme Corp for consulting services rendered in the previous month, status Paid.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Payment
|
|
3
|
+
name: Payment
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
identifier: paymentId
|
|
6
|
+
aggregateRoot: true
|
|
7
|
+
summary: Represents payment transactions for orders in the e-commerce system.
|
|
8
|
+
properties:
|
|
9
|
+
- name: paymentId
|
|
10
|
+
type: UUID
|
|
11
|
+
required: true
|
|
12
|
+
description: Unique identifier for the payment
|
|
13
|
+
- name: orderId
|
|
14
|
+
type: UUID
|
|
15
|
+
required: true
|
|
16
|
+
description: Order this payment is associated with
|
|
17
|
+
references: Order
|
|
18
|
+
referencesIdentifier: orderId
|
|
19
|
+
relationType: hasOne
|
|
20
|
+
- name: customerId
|
|
21
|
+
type: UUID
|
|
22
|
+
required: true
|
|
23
|
+
description: Customer who made the payment
|
|
24
|
+
references: Customer
|
|
25
|
+
referencesIdentifier: customerId
|
|
26
|
+
relationType: hasOne
|
|
27
|
+
- name: amount
|
|
28
|
+
type: decimal
|
|
29
|
+
required: true
|
|
30
|
+
description: Payment amount
|
|
31
|
+
- name: currency
|
|
32
|
+
type: string
|
|
33
|
+
required: true
|
|
34
|
+
description: Currency code (e.g., USD, EUR, GBP)
|
|
35
|
+
- name: paymentMethod
|
|
36
|
+
type: string
|
|
37
|
+
required: true
|
|
38
|
+
description: Payment method used
|
|
39
|
+
enum: ['credit_card', 'debit_card', 'paypal', 'stripe', 'bank_transfer', 'apple_pay', 'google_pay']
|
|
40
|
+
- name: paymentMethodDetails
|
|
41
|
+
type: object
|
|
42
|
+
required: false
|
|
43
|
+
description: Additional payment method specific details
|
|
44
|
+
properties:
|
|
45
|
+
- name: cardLast4
|
|
46
|
+
type: string
|
|
47
|
+
description: Last 4 digits of card number
|
|
48
|
+
- name: cardType
|
|
49
|
+
type: string
|
|
50
|
+
description: Card type (Visa, MasterCard, etc.)
|
|
51
|
+
- name: expiryMonth
|
|
52
|
+
type: integer
|
|
53
|
+
description: Card expiry month
|
|
54
|
+
- name: expiryYear
|
|
55
|
+
type: integer
|
|
56
|
+
description: Card expiry year
|
|
57
|
+
- name: status
|
|
58
|
+
type: string
|
|
59
|
+
required: true
|
|
60
|
+
description: Current payment status
|
|
61
|
+
enum: ['pending', 'processing', 'completed', 'failed', 'cancelled', 'refunded', 'partially_refunded']
|
|
62
|
+
- name: transactionId
|
|
63
|
+
type: string
|
|
64
|
+
required: false
|
|
65
|
+
description: External payment processor transaction ID
|
|
66
|
+
- name: gatewayResponse
|
|
67
|
+
type: object
|
|
68
|
+
required: false
|
|
69
|
+
description: Raw response from payment gateway
|
|
70
|
+
- name: billingAddress
|
|
71
|
+
type: Address
|
|
72
|
+
required: true
|
|
73
|
+
description: Billing address for the payment
|
|
74
|
+
references: Address
|
|
75
|
+
referencesIdentifier: addressId
|
|
76
|
+
relationType: hasOne
|
|
77
|
+
- name: processedAt
|
|
78
|
+
type: DateTime
|
|
79
|
+
required: false
|
|
80
|
+
description: Date and time when payment was processed
|
|
81
|
+
- name: failureReason
|
|
82
|
+
type: string
|
|
83
|
+
required: false
|
|
84
|
+
description: Reason for payment failure if applicable
|
|
85
|
+
- name: refunds
|
|
86
|
+
type: array
|
|
87
|
+
items:
|
|
88
|
+
type: PaymentRefund
|
|
89
|
+
required: false
|
|
90
|
+
description: Refunds associated with this payment
|
|
91
|
+
- name: createdAt
|
|
92
|
+
type: DateTime
|
|
93
|
+
required: true
|
|
94
|
+
description: Date and time when the payment record was created
|
|
95
|
+
- name: updatedAt
|
|
96
|
+
type: DateTime
|
|
97
|
+
required: false
|
|
98
|
+
description: Date and time when the payment record was last updated
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Overview
|
|
102
|
+
|
|
103
|
+
The Payment entity manages all payment transactions in the e-commerce system. It tracks payment details, status, and relationships with orders and customers, supporting various payment methods and refund scenarios.
|
|
104
|
+
|
|
105
|
+
### Entity Properties
|
|
106
|
+
<EntityPropertiesTable />
|
|
107
|
+
|
|
108
|
+
## Relationships
|
|
109
|
+
|
|
110
|
+
* **Order:** Each payment belongs to one `Order` (identified by `orderId`).
|
|
111
|
+
* **Customer:** Each payment is made by one `Customer` (identified by `customerId`).
|
|
112
|
+
* **Address:** Each payment has a billing `Address` (identified by `billingAddress`).
|
|
113
|
+
* **PaymentRefund:** A payment can have multiple `PaymentRefund` entities for partial or full refunds.
|
|
114
|
+
|
|
115
|
+
## Payment States
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
pending → processing → completed
|
|
119
|
+
↓ ↓ ↓
|
|
120
|
+
cancelled failed refunded/partially_refunded
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Examples
|
|
124
|
+
|
|
125
|
+
* **Payment #1:** $299.99 credit card payment for Order #12345, completed successfully.
|
|
126
|
+
* **Payment #2:** $150.00 PayPal payment for Order #67890, failed due to insufficient funds.
|
|
127
|
+
* **Payment #3:** $500.00 bank transfer, completed with $50.00 partial refund.
|
|
128
|
+
|
|
129
|
+
## Business Rules
|
|
130
|
+
|
|
131
|
+
* Payment amount must match the order total
|
|
132
|
+
* Payment status transitions must follow valid state machine
|
|
133
|
+
* Failed payments should include failure reason
|
|
134
|
+
* Completed payments cannot be cancelled
|
|
135
|
+
* Refunds cannot exceed the original payment amount
|
|
136
|
+
* Payment method details are encrypted and PCI compliant
|
|
137
|
+
* Transaction IDs from payment gateways must be stored for reconciliation
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: PaymentMethod
|
|
3
|
+
name: PaymentMethod
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
identifier: paymentMethodId
|
|
6
|
+
summary: Represents a payment instrument a customer can use, like a credit card or bank account.
|
|
7
|
+
|
|
8
|
+
properties:
|
|
9
|
+
- name: paymentMethodId
|
|
10
|
+
type: UUID
|
|
11
|
+
required: true
|
|
12
|
+
description: Unique identifier for the payment method.
|
|
13
|
+
- name: customerId
|
|
14
|
+
type: UUID
|
|
15
|
+
required: true
|
|
16
|
+
description: Identifier of the customer who owns this payment method.
|
|
17
|
+
references: Customer
|
|
18
|
+
relationType: hasOne
|
|
19
|
+
- name: type
|
|
20
|
+
type: string # (e.g., CreditCard, BankAccount, PayPal, ApplePay)
|
|
21
|
+
required: true
|
|
22
|
+
description: The type of payment method.
|
|
23
|
+
- name: details # Contains type-specific details (masked, tokenized)
|
|
24
|
+
type: object
|
|
25
|
+
required: true
|
|
26
|
+
description: Contains type-specific, often sensitive details (e.g., last 4 digits of card, card brand, bank name, account type, token). **Never store raw PANs or sensitive data.**
|
|
27
|
+
# Example structure for CreditCard:
|
|
28
|
+
# details:
|
|
29
|
+
# brand: "Visa"
|
|
30
|
+
# last4: "1234"
|
|
31
|
+
# expiryMonth: 12
|
|
32
|
+
# expiryYear: 2025
|
|
33
|
+
# cardholderName: "Jane Doe"
|
|
34
|
+
# gatewayToken: "tok_abc123xyz"
|
|
35
|
+
- name: isDefault
|
|
36
|
+
type: boolean
|
|
37
|
+
required: true
|
|
38
|
+
description: Indicates if this is the customer's default payment method.
|
|
39
|
+
- name: billingAddressId # Link to the billing address associated with this method
|
|
40
|
+
type: UUID
|
|
41
|
+
required: true
|
|
42
|
+
description: Identifier for the billing address verified for this payment method.
|
|
43
|
+
- name: status
|
|
44
|
+
type: string # (e.g., Active, Expired, Invalid, Removed)
|
|
45
|
+
required: true
|
|
46
|
+
description: Current status of the payment method.
|
|
47
|
+
- name: createdAt
|
|
48
|
+
type: DateTime
|
|
49
|
+
required: true
|
|
50
|
+
description: Timestamp when the payment method was added.
|
|
51
|
+
- name: updatedAt
|
|
52
|
+
type: DateTime
|
|
53
|
+
required: true
|
|
54
|
+
description: Timestamp when the payment method was last updated.
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Overview
|
|
58
|
+
|
|
59
|
+
The PaymentMethod entity represents a specific payment instrument registered by a customer, such as a credit card or a linked bank account. It stores necessary (non-sensitive) details required to initiate payments and links to the associated customer and billing address.
|
|
60
|
+
|
|
61
|
+
**Security Note:** Sensitive details like full card numbers or bank account numbers should **never** be stored directly. Rely on tokenization provided by payment gateways.
|
|
62
|
+
|
|
63
|
+
### Entity Properties
|
|
64
|
+
<EntityPropertiesTable />
|
|
65
|
+
|
|
66
|
+
## Relationships
|
|
67
|
+
|
|
68
|
+
* **Customer:** A payment method belongs to one `Customer`.
|
|
69
|
+
* **Address:** Linked to a specific billing `Address`.
|
|
70
|
+
* **Payment:** Used to make `Payment` transactions.
|
|
71
|
+
* **Subscription:** May be designated as the payment method for a `Subscription`.
|
|
72
|
+
|
|
73
|
+
## Examples
|
|
74
|
+
|
|
75
|
+
* Jane Doe's default Visa card ending in 1234, expiring 12/2025, status Active.
|
|
76
|
+
* John Smith's linked bank account (Chase, Checking), status Active.
|
|
77
|
+
* An old MasterCard ending in 5678 belonging to Jane Doe, status Expired.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: Transaction
|
|
3
|
+
name: Transaction
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
identifier: transactionId
|
|
6
|
+
summary: Represents a low-level interaction with a payment gateway or processor (e.g., authorize, capture, refund, void).
|
|
7
|
+
|
|
8
|
+
properties:
|
|
9
|
+
- name: transactionId
|
|
10
|
+
type: UUID
|
|
11
|
+
required: true
|
|
12
|
+
description: Unique identifier for this specific gateway transaction.
|
|
13
|
+
- name: paymentId
|
|
14
|
+
type: UUID
|
|
15
|
+
required: true
|
|
16
|
+
references: Payment
|
|
17
|
+
relationType: hasOne
|
|
18
|
+
description: Identifier of the parent Payment this transaction belongs to.
|
|
19
|
+
- name: type
|
|
20
|
+
type: string # (e.g., Authorize, Capture, Sale, Refund, Void, Verify)
|
|
21
|
+
required: true
|
|
22
|
+
description: The type of operation performed with the payment gateway.
|
|
23
|
+
- name: gatewayReferenceId
|
|
24
|
+
type: string
|
|
25
|
+
required: true
|
|
26
|
+
description: Unique transaction ID provided by the external payment gateway.
|
|
27
|
+
- name: amount
|
|
28
|
+
type: decimal
|
|
29
|
+
required: true
|
|
30
|
+
description: The amount associated with this specific transaction operation.
|
|
31
|
+
- name: currency
|
|
32
|
+
type: string # ISO 4217 code
|
|
33
|
+
required: true
|
|
34
|
+
description: Currency of the transaction amount.
|
|
35
|
+
- name: status
|
|
36
|
+
type: string # (e.g., Success, Failure, Pending)
|
|
37
|
+
required: true
|
|
38
|
+
description: Status reported by the gateway for this specific operation.
|
|
39
|
+
- name: responseCode # Gateway-specific code
|
|
40
|
+
type: string
|
|
41
|
+
required: false
|
|
42
|
+
description: Response code returned by the payment gateway.
|
|
43
|
+
- name: responseMessage # Gateway-specific message
|
|
44
|
+
type: string
|
|
45
|
+
required: false
|
|
46
|
+
description: Detailed message or reason returned by the gateway.
|
|
47
|
+
- name: processedAt
|
|
48
|
+
type: DateTime
|
|
49
|
+
required: true
|
|
50
|
+
description: Timestamp when the transaction was processed by the gateway.
|
|
51
|
+
- name: rawRequest # Optional, for debugging - consider security implications
|
|
52
|
+
type: text
|
|
53
|
+
required: false
|
|
54
|
+
description: Raw request payload sent to the gateway (use with caution).
|
|
55
|
+
- name: rawResponse # Optional, for debugging - consider security implications
|
|
56
|
+
type: text
|
|
57
|
+
required: false
|
|
58
|
+
description: Raw response payload received from the gateway (use with caution).
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Overview
|
|
62
|
+
|
|
63
|
+
The Transaction entity logs the individual interactions with an external payment processor (like Stripe, PayPal, Adyen) that occur as part of processing a `Payment`. This provides a detailed audit trail of gateway operations, including authorizations, captures, refunds, and any associated success or failure responses.
|
|
64
|
+
|
|
65
|
+
### Entity Properties
|
|
66
|
+
<EntityPropertiesTable />
|
|
67
|
+
|
|
68
|
+
## Relationships
|
|
69
|
+
|
|
70
|
+
* **Payment:** A transaction is part of one `Payment`.
|
|
71
|
+
|
|
72
|
+
## Examples
|
|
73
|
+
|
|
74
|
+
* **Authorization Success:** Type: Authorize, PaymentID: PAY-98765, GatewayRef: auth_abc, Amount: $19.99, Status: Success.
|
|
75
|
+
* **Capture Success:** Type: Capture, PaymentID: PAY-98765, GatewayRef: ch_def, Amount: $19.99, Status: Success (following the authorization).
|
|
76
|
+
* **Authorization Failure:** Type: Authorize, PaymentID: PAY-98766, GatewayRef: auth_ghi, Amount: $50.00, Status: Failure, ResponseCode: 'declined', ResponseMessage: 'Insufficient Funds'.
|
|
77
|
+
* **Refund Success:** Type: Refund, PaymentID: PAY-98760, GatewayRef: re_jkl, Amount: $25.00, Status: Success.
|
|
@@ -9,6 +9,16 @@ owners:
|
|
|
9
9
|
services:
|
|
10
10
|
- id: PaymentService
|
|
11
11
|
version: 0.0.1
|
|
12
|
+
- id: FraudDetectionService
|
|
13
|
+
version: 0.0.1
|
|
14
|
+
- id: PaymentGatewayService
|
|
15
|
+
version: 0.0.1
|
|
16
|
+
entities:
|
|
17
|
+
- id: Invoice
|
|
18
|
+
- id: Payment
|
|
19
|
+
- id: PaymentMethod
|
|
20
|
+
- id: Transaction
|
|
21
|
+
- id: Address
|
|
12
22
|
badges:
|
|
13
23
|
- content: Payment Domain
|
|
14
24
|
backgroundColor: blue
|
|
@@ -19,6 +29,12 @@ badges:
|
|
|
19
29
|
|
|
20
30
|
The Payment Domain encompasses all services and components related to handling financial transactions within the system. It is responsible for managing payments, transactions, billing, and financial records. The domain ensures secure, reliable, and efficient processing of all payment-related activities
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
### Architecture for the Payment domain
|
|
23
33
|
|
|
24
34
|
<NodeGraph />
|
|
35
|
+
|
|
36
|
+
### Entity Map
|
|
37
|
+
|
|
38
|
+
A visualization of the entities in the Payment domain. Here you can see the relationships between the entities and how they are used in the domain.
|
|
39
|
+
|
|
40
|
+
<EntityMap id="Payment" />
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: FraudCheckCompleted
|
|
3
|
+
version: 0.0.1
|
|
4
|
+
name: Fraud Check Completed
|
|
5
|
+
summary: Emitted when a fraud check has been completed for a transaction
|
|
6
|
+
tags:
|
|
7
|
+
- payment
|
|
8
|
+
- fraud
|
|
9
|
+
- security
|
|
10
|
+
badges:
|
|
11
|
+
- content: New
|
|
12
|
+
backgroundColor: green
|
|
13
|
+
textColor: white
|
|
14
|
+
schemaPath: schema.json
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
import Footer from '@catalog/components/footer.astro'
|
|
18
|
+
|
|
19
|
+
## Overview
|
|
20
|
+
|
|
21
|
+
The `FraudCheckCompleted` event is emitted when the fraud detection service has completed its analysis of a payment transaction. This event contains the risk assessment results and recommendations.
|
|
22
|
+
|
|
23
|
+
## Schema
|
|
24
|
+
|
|
25
|
+
<SchemaViewer title="FraudCheckCompleted Schema" schemaPath={frontmatter.schemaPath} />
|
|
26
|
+
|
|
27
|
+
## Event Details
|
|
28
|
+
|
|
29
|
+
- **Risk Score**: A numerical score from 0-100 indicating fraud risk
|
|
30
|
+
- **Decision**: APPROVED, DECLINED, or MANUAL_REVIEW
|
|
31
|
+
- **Reasons**: Array of reasons for the decision
|
|
32
|
+
- **Confidence**: Confidence level of the fraud detection
|
|
33
|
+
|
|
34
|
+
## Example Payload
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"transactionId": "txn_1234567890",
|
|
39
|
+
"paymentId": "pay_9876543210",
|
|
40
|
+
"riskScore": 25,
|
|
41
|
+
"decision": "APPROVED",
|
|
42
|
+
"reasons": ["Low risk merchant", "Customer history positive"],
|
|
43
|
+
"confidence": 0.92,
|
|
44
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
<Footer />
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"transactionId": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"description": "Unique identifier for the transaction"
|
|
8
|
+
},
|
|
9
|
+
"paymentId": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Unique identifier for the payment"
|
|
12
|
+
},
|
|
13
|
+
"riskScore": {
|
|
14
|
+
"type": "number",
|
|
15
|
+
"minimum": 0,
|
|
16
|
+
"maximum": 100,
|
|
17
|
+
"description": "Risk score from 0-100"
|
|
18
|
+
},
|
|
19
|
+
"decision": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"enum": ["APPROVED", "DECLINED", "MANUAL_REVIEW"],
|
|
22
|
+
"description": "Fraud check decision"
|
|
23
|
+
},
|
|
24
|
+
"reasons": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "string"
|
|
28
|
+
},
|
|
29
|
+
"description": "Reasons for the decision"
|
|
30
|
+
},
|
|
31
|
+
"confidence": {
|
|
32
|
+
"type": "number",
|
|
33
|
+
"minimum": 0,
|
|
34
|
+
"maximum": 1,
|
|
35
|
+
"description": "Confidence level of the decision"
|
|
36
|
+
},
|
|
37
|
+
"timestamp": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"format": "date-time",
|
|
40
|
+
"description": "When the fraud check was completed"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"required": ["transactionId", "paymentId", "riskScore", "decision", "timestamp"]
|
|
44
|
+
}
|