Functional Weave
Code in TypeScript

construction.vat-reverse-charge@1.0.2

vectors.json

12,388 bytes · view raw

[
  {
    "name": "a VAT and CIS registered subcontractor billing a VAT and CIS registered contractor",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": true,
      "reason": "reverse-charge",
      "invoiceWording": "Reverse charge: customer to pay the VAT to HMRC. S55A VATA 94 applies."
    }
  },
  {
    "name": "reduced-rated work is reverse charged too",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "reduced",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": true,
      "reason": "reverse-charge",
      "invoiceWording": "Reverse charge: customer to pay the VAT to HMRC. S55A VATA 94 applies."
    }
  },
  {
    "name": "the first day of the reverse charge",
    "args": [
      {
        "supplyDate": "2021-03-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": true,
      "reason": "reverse-charge",
      "invoiceWording": "Reverse charge: customer to pay the VAT to HMRC. S55A VATA 94 applies."
    }
  },
  {
    "name": "the day before it started",
    "args": [
      {
        "supplyDate": "2021-02-28",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "before-start",
      "invoiceWording": null
    }
  },
  {
    "name": "before March 2021 nothing else matters",
    "args": [
      {
        "supplyDate": "2020-06-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": false,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "before-start",
      "invoiceWording": null
    }
  },
  {
    "name": "a supplier that is not VAT registered charges no VAT at all",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": false,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "supplier-not-vat-registered",
      "invoiceWording": null
    }
  },
  {
    "name": "a householder is not VAT registered, so normal VAT rules apply",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": false,
        "reportedUnderCis": false,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "customer-not-vat-registered",
      "invoiceWording": null
    }
  },
  {
    "name": "a payment not reported under CIS",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": false,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "not-reported-under-cis",
      "invoiceWording": null
    }
  },
  {
    "name": "zero-rated new build housing is not reverse charged",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "zero",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "not-standard-or-reduced",
      "invoiceWording": null
    }
  },
  {
    "name": "an exempt supply is not reverse charged",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "exempt",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "not-standard-or-reduced",
      "invoiceWording": null
    }
  },
  {
    "name": "an employment business supplies staff, not construction services",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": true,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "employment-business",
      "invoiceWording": null
    }
  },
  {
    "name": "a customer that has notified end user status in writing",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": true,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "end-user-notified",
      "invoiceWording": null
    }
  },
  {
    "name": "an intermediary supplier (a landlord re-supplying to its tenant) notifies the same way",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": true,
        "reverseChargeShareBasisPoints": 6000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "end-user-notified",
      "invoiceWording": null
    }
  },
  {
    "name": "zero-rated is checked before end user status",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "zero",
        "employmentBusiness": false,
        "endUserNotified": true,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expect": {
      "applies": false,
      "reason": "not-standard-or-reduced",
      "invoiceWording": null
    }
  },
  {
    "name": "exactly 5 percent is disregarded: the rule is 5% or less",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 500
      }
    ],
    "expect": {
      "applies": false,
      "reason": "five-percent-disregard",
      "invoiceWording": null
    }
  },
  {
    "name": "a supply and fix contract whose fitting is 2 percent",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 200
      }
    ],
    "expect": {
      "applies": false,
      "reason": "five-percent-disregard",
      "invoiceWording": null
    }
  },
  {
    "name": "5.01 percent is not disregarded",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 501
      }
    ],
    "expect": {
      "applies": true,
      "reason": "reverse-charge",
      "invoiceWording": "Reverse charge: customer to pay the VAT to HMRC. S55A VATA 94 applies."
    }
  },
  {
    "name": "a share above 100 percent",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10001
      }
    ],
    "expectError": "reverseChargeShareBasisPoints must be between 0 and 10000"
  },
  {
    "name": "a negative share",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": -1
      }
    ],
    "expectError": "reverseChargeShareBasisPoints must be between 0 and 10000"
  },
  {
    "name": "a fractional share",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 250.5
      }
    ],
    "expectError": "reverseChargeShareBasisPoints must be an integer"
  },
  {
    "name": "a malformed date",
    "args": [
      {
        "supplyDate": "01/09/2026",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expectError": "supplyDate must be an ISO date"
  },
  {
    "name": "an unknown VAT category",
    "args": [
      {
        "supplyDate": "2026-09-01",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "STANDARD",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expectError": "unknown vatCategory"
  },
  {
    "name": "a trailing newline after supplyDate is not an ISO date",
    "args": [
      {
        "supplyDate": "2026-09-16\n",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expectError": "supplyDate must be an ISO date"
  },
  {
    "name": "Arabic-Indic digits in supplyDate are not an ISO date",
    "args": [
      {
        "supplyDate": "٢٠٢٦-09-16",
        "supplierVatRegistered": true,
        "customerVatRegistered": true,
        "reportedUnderCis": true,
        "vatCategory": "standard",
        "employmentBusiness": false,
        "endUserNotified": false,
        "reverseChargeShareBasisPoints": 10000
      }
    ],
    "expectError": "supplyDate must be an ISO date"
  }
]