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

1.2 KiB

Implementer — F-020 Shipping module

Summary

Implemented server-side shipping quotation with zones, methods and free-shipping threshold behind ShippingService.calculate(cartTotalCents, address).

Files changed

  • project/migrations/015_shipping.js
  • project/src/modules/shipping/**
  • project/src/app/build-app.ts
  • project/src/app/tests/shipping.itest.ts

Acceptance evidence

  • AC1 known zone: shipping.itest.ts seeds ES/28 zone with 500 cents method; /shipping/calculate returns 500.
  • AC2 unknown zone: same test sends US/94101 and gets HTTP 422 with SHIPPING_ZONE_NOT_FOUND.
  • AC3 free shipping threshold: same test sends cart total above threshold and gets 0/freeApplied.
  • verify.sh: passed.

Commands run

  • cd project && npm run lint/typecheck/build/test passed
  • cd project && TEST_DATABASE_URL='postgres://mdv:mdv_dev_only@localhost:5432/mdv_test' npm run test:integration -- shipping.itest migrations.itest passed; 12 files, 47 tests
  • ./scripts/verify.sh passed

Notes

  • No new runtime dependency.
  • Carrier adapter remains an interface; no real carrier integration.
  • Cheapest active method per zone wins. Postal code prefix matching is most specific first.