Make tax a first-class part of the backend. You'll add a tax rates configuration API, allow carts to pick a tax country, and ensure checkout snapshots tax details onto orders so historical totals remain stable even when rates change.
Overview
Syllabus
- Unit 1: Tax Rates Configuration
- Review the repository, service, and resource routes for tax rates
- Implement repository queries for tax rates
- Implement validation and service functions for tax rates
- Implement loader/action handlers for tax rates
- Unit 2: Applying Country Based Taxes
- Review how carts store tax_country and compute totals
- Implement cart tax country validation and persistence
- Resolve tax rate by country and compute cart totals
- Implement the cart tax country action handler
- Unit 3: Snapshotting Tax at Checkout
- Review how checkout snapshots tax_rate_bps onto orders
- Persist tax snapshot fields on the order at checkout
- Snapshotting Tax at Checkout
- Remove recomputation and rely on checkout snapshots