AttestwireRule referenceATW-AMOUNT-OUT-OF-RANGE

ATW-AMOUNT-OUT-OF-RANGE No amount or total may exceed 999,999,999,999.99

noun · Attestwire · fatal · BT-131 / BT-115

For a sample invoice, the library reports: An amount on this invoice, or a total computed from its amounts, is 1000000000000, beyond the 999,999,999,999.99 this library can compute with exactly.

Business term
BT-131 / BT-115
Severity
fatal

The fix

Check the line quantities (BT-129), prices (BT-146) and allowance or charge amounts for a value in the wrong unit. If the invoice really is this large, split it: no single amount or total may exceed 999,999,999,999.99 in absolute value.

A passing value

the shape this field expects
"lines": [{ "quantity": 3, "unitPrice": 1250.00 }]

What the library returns

The full error returned by @attestwire/en16931. It includes the rule ID, affected field and suggested correction. Developers can use this object in their application:

TeachingError
{
  "rule": "ATW-AMOUNT-OUT-OF-RANGE",
  "field": [
    "BT-131",
    "BT-115"
  ],
  "severity": "fatal",
  "message": "An amount on this invoice, or a total computed from its amounts, is 1000000000000, beyond the 999,999,999,999.99 this library can compute with exactly. This is not a rule of the regulation — EN 16931 sets no maximum — but past that size a JavaScript number cannot hold every cent, so the totals would be silently wrong. The usual cause is not a genuinely huge invoice but a unit slip: a price in cents where euros were meant, a quantity multiplied twice, or an amount parsed from a string with its decimal separator dropped.",
  "fix": "Check the line quantities (BT-129), prices (BT-146) and allowance or charge amounts for a value in the wrong unit. If the invoice really is this large, split it: no single amount or total may exceed 999,999,999,999.99 in absolute value.",
  "example": "\"lines\": [{ \"quantity\": 3, \"unitPrice\": 1250.00 }]",
  "docsUrl": "https://github.com/attestwire/en16931#not-implemented-yet"
}