Files
2026-08-27 15:50:09 +02:00

43 lines
2.3 KiB
Go

// Package catalog defines the published, versioned catalog projection that
// commerce modules (cart, checkout, order) consume — and the configurable
// per-tenant Schema that maps a producer's private item JSON into that
// projection.
//
// Why configurable: different tenants ship with different catalog shapes
// (one has ArticleNumber, another has sku; one's price is inc-VAT minor units,
// another's is a float with a separate currency; some include a Brand field,
// others don't). A one-size-fits-all Projection field set would force every
// tenant to field the union of all constraints; the configurable Schema keeps
// each tenant's producer adapter small while still emitting the same
// downstream wire shape, so commerce consumers do not change.
//
// What's here:
//
// - Projection: the published, versioned entry (struct + Encode helpers).
// - Schema: declarative field-map for one tenant's source JSON.
// - DefaultSchema: the consensus shape that works out of the box when no
// tenant-specific override is supplied.
// - Registry: per-tenant lookup with DefaultSchema fallback.
// - Builder: applies a Schema to a generic source map; pure function.
//
// What is NOT here (kept out by design):
//
// - Numerics live in minor units (öre) and stay int64 — never float. The
// platform-wide rate-scale convention (basis-points-of-a-percent) is
// documented in platform/tax; TaxClass is a STRING identifier on the
// Projection side and is resolved to a numeric rate by platform/tax, never
// on the wire.
// - No transport, no AMQP consumer/producer, no event-subscriber wiring —
// callers publish / consume `Projection` JSON via the existing
// `platform/event` + `platform/rabbit` package plumbing.
// - No HTTP lookup. Finder remains the federation source; no commerce module
// issues a "lookup this SKU" RPC today and resolving it here would be
// premature.
//
// This package implements the catalog side of the shared vocabulary used by
// `platform/event` + `platform/inventory` + `platform/order`. A generic
// `platform/node` aggregate is deliberately held back (see docs/status.md
// "Deliberately deferred"); cross-module boundaries are served by
// `platform/catalog` + `platform/projection` instead.
package catalog