Order Model + Sub-entities
models/order.dart · Order, OrderItem, OrderAddress, OrderCustomer, SplitOrderPayment
Overview
Unified Order shape that absorbs both the Medusa /store/orders response and the seller /vendor/orders response. Customer-facing fields (sellerName/Phone/Photo, startTime/endTime, shipping methods) sit alongside seller-facing fields (customer block, splitOrderPayment).
User Flow
- Order.fromJson reads the Medusa payload and conditionally populates customer + splitOrderPayment when those keys exist (seller response).
- OrderItem nests variant info needed by OrderCard.
- OrderAddress carries shipping + billing addresses.
- SplitOrderPayment surfaces status / authorized / captured / refunded for seller-side UIs.
- displayIdFormatted formats the human-readable id used in logs and the receipt.
Cases & Edge Cases
- fromJson is intentionally lenient — parse errors on a single order are caught upstream (in OrderService) and that order is dropped from the list rather than aborting the whole load.
- Seller payload includes product_type='provision' on items which the UI can use to differentiate physical vs booking orders.
- Some customer-side fields (seller info, startTime/endTime) are derived from order metadata.slot — null is normal for non-booking orders.
Code References
- lib/src/features/shared/orders/models/order.dart:3 // Order
- lib/src/features/shared/orders/models/order.dart // OrderItem / OrderAddress / OrderCustomer / SplitOrderPayment
API Calls
Empty — fill this in later. Open the manifest and add content here.
Notes
The CLAUDE.md inside this feature folder documents the seller-orders rollout plan — keep new fields in fromJson tolerant of both response shapes.