2.0 KiB
2.0 KiB
Implementer — F-017 Pricing module
Summary
Implemented server-side pricing with VAT behind a public PricingService, including PostgreSQL persistence, append-only price history, API routes, migration, and tests.
Files changed
project/migrations/012_pricing.jsproject/src/app/build-app.tsproject/src/app/tests/pricing.itest.tsproject/src/modules/pricing/index.tsproject/src/modules/pricing/api/pricing.routes.tsproject/src/modules/pricing/application/pricing-service.tsproject/src/modules/pricing/domain/errors.tsproject/src/modules/pricing/domain/ports.tsproject/src/modules/pricing/domain/price.tsproject/src/modules/pricing/infrastructure/pg-pricing-repository.tsproject/src/modules/pricing/tests/boundary.test.tsproject/src/modules/pricing/tests/pricing-service.test.ts
Acceptance evidence
- AC1 variant + quantity returns total with VAT: covered by
pricing-service.test.tsandpricing.itest.ts. - AC2 client-supplied price ignored:
pricing.itest.tssends bogus client price fields to/pricing/calculate; response uses persisted server-side price. - AC3 price change writes history row:
pricing.itest.tsverifies creation and update both append rows topricing_price_history. verify.sh: passed.
Commands run
cd project && npm run typecheck— passedcd project && npm run lint— passed after Prettier formattingcd project && npm run build— passedcd project && npm test— passed; DB integration tests skipped withoutTEST_DATABASE_URLcd project && TEST_DATABASE_URL='postgres://mdv:mdv_dev_only@localhost:5432/mdv_test' npm run test:integration -- pricing.itest migrations.itest— passed; 9 files, 39 tests./scripts/verify.sh— passed
Notes
- No new runtime dependency was added.
- Money is represented as integer cents only.
- VAT rates are
general21% andreduced10%. - Pricing stores
variant_idas an opaque UUID and does not import or join catalog internals.