Feature: Royal Mail shipping integration with weight-based postage
Added: - Weight field (weightGrams) to Product model for storing item weights - Shipping fields to Order model (shippingCost, shippingCountry, shippingService) - Royal Mail shipping service (royalmail-shipping.ts) with: * Domestic and international postage calculations * Integration ready for Royal Mail API (currently uses estimated rates) * Support for multiple shipping services * Clear international delivery time warnings - Shipping quotes API endpoint (/api/checkout/shipping-quotes) - Checkout integration to calculate and include shipping cost Weight is stored in grams, displayed to users in kilograms. Shipping cost is calculated based on total cart weight and destination country.
This commit is contained in:
@@ -41,6 +41,7 @@ model Product {
|
||||
printAreaHeightMm Int @default(280) // height of the printable area in millimeters
|
||||
referenceWidthCm Int? // width of garment/object for ruler reference (cm)
|
||||
referenceHeightCm Int? // height of garment/object for ruler reference (cm)
|
||||
weightGrams Int? // weight in grams (used for Royal Mail postage calculation via API)
|
||||
imageUrl String? // optional real product photo — shown instead of the illustration when set
|
||||
imageUrlBack String? // optional back-view photo, toggled alongside the front photo
|
||||
photoRecolorable Boolean @default(false) // if true, the photo is treated as a grayscale
|
||||
@@ -218,12 +219,15 @@ model Order {
|
||||
stripeSessionId String? @unique
|
||||
email String?
|
||||
shippingAddress String? // JSON — collected by Stripe Checkout, saved once payment completes
|
||||
shippingCountry String? // ISO 2-letter country code (e.g., 'GB', 'US') for Royal Mail shipping
|
||||
status String @default("PENDING") // PENDING | PAID | PRINTING | PRINTED | SHIPPED | DELIVERED | FAILED
|
||||
archived Boolean @default(false)
|
||||
total Int // cents
|
||||
total Int // cents (includes shipping cost)
|
||||
shippingCost Int @default(0) // cents — Royal Mail postage cost
|
||||
|
||||
// Shipping & tracking info
|
||||
carrier String? // e.g. "Royal Mail", "DPD", "Courier"
|
||||
shippingService String? // e.g. "Royal Mail 24®", "International Signed" — selected by customer at checkout
|
||||
carrier String? @default("Royal Mail") // e.g. "Royal Mail", "DPD", "Courier"
|
||||
trackingNumber String? // tracking number from carrier
|
||||
estimatedDeliveryDate DateTime? // estimated delivery date
|
||||
|
||||
|
||||
Reference in New Issue
Block a user