6492619cbc
- Create service layer for email generation (PaymentMethodService, OrderTransformerService, EmailBuilderService) - Extract all hardcoded values to configuration files - Add proper TypeScript types for all email data structures - Update GraphQL subscription to include transactions and events - Refactor order-created, order-cancelled templates to use new architecture - Payment method now dynamically detected from order transactions This makes the email system: - Testable: Each service can be unit tested independently - Configurable: All values in config.ts, no hardcoding - Extensible: Easy to add new languages or payment methods - Maintainable: Clear separation of concerns
99 lines
1.3 KiB
GraphQL
99 lines
1.3 KiB
GraphQL
fragment OrderCreatedWebhookPayload on OrderCreated {
|
|
order {
|
|
id
|
|
number
|
|
created
|
|
status
|
|
userEmail
|
|
languageCode
|
|
channel {
|
|
slug
|
|
}
|
|
user {
|
|
email
|
|
firstName
|
|
lastName
|
|
}
|
|
shippingAddress {
|
|
firstName
|
|
lastName
|
|
streetAddress1
|
|
streetAddress2
|
|
city
|
|
postalCode
|
|
country {
|
|
country
|
|
}
|
|
phone
|
|
}
|
|
billingAddress {
|
|
firstName
|
|
lastName
|
|
streetAddress1
|
|
streetAddress2
|
|
city
|
|
postalCode
|
|
country {
|
|
country
|
|
}
|
|
phone
|
|
}
|
|
lines {
|
|
id
|
|
quantity
|
|
unitPrice {
|
|
gross {
|
|
amount
|
|
currency
|
|
}
|
|
}
|
|
totalPrice {
|
|
gross {
|
|
amount
|
|
currency
|
|
}
|
|
}
|
|
variant {
|
|
name
|
|
sku
|
|
product {
|
|
name
|
|
media {
|
|
url
|
|
}
|
|
}
|
|
}
|
|
}
|
|
subtotal {
|
|
gross {
|
|
amount
|
|
currency
|
|
}
|
|
}
|
|
shippingPrice {
|
|
gross {
|
|
amount
|
|
currency
|
|
}
|
|
}
|
|
total {
|
|
gross {
|
|
amount
|
|
currency
|
|
}
|
|
}
|
|
metadata {
|
|
key
|
|
value
|
|
}
|
|
transactions {
|
|
id
|
|
message
|
|
externalUrl
|
|
events {
|
|
message
|
|
type
|
|
}
|
|
}
|
|
}
|
|
} |