Skip to content

feat(routes-f): vat and sales tax calculator (reissue) #759

@davedumto

Description

@davedumto

Summary

Add a VAT/tax calculator at app/api/routes-f/vat/route.ts. Calculate tax-inclusive and tax-exclusive amounts.

Requirements

  • POST body { amount, rate, mode?: add|extract }
  • add mode: amount is pre-tax, return { net, tax, gross }
  • extract mode: amount is gross, return { net, tax, gross }
  • Default mode add
  • Validate rate in [0, 100], amount >= 0
  • Round to 2 decimals
  • Bundle small reference table of common country VAT rates inside folder
  • Tests cover both modes, round-trip lossless, edge cases (0% rate)

Scope Constraint - READ BEFORE STARTING

All files for this task must live inside app/api/routes-f/. This includes the route handler, helpers/utilities, types, and tests. Do NOT modify, import from, or add files to lib/, utils/, types/, components/, or anywhere else outside app/api/routes-f/. If you need shared logic, duplicate it inside your subfolder. Keeping everything scoped to this folder is intentional - it keeps these tasks independent and mergeable in any order.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions