Files
vmall/docs/code_index/order.md
T
Chengdong ZhangandCursor 3188bf7672 feat(pricing): price configurable products before marketing
Versioned common and linear rules compute the payable price and snapshot it on the order, with the design reference for later strategies such as agreement pricing.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 14:25:06 +08:00

4.5 KiB

Index: Order & Freight

Domain design: docs/domains/orders.md. Specs: openspec/specs/order/, shipment/, shipping/, payment/ (change add-configurable-payments).

Backend (apps/api)

File Holds
src/modules/order/service.rs checkout transaction (cart, direct purchase, or configured direct purchase with expected-total 409), payment membership, header-hash idempotency, service start/deliver, cancel, shipping quote
src/modules/order/repo.rs ORDER_COLS/ORDER_ITEM_COLS, insert_order/insert_item, locks, status transitions
src/modules/order/handlers.rs /orders* customer routes, /shop/orders*, /admin/orders
src/modules/order/dto.rs OrderView, AddressBody, ShippingQuoteView
src/modules/payment/service.rs payment resolution, eligible methods, attempts, wallet collection, group cancellation
src/modules/payment/repo.rs payments/memberships/checkout_requests/attempts/receipts/refunds/commands/events rows
src/modules/payment/adapters.rs wallet + Stripe crypto-only Checkout adapter boundary, capabilities
src/modules/payment/worker.rs durable command lease/execute/recovery, supervised worker
src/modules/payment/webhooks.rs raw-body Stripe signature/timestamp verification, dedup inbox
src/modules/payment/refunds.rs original-method refund budgets, wallet/Stripe refund submission
src/modules/payment/admin.rs channel CRUD/revisions/audit/verify, operations list/detail, reconcile
src/modules/payment/handlers.rs /payments* owner routes, /admin/payments*, /payments/webhooks/stripe/{id}
src/modules/payment/dto.rs payment DTOs, text enums, config shapes
src/modules/fulfillment/ shipments for physical orders only: create (company-validated), ship, confirm-delivered
src/modules/freight/service.rs template CRUD, region rules, shop_fee() calculation, company dictionary
src/modules/freight/handlers.rs /shop/freight-templates*, /shipping/companies
migrations/0004_orders.sql orders/order_items/shipments base schema
migrations/0017_freight_templates.sql freight tables, orders.shipping_fee_minor, item snapshots, skus.weight_grams
migrations/0024_payments.sql payments domain, legacy-demo provenance, aftersale refund states
migrations/0025_checkout_request_header_hash.sql cart-independent header hash for checkout idempotency
migrations/0026_threshold_promotions.sql threshold rules, orders.threshold_promotion_id, coupon/threshold exclusivity check
migrations/0028_fulfillment_kinds.sql fulfillment_kind, order contact/details/delivery note, nullable shipping address
migrations/0029_pricing.sql order item configuration, quote_snapshot, pricing_rule_id
tests/orders.rs, tests/freight.rs, tests/payments.rs, tests/fulfillment_kinds.rs, tests/pricing.rs integration coverage

Shared contract (packages/shared/src)

types.ts: Order, OrderItem, Shipment, FreightTemplate*, ShippingCompany, ShippingQuote, Payment, CheckoutResult, PaymentAttemptResult, EligibleMethod, NextAction, PaymentChannel*, PaymentOperation*, RefundOperation. api.ts: checkout, resolvePayment, getPayment, listPaymentMethods, createPaymentAttempt, cancelPayment, quoteShipping, listShippingCompanies, shop freight CRUD, createShipment, shop.startFulfilment, shop.deliverService, admin channel/operations/reconcile methods. Order.shipping_address is null for a provisioned service; fulfillment_kind, contact, and delivery_note describe that order. A configured line stores configuration, quote_snapshot, and pricing_rule_id; checkout accepts that configuration and expected_total_minor.

Frontends

  • Mall: pages/checkout/{index,pay,success}.vue (direct mode skips address, freight, and coupons; a configured purchase sends the quote and re-confirms a 409), pages/goods/[id].vue (service buy-now), pages/user/orders/, pages/user/addresses.vue
  • Mobile: pages/checkout/, pages/orders/ (configured payment + return handling; service orders show contact and hide shipments), pages/product/[id].vue (service purchase disabled)
  • Shop-admin: pages/orders/ (service start-fulfilment and deliver), pages/shipments.vue, pages/freight-templates.vue, components/ProductForm.vue (fulfillment kind, freight template, SKU weight)
  • Admin: pages/orders.vue (read-only), pages/payment-channels.vue, pages/payments.vue (operations list/detail/reconcile)