Files
mercadodevida/work/artifacts/F-017/documenter.md
2026-08-17 22:23:10 +02:00

1.9 KiB

Documenter — F-017 Pricing module

Summary

Documented F-017 pricing behavior in this evidence artifact. Project README updates are not applied during document stage because the active repository guard restricts project/ product edits to build/implementer state.

Public API notes

Pricing owns server-side price and VAT truth for product variants. Callers provide variant identity and quantity only; client-supplied prices, tax amounts, discounts, subtotals, or totals are not trusted.

Route Access Result
GET /pricing/variants/:variantId public 200 current server-side variant price
PUT /pricing/variants/:variantId admin only 200 updated price and history row written
POST /pricing/calculate public 200 calculated net subtotal, VAT and total

Error codes

  • PRICING_PRICE_NOT_FOUND — HTTP 404
  • INVALID_PRICE — HTTP 422

Money and VAT rules

  • Money is represented as integer cents only.
  • Currency is fixed to EUR.
  • Stored price is netUnitAmountCents before VAT.
  • VAT rates:
    • general = 21% (2100 basis points)
    • reduced = 10% (1000 basis points)
  • Calculation: netSubtotal = netUnitAmountCents * quantity; vatAmount = round(netSubtotal * vatBps / 10000); total = netSubtotal + vatAmount.

Audit/history

  • Current price lives in pricing_variant_prices.
  • Every create/update writes an append-only row to pricing_price_history with previous and new values.
  • Variant ids are opaque UUIDs; pricing does not import catalog internals or join catalog tables.

Evidence

  • work/artifacts/F-017/architect.md
  • work/artifacts/F-017/implementer.md
  • work/artifacts/F-017/reviewer.json
  • work/artifacts/F-017/security.json
  • work/artifacts/F-017/qa.json