Files
BMS/bms-back/sql/price/README_billing_postcode.md
T
2026-09-15 16:55:11 +08:00

23 lines
953 B
Markdown

# Billing quote / order sync: postcode -> zone
## Rule
- Whether a country needs a zone is decided by `bms_product_country` (rows with `zone_code`).
- If the product+country has zones: request **must** include `destPostcode`.
- Zone is resolved at runtime: `destPostcode` -> `prc_zone_detail` + `prc_zone` -> `zone_code`, then match `bms_product_country`.
- Billing tables store **postcode only**, not zone columns:
- `prc_quote.dest_postcode`
- `prc_order_bill.dest_postcode` (already existed)
## SQL
Run: `bms-back/sql/price/billing_postcode_alter.sql`
## API fields
- Request: `destPostcode` on `/api/tms/price/quote` and `/api/tms/price/bill` (and console `/price/billing/quote`).
- Response may include `zoneId` / `zoneCode` / `zoneName` for display only (not persisted on bill/quote tables).
## Errors (i18n)
- `price.quote.postcodeRequired`
- `price.quote.postcodeZoneNotFound`
- `price.quote.zonePriceNotHit`
- `price.quote.priceNotHit`