Functional Weave
Code in TypeScript

finance.tax.vat-flat-rate@1.0.1

vectors.json

7,336 bytes · view raw

[
  {"name": "accountancy at 14.5% on 12,000.00 gross turnover", "args": [{"minor": 1200000, "currency": "GBP"}, "accountancy-or-book-keeping", false, null, "2026-05-01"], "expect": {"sector": "accountancy-or-book-keeping", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 1450, "vatDue": {"minor": 174000, "currency": "GBP"}}},
  {"name": "a limited cost business pays 16.5% whatever its sector", "args": [{"minor": 1200000, "currency": "GBP"}, "accountancy-or-book-keeping", true, null, "2026-05-01"], "expect": {"sector": "accountancy-or-book-keeping", "limitedCostBusiness": true, "firstYearReduction": false, "basisPoints": 1650, "vatDue": {"minor": 198000, "currency": "GBP"}}},
  {"name": "first year of registration: 1% off", "args": [{"minor": 1200000, "currency": "GBP"}, "accountancy-or-book-keeping", false, "2026-01-15", "2026-05-01"], "expect": {"sector": "accountancy-or-book-keeping", "limitedCostBusiness": false, "firstYearReduction": true, "basisPoints": 1350, "vatDue": {"minor": 162000, "currency": "GBP"}}},
  {"name": "first year off the limited cost rate: 15.5%, as in Notice 733 Example 1", "args": [{"minor": 1200000, "currency": "GBP"}, "accountancy-or-book-keeping", true, "2017-04-01", "2018-03-31"], "expect": {"sector": "accountancy-or-book-keeping", "limitedCostBusiness": true, "firstYearReduction": true, "basisPoints": 1550, "vatDue": {"minor": 186000, "currency": "GBP"}}},
  {"name": "the reduction runs to the day before the first anniversary", "args": [{"minor": 1000000, "currency": "GBP"}, "accountancy-or-book-keeping", false, "2025-06-01", "2026-05-31"], "expect": {"sector": "accountancy-or-book-keeping", "limitedCostBusiness": false, "firstYearReduction": true, "basisPoints": 1350, "vatDue": {"minor": 135000, "currency": "GBP"}}},
  {"name": "and ends on the anniversary", "args": [{"minor": 1000000, "currency": "GBP"}, "accountancy-or-book-keeping", false, "2025-06-01", "2026-06-01"], "expect": {"sector": "accountancy-or-book-keeping", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 1450, "vatDue": {"minor": 145000, "currency": "GBP"}}},
  {"name": "catering the day before the covid cut", "args": [{"minor": 1000000, "currency": "GBP"}, "catering-services-including-restaurants-and-takeaways", false, null, "2020-07-14"], "expect": {"sector": "catering-services-including-restaurants-and-takeaways", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 1250, "vatDue": {"minor": 125000, "currency": "GBP"}}},
  {"name": "catering during the covid cut: 4.5%", "args": [{"minor": 1000000, "currency": "GBP"}, "catering-services-including-restaurants-and-takeaways", false, null, "2020-12-01"], "expect": {"sector": "catering-services-including-restaurants-and-takeaways", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 450, "vatDue": {"minor": 45000, "currency": "GBP"}}},
  {"name": "catering during the taper: 8.5%", "args": [{"minor": 1000000, "currency": "GBP"}, "catering-services-including-restaurants-and-takeaways", false, null, "2021-12-01"], "expect": {"sector": "catering-services-including-restaurants-and-takeaways", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 850, "vatDue": {"minor": 85000, "currency": "GBP"}}},
  {"name": "catering back at 12.5% from 1 April 2022", "args": [{"minor": 1000000, "currency": "GBP"}, "catering-services-including-restaurants-and-takeaways", false, null, "2022-04-01"], "expect": {"sector": "catering-services-including-restaurants-and-takeaways", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 1250, "vatDue": {"minor": 125000, "currency": "GBP"}}},
  {"name": "the first-year reduction cannot take the 0% hotel rate below zero", "args": [{"minor": 1000000, "currency": "GBP"}, "hotel-or-accommodation", false, "2021-01-01", "2021-03-01"], "expect": {"sector": "hotel-or-accommodation", "limitedCostBusiness": false, "firstYearReduction": true, "basisPoints": 0, "vatDue": {"minor": 0, "currency": "GBP"}}},
  {"name": "pubs at 1% in 2021", "args": [{"minor": 1000000, "currency": "GBP"}, "pubs", false, null, "2021-06-30"], "expect": {"sector": "pubs", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 100, "vatDue": {"minor": 10000, "currency": "GBP"}}},
  {"name": "the VAT is rounded half-up once: 14.5% of 1.00 is 14.5p, so 15p", "args": [{"minor": 100, "currency": "GBP"}, "accountancy-or-book-keeping", false, null, "2026-05-01"], "expect": {"sector": "accountancy-or-book-keeping", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 1450, "vatDue": {"minor": 15, "currency": "GBP"}}},
  {"name": "14.5% of 123.45 is 17.90", "args": [{"minor": 12345, "currency": "GBP"}, "accountancy-or-book-keeping", false, null, "2026-05-01"], "expect": {"sector": "accountancy-or-book-keeping", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 1450, "vatDue": {"minor": 1790, "currency": "GBP"}}},
  {"name": "a credit note reduces the VAT due", "args": [{"minor": -10000, "currency": "GBP"}, "accountancy-or-book-keeping", false, null, "2026-05-01"], "expect": {"sector": "accountancy-or-book-keeping", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 1450, "vatDue": {"minor": -1450, "currency": "GBP"}}},
  {"name": "the first day of the 2011 table", "args": [{"minor": 1000000, "currency": "GBP"}, "retailing-food-confectionery-tobacco-newspapers-or-childrens-clothing", false, null, "2011-01-04"], "expect": {"sector": "retailing-food-confectionery-tobacco-newspapers-or-childrens-clothing", "limitedCostBusiness": false, "firstYearReduction": false, "basisPoints": 400, "vatDue": {"minor": 40000, "currency": "GBP"}}},
  {"name": "the limited cost rate did not exist before 1 April 2017", "args": [{"minor": 1000, "currency": "GBP"}, "accountancy-or-book-keeping", true, null, "2017-03-31"], "expectError": "no flat rate for limited-cost-business on 2017-03-31"},
  {"name": "dates before the 2011 table are refused", "args": [{"minor": 1000, "currency": "GBP"}, "accountancy-or-book-keeping", false, null, "2011-01-03"], "expectError": "no flat rate for accountancy-or-book-keeping on 2011-01-03"},
  {"name": "an unknown sector is refused", "args": [{"minor": 1000, "currency": "GBP"}, "accountancy", false, null, "2026-05-01"], "expectError": "unknown flat rate sector \"accountancy\""},
  {"name": "the limited cost rate is not a sector", "args": [{"minor": 1000, "currency": "GBP"}, "limited-cost-business", false, null, "2026-05-01"], "expectError": "unknown flat rate sector \"limited-cost-business\""},
  {"name": "turnover must be in GBP", "args": [{"minor": 1000, "currency": "EUR"}, "accountancy-or-book-keeping", false, null, "2026-05-01"], "expectError": "the flat rate scheme is for GBP turnover, received EUR"},
  {"name": "a supply before registration is refused", "args": [{"minor": 1000, "currency": "GBP"}, "accountancy-or-book-keeping", false, "2026-06-01", "2026-05-31"], "expectError": "supply date 2026-05-31 is before the VAT registration date 2026-06-01"},
  {"name": "an impossible supply date is refused", "args": [{"minor": 1000, "currency": "GBP"}, "accountancy-or-book-keeping", false, null, "2026-02-29"], "expectError": "not a real calendar date"}
]