Order documents: building one from a completed checkout, applying the updates a platform sends, and recording fulfillment events.
Schema validation is delegated to the generated
Bazaar.Schemas.Shopping.OrderResp.
order = Bazaar.Order.from_checkout(checkout, "order_123", "https://shop.example/orders/123")
{:ok, order} = Bazaar.Order.apply_update(order, params)
order = Bazaar.Order.add_event(order, shipped_event)
Summary
Functions
Appends a fulfillment event (shipped, delivered, ...) to an order.
Applies an update a platform sent for an order: new fulfillment.events
and adjustments are appended by id. Adjustments must be a list of entries
with a status of pending, completed or failed, otherwise
{:error, :invalid_adjustments}.
Builds the order document for a completed checkout document.
Functions
Appends a fulfillment event (shipped, delivered, ...) to an order.
Applies an update a platform sent for an order: new fulfillment.events
and adjustments are appended by id. Adjustments must be a list of entries
with a status of pending, completed or failed, otherwise
{:error, :invalid_adjustments}.
Builds the order document for a completed checkout document.
Line items become order line items (quantity: %{total, fulfilled},
status: "processing"), totals and buyer are carried over, and one
fulfillment expectation per method describes the selected option and
destination. UCP orders require a currency, so the checkout must carry one.