Functional Weave
Code in Python

construction.valuation@1.0.0

vectors.json

22,929 bytes · view raw

[
  {
    "name": "100,000 of work and 5,000 of materials on site, 5% retention, 70,000 paid before, standard-rated VAT, no CIS",
    "args": [
      {
        "workDone": {
          "minor": 10000000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 500000,
          "currency": "GBP"
        },
        "retentionBasisPoints": 500,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 7000000,
          "currency": "GBP"
        },
        "cisStatus": null,
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": "STANDARD",
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 10500000,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 525000,
          "currency": "GBP"
        },
        "held": {
          "minor": 525000,
          "currency": "GBP"
        },
        "released": {
          "minor": 0,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 9975000,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 7000000,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": 2975000,
        "currency": "GBP"
      },
      "vat": {
        "minor": 595000,
        "currency": "GBP"
      },
      "vatBasisPoints": 2000,
      "reverseChargeVat": {
        "minor": 0,
        "currency": "GBP"
      },
      "cis": null,
      "amountPayable": {
        "minor": 3570000,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "the same valuation under the reverse charge and CIS: no VAT charged, 20% withheld from the labour only",
    "args": [
      {
        "workDone": {
          "minor": 10000000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 500000,
          "currency": "GBP"
        },
        "retentionBasisPoints": 500,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 7000000,
          "currency": "GBP"
        },
        "cisStatus": "standard",
        "cisMaterials": {
          "minor": 975000,
          "currency": "GBP"
        },
        "vatCategory": "STANDARD",
        "reverseCharge": true,
        "valuationDate": "2026-09-23"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 10500000,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 525000,
          "currency": "GBP"
        },
        "held": {
          "minor": 525000,
          "currency": "GBP"
        },
        "released": {
          "minor": 0,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 9975000,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 7000000,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": 2975000,
        "currency": "GBP"
      },
      "vat": {
        "minor": 0,
        "currency": "GBP"
      },
      "vatBasisPoints": 2000,
      "reverseChargeVat": {
        "minor": 595000,
        "currency": "GBP"
      },
      "cis": {
        "payment": {
          "minor": 2975000,
          "currency": "GBP"
        },
        "materials": {
          "minor": 975000,
          "currency": "GBP"
        },
        "labour": {
          "minor": 2000000,
          "currency": "GBP"
        },
        "basisPoints": 2000,
        "deduction": {
          "minor": 400000,
          "currency": "GBP"
        },
        "netPayment": {
          "minor": 2575000,
          "currency": "GBP"
        }
      },
      "amountPayable": {
        "minor": 2575000,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "a subcontractor not registered for VAT or CIS: 30% of the whole amount due",
    "args": [
      {
        "workDone": {
          "minor": 1000000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 300,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 500000,
          "currency": "GBP"
        },
        "cisStatus": "higher",
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": null,
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 1000000,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 30000,
          "currency": "GBP"
        },
        "held": {
          "minor": 30000,
          "currency": "GBP"
        },
        "released": {
          "minor": 0,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 970000,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 500000,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": 470000,
        "currency": "GBP"
      },
      "vat": {
        "minor": 0,
        "currency": "GBP"
      },
      "vatBasisPoints": 0,
      "reverseChargeVat": {
        "minor": 0,
        "currency": "GBP"
      },
      "cis": {
        "payment": {
          "minor": 470000,
          "currency": "GBP"
        },
        "materials": {
          "minor": 0,
          "currency": "GBP"
        },
        "labour": {
          "minor": 470000,
          "currency": "GBP"
        },
        "basisPoints": 3000,
        "deduction": {
          "minor": 141000,
          "currency": "GBP"
        },
        "netPayment": {
          "minor": 329000,
          "currency": "GBP"
        }
      },
      "amountPayable": {
        "minor": 329000,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "practical completion releases half the retention: the amount due is the released half",
    "args": [
      {
        "workDone": {
          "minor": 10000000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 500,
        "stage": "practical-completion",
        "previouslyCertified": {
          "minor": 9500000,
          "currency": "GBP"
        },
        "cisStatus": null,
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": "STANDARD",
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 10000000,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 500000,
          "currency": "GBP"
        },
        "held": {
          "minor": 250000,
          "currency": "GBP"
        },
        "released": {
          "minor": 250000,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 9750000,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 9500000,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": 250000,
        "currency": "GBP"
      },
      "vat": {
        "minor": 50000,
        "currency": "GBP"
      },
      "vatBasisPoints": 2000,
      "reverseChargeVat": {
        "minor": 0,
        "currency": "GBP"
      },
      "cis": null,
      "amountPayable": {
        "minor": 300000,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "the final valuation releases the rest; gross payment status withholds nothing",
    "args": [
      {
        "workDone": {
          "minor": 10000000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 500,
        "stage": "final",
        "previouslyCertified": {
          "minor": 9750000,
          "currency": "GBP"
        },
        "cisStatus": "gross",
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": "STANDARD",
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 10000000,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 500000,
          "currency": "GBP"
        },
        "held": {
          "minor": 0,
          "currency": "GBP"
        },
        "released": {
          "minor": 500000,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 10000000,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 9750000,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": 250000,
        "currency": "GBP"
      },
      "vat": {
        "minor": 50000,
        "currency": "GBP"
      },
      "vatBasisPoints": 2000,
      "reverseChargeVat": {
        "minor": 0,
        "currency": "GBP"
      },
      "cis": {
        "payment": {
          "minor": 250000,
          "currency": "GBP"
        },
        "materials": {
          "minor": 0,
          "currency": "GBP"
        },
        "labour": {
          "minor": 250000,
          "currency": "GBP"
        },
        "basisPoints": 0,
        "deduction": {
          "minor": 0,
          "currency": "GBP"
        },
        "netPayment": {
          "minor": 250000,
          "currency": "GBP"
        }
      },
      "amountPayable": {
        "minor": 300000,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "over-certified before: a negative amount due, with negative VAT, when there is no CIS",
    "args": [
      {
        "workDone": {
          "minor": 1000000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 500,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 1000000,
          "currency": "GBP"
        },
        "cisStatus": null,
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": "STANDARD",
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 1000000,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 50000,
          "currency": "GBP"
        },
        "held": {
          "minor": 50000,
          "currency": "GBP"
        },
        "released": {
          "minor": 0,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 950000,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 1000000,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": -50000,
        "currency": "GBP"
      },
      "vat": {
        "minor": -10000,
        "currency": "GBP"
      },
      "vatBasisPoints": 2000,
      "reverseChargeVat": {
        "minor": 0,
        "currency": "GBP"
      },
      "cis": null,
      "amountPayable": {
        "minor": -60000,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "reduced-rated work: 5% of 11,975.30 is 598.765, VAT rounds half up to 598.77; CIS on the 10,000.00 labour",
    "args": [
      {
        "workDone": {
          "minor": 1234567,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 300,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 0,
          "currency": "GBP"
        },
        "cisStatus": "standard",
        "cisMaterials": {
          "minor": 197530,
          "currency": "GBP"
        },
        "vatCategory": "REDUCED",
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 1234567,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 37037,
          "currency": "GBP"
        },
        "held": {
          "minor": 37037,
          "currency": "GBP"
        },
        "released": {
          "minor": 0,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 1197530,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 0,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": 1197530,
        "currency": "GBP"
      },
      "vat": {
        "minor": 59877,
        "currency": "GBP"
      },
      "vatBasisPoints": 500,
      "reverseChargeVat": {
        "minor": 0,
        "currency": "GBP"
      },
      "cis": {
        "payment": {
          "minor": 1197530,
          "currency": "GBP"
        },
        "materials": {
          "minor": 197530,
          "currency": "GBP"
        },
        "labour": {
          "minor": 1000000,
          "currency": "GBP"
        },
        "basisPoints": 2000,
        "deduction": {
          "minor": 200000,
          "currency": "GBP"
        },
        "netPayment": {
          "minor": 997530,
          "currency": "GBP"
        }
      },
      "amountPayable": {
        "minor": 1057407,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "the CIS deduction rounds down: 20% of 123.48 is 24.696, withheld 24.69",
    "args": [
      {
        "workDone": {
          "minor": 12348,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 0,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 0,
          "currency": "GBP"
        },
        "cisStatus": "standard",
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": null,
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 12348,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 0,
          "currency": "GBP"
        },
        "held": {
          "minor": 0,
          "currency": "GBP"
        },
        "released": {
          "minor": 0,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 12348,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 0,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": 12348,
        "currency": "GBP"
      },
      "vat": {
        "minor": 0,
        "currency": "GBP"
      },
      "vatBasisPoints": 0,
      "reverseChargeVat": {
        "minor": 0,
        "currency": "GBP"
      },
      "cis": {
        "payment": {
          "minor": 12348,
          "currency": "GBP"
        },
        "materials": {
          "minor": 0,
          "currency": "GBP"
        },
        "labour": {
          "minor": 12348,
          "currency": "GBP"
        },
        "basisPoints": 2000,
        "deduction": {
          "minor": 2469,
          "currency": "GBP"
        },
        "netPayment": {
          "minor": 9879,
          "currency": "GBP"
        }
      },
      "amountPayable": {
        "minor": 9879,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "zero-rated work: VAT at 0%",
    "args": [
      {
        "workDone": {
          "minor": 500000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 500,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 0,
          "currency": "GBP"
        },
        "cisStatus": null,
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": "ZERO",
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 500000,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 25000,
          "currency": "GBP"
        },
        "held": {
          "minor": 25000,
          "currency": "GBP"
        },
        "released": {
          "minor": 0,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 475000,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 0,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": 475000,
        "currency": "GBP"
      },
      "vat": {
        "minor": 0,
        "currency": "GBP"
      },
      "vatBasisPoints": 0,
      "reverseChargeVat": {
        "minor": 0,
        "currency": "GBP"
      },
      "cis": null,
      "amountPayable": {
        "minor": 475000,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "the rate on the valuation date: 17.5% in 2010",
    "args": [
      {
        "workDone": {
          "minor": 100000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 0,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 0,
          "currency": "GBP"
        },
        "cisStatus": null,
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": "STANDARD",
        "reverseCharge": false,
        "valuationDate": "2010-06-30"
      }
    ],
    "expect": {
      "grossValuation": {
        "minor": 100000,
        "currency": "GBP"
      },
      "retention": {
        "full": {
          "minor": 0,
          "currency": "GBP"
        },
        "held": {
          "minor": 0,
          "currency": "GBP"
        },
        "released": {
          "minor": 0,
          "currency": "GBP"
        }
      },
      "netValuation": {
        "minor": 100000,
        "currency": "GBP"
      },
      "previouslyCertified": {
        "minor": 0,
        "currency": "GBP"
      },
      "amountDue": {
        "minor": 100000,
        "currency": "GBP"
      },
      "vat": {
        "minor": 17500,
        "currency": "GBP"
      },
      "vatBasisPoints": 1750,
      "reverseChargeVat": {
        "minor": 0,
        "currency": "GBP"
      },
      "cis": null,
      "amountPayable": {
        "minor": 117500,
        "currency": "GBP"
      }
    }
  },
  {
    "name": "the reverse charge without a VAT category",
    "args": [
      {
        "workDone": {
          "minor": 100000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 0,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 0,
          "currency": "GBP"
        },
        "cisStatus": null,
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": null,
        "reverseCharge": true,
        "valuationDate": "2026-09-23"
      }
    ],
    "expectError": "the reverse charge needs a VAT category"
  },
  {
    "name": "the reverse charge on zero-rated work",
    "args": [
      {
        "workDone": {
          "minor": 100000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 0,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 0,
          "currency": "GBP"
        },
        "cisStatus": null,
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": "ZERO",
        "reverseCharge": true,
        "valuationDate": "2026-09-23"
      }
    ],
    "expectError": "the reverse charge applies only to STANDARD or REDUCED supplies"
  },
  {
    "name": "a negative amount due under CIS",
    "args": [
      {
        "workDone": {
          "minor": 1000000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 500,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 1000000,
          "currency": "GBP"
        },
        "cisStatus": "standard",
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": null,
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expectError": "the amount due is negative (-50000)"
  },
  {
    "name": "CIS materials above the amount due",
    "args": [
      {
        "workDone": {
          "minor": 100000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 0,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 0,
          "currency": "GBP"
        },
        "cisStatus": "standard",
        "cisMaterials": {
          "minor": 100001,
          "currency": "GBP"
        },
        "vatCategory": null,
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expectError": "cannot exceed the payment"
  },
  {
    "name": "materials on site in another currency",
    "args": [
      {
        "workDone": {
          "minor": 100000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 100,
          "currency": "EUR"
        },
        "retentionBasisPoints": 0,
        "stage": "interim",
        "previouslyCertified": {
          "minor": 0,
          "currency": "GBP"
        },
        "cisStatus": null,
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": null,
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expectError": "currency mismatch"
  },
  {
    "name": "an unknown retention stage",
    "args": [
      {
        "workDone": {
          "minor": 100000,
          "currency": "GBP"
        },
        "materialsOnSite": {
          "minor": 0,
          "currency": "GBP"
        },
        "retentionBasisPoints": 500,
        "stage": "handover",
        "previouslyCertified": {
          "minor": 0,
          "currency": "GBP"
        },
        "cisStatus": null,
        "cisMaterials": {
          "minor": 0,
          "currency": "GBP"
        },
        "vatCategory": null,
        "reverseCharge": false,
        "valuationDate": "2026-09-23"
      }
    ],
    "expectError": "unknown retention stage \"handover\""
  }
]