Functional Weave
Code in Rust

logistics.duty-estimate@1.0.1

vectors.json

7,983 bytes · view raw

[
  {"name": "\u00a31,000 of goods, \u00a3150 freight, \u00a315 insurance at 12% duty and 20% VAT", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expect": {"customsValue": {"minor": 116500, "currency": "GBP"}, "dutyBasisPoints": 1200, "duty": {"minor": 13980, "currency": "GBP"}, "vatValue": {"minor": 130480, "currency": "GBP"}, "vatBasisPoints": 2000, "importVat": {"minor": 26096, "currency": "GBP"}, "totalPayable": {"minor": 40076, "currency": "GBP"}}},
  {"name": "delivery inside the UK attracts VAT but not duty", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": 5000, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expect": {"customsValue": {"minor": 116500, "currency": "GBP"}, "dutyBasisPoints": 1200, "duty": {"minor": 13980, "currency": "GBP"}, "vatValue": {"minor": 135480, "currency": "GBP"}, "vatBasisPoints": 2000, "importVat": {"minor": 27096, "currency": "GBP"}, "totalPayable": {"minor": 41076, "currency": "GBP"}}},
  {"name": "a zero duty rate still pays VAT on the freight and insurance", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 0, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expect": {"customsValue": {"minor": 116500, "currency": "GBP"}, "dutyBasisPoints": 0, "duty": {"minor": 0, "currency": "GBP"}, "vatValue": {"minor": 116500, "currency": "GBP"}, "vatBasisPoints": 2000, "importVat": {"minor": 23300, "currency": "GBP"}, "totalPayable": {"minor": 23300, "currency": "GBP"}}},
  {"name": "duty of 30.85 pence rounds half up to 31", "args": [{"minor": 1234, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, 250, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expect": {"customsValue": {"minor": 1234, "currency": "GBP"}, "dutyBasisPoints": 250, "duty": {"minor": 31, "currency": "GBP"}, "vatValue": {"minor": 1265, "currency": "GBP"}, "vatBasisPoints": 2000, "importVat": {"minor": 253, "currency": "GBP"}, "totalPayable": {"minor": 284, "currency": "GBP"}}},
  {"name": "rounded down, duty is 30 and VAT 252 (from 252.8)", "args": [{"minor": 1234, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, 250, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "down"], "expect": {"customsValue": {"minor": 1234, "currency": "GBP"}, "dutyBasisPoints": 250, "duty": {"minor": 30, "currency": "GBP"}, "vatValue": {"minor": 1264, "currency": "GBP"}, "vatBasisPoints": 2000, "importVat": {"minor": 252, "currency": "GBP"}, "totalPayable": {"minor": 282, "currency": "GBP"}}},
  {"name": "an import in 2010 uses the 17.5% VAT rate then in force", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2010-06-01", "half-up"], "expect": {"customsValue": {"minor": 116500, "currency": "GBP"}, "dutyBasisPoints": 1200, "duty": {"minor": 13980, "currency": "GBP"}, "vatValue": {"minor": 130480, "currency": "GBP"}, "vatBasisPoints": 1750, "importVat": {"minor": 22834, "currency": "GBP"}, "totalPayable": {"minor": 36814, "currency": "GBP"}}},
  {"name": "reduced-rate goods", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "GB", "REDUCED", "2026-05-01", "half-up"], "expect": {"customsValue": {"minor": 116500, "currency": "GBP"}, "dutyBasisPoints": 1200, "duty": {"minor": 13980, "currency": "GBP"}, "vatValue": {"minor": 130480, "currency": "GBP"}, "vatBasisPoints": 500, "importVat": {"minor": 6524, "currency": "GBP"}, "totalPayable": {"minor": 20504, "currency": "GBP"}}},
  {"name": "zero-rated goods pay duty but no VAT", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "GB", "ZERO", "2026-05-01", "half-up"], "expect": {"customsValue": {"minor": 116500, "currency": "GBP"}, "dutyBasisPoints": 1200, "duty": {"minor": 13980, "currency": "GBP"}, "vatValue": {"minor": 130480, "currency": "GBP"}, "vatBasisPoints": 0, "importVat": {"minor": 0, "currency": "GBP"}, "totalPayable": {"minor": 13980, "currency": "GBP"}}},
  {"name": "Ireland in euro at 23%", "args": [{"minor": 50000, "currency": "EUR"}, {"minor": 5000, "currency": "EUR"}, {"minor": 0, "currency": "EUR"}, 420, {"minor": 0, "currency": "EUR"}, "IE", "STANDARD", "2026-05-01", "half-up"], "expect": {"customsValue": {"minor": 55000, "currency": "EUR"}, "dutyBasisPoints": 420, "duty": {"minor": 2310, "currency": "EUR"}, "vatValue": {"minor": 57310, "currency": "EUR"}, "vatBasisPoints": 2300, "importVat": {"minor": 13181, "currency": "EUR"}, "totalPayable": {"minor": 15491, "currency": "EUR"}}},
  {"name": "a CIF invoice: freight and insurance already in the price", "args": [{"minor": 116500, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expect": {"customsValue": {"minor": 116500, "currency": "GBP"}, "dutyBasisPoints": 1200, "duty": {"minor": 13980, "currency": "GBP"}, "vatValue": {"minor": 130480, "currency": "GBP"}, "vatBasisPoints": 2000, "importVat": {"minor": 26096, "currency": "GBP"}, "totalPayable": {"minor": 40076, "currency": "GBP"}}},
  {"name": "nothing to declare", "args": [{"minor": 0, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, {"minor": 0, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expect": {"customsValue": {"minor": 0, "currency": "GBP"}, "dutyBasisPoints": 1200, "duty": {"minor": 0, "currency": "GBP"}, "vatValue": {"minor": 0, "currency": "GBP"}, "vatBasisPoints": 2000, "importVat": {"minor": 0, "currency": "GBP"}, "totalPayable": {"minor": 0, "currency": "GBP"}}},
  {"name": "freight in another currency", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "USD"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expectError": "currency mismatch"},
  {"name": "a negative duty rate", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, -1200, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expectError": "dutyBasisPoints must not be negative"},
  {"name": "negative goods value", "args": [{"minor": -100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expectError": "goods must not be negative"},
  {"name": "negative VAT additions", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": -1, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "half-up"], "expectError": "vatAdditions must not be negative"},
  {"name": "a jurisdiction with no VAT data", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "FR", "STANDARD", "2026-05-01", "half-up"], "expectError": "no VAT rule for FR/STANDARD on 2026-05-01"},
  {"name": "an unknown rounding mode", "args": [{"minor": 100000, "currency": "GBP"}, {"minor": 15000, "currency": "GBP"}, {"minor": 1500, "currency": "GBP"}, 1200, {"minor": 0, "currency": "GBP"}, "GB", "STANDARD", "2026-05-01", "nearest"], "expectError": "unknown rounding mode \"nearest\""}
]