Skip to content

E8-F2: Service Fee Calculation

Epic: E8: Payment Processing

Size: S (Small)

Problem / Outcome

Calculate service fees and VAT correctly.

Scope

In-Scope:

  • 6% ticket fee (configurable per match)
  • VAT rates: 5% HOME ticket, 0% AWAY ticket
  • VAT rates: 25% HOME fee, 0% AWAY fee

Out-of-Scope:

  • Dynamic fee rates

Acceptance Criteria

  • AC1: Given HOME match, ticket VAT = 5%, fee VAT = 25%
  • AC2: Given AWAY match, ticket VAT = 0%, fee VAT = 0%
  • AC3: Fee shown separately on invoice from ticket price

Data Model Impact

Order table:
- ticket_amount (DECIMAL) - base ticket price
- ticket_vat_amount (DECIMAL)
- fee_amount (DECIMAL) - service fee
- fee_vat_amount (DECIMAL)
- total_amount (DECIMAL)

FeeConfiguration table:
- id (UUID, PK)
- match_id (UUID, FK, nullable) - null for default
- fee_percent (DECIMAL, default 6.0)
- home_ticket_vat_percent (DECIMAL, default 5.0)
- away_ticket_vat_percent (DECIMAL, default 0.0)
- home_fee_vat_percent (DECIMAL, default 25.0)
- away_fee_vat_percent (DECIMAL, default 0.0)

Permissions/Roles

  • System (calculation)

How to Verify

npm test -- --grep "fee calculation"

Expected: Correct amounts for HOME and AWAY matches.

Dependencies

Implementation Tasks

See E8: Payment Processing Tasks

Doc References


Last Updated: January 2026