Files
vmall/openspec/changes/archive/2026-09-24-add-freight-templates/specs/order/spec.md
T

1.5 KiB

ADDED Requirements

Requirement: Checkout computes per-shop shipping fees

The checkout request SHALL carry the destination address, and in the same transaction that creates the shop orders the server SHALL compute each shop order's shipping fee from the shipping capability's resolution and calculation rules and add it to that order's total. Per-shop fees and their sum SHALL be returned in the checkout response. Client-supplied shipping fees or totals SHALL NOT be persisted.

Scenario: two shops pay two fees

  • WHEN a checkout covers two shops whose templates both charge shipping to the destination
  • THEN each created order carries its own computed shipping fee and the response reports both plus the sum

Scenario: address change recomputes

  • WHEN the buyer submits the same cart to a destination whose region rule raises the fee
  • THEN the created orders' shipping fees reflect the new destination rather than any earlier quote

Requirement: Order shipping and pricing snapshots

Each order SHALL persist its shipping fee in i64 minor units alongside its other amounts, and each order item SHALL snapshot the freight pricing method and template applied at checkout. Order detail, payment, and history views SHALL read these snapshots so later template edits cannot change historical orders.

Scenario: detail shows the persisted fee

  • WHEN a customer or shop user opens an order created before a template's fees changed
  • THEN the order detail shows the shipping fee and item pricing methods snapshotted at checkout