Test a late fee formula
Evaluates a late fee formula against sample numbers and returns what it would charge, without reading or writing any stored setting. Use it to check a formula before saving it as the latefees settings type. Requires the settings:read permission.
Authorization
AuthorizationstringrequiredBody
application/json
formulastringrequiredThe expression to evaluate. Must contain at least one non-whitespace character.
duenumberThe amount currently overdue on the bill. Zero or greater.
totalnumberThe full amount of the bill, paid or not. Zero or greater.
lateBillsintegerHow many bills are already late. Zero or greater.
lateDaysintegerHow many days the bill has been late. Zero or greater.
gracePeriodintegerHow many days of grace the company allows before a fee applies. Zero or greater.
graceBalancenumberThe balance below which no late fee is charged. Zero or greater.
Response
200 · What the formula evaluates to.
resultnumberrequiredThe fee the formula produced, rounded to two decimal places.
400 · `formula` is missing or blank, or one of the sample numbers is out of range.
401 · The access token is missing, expired, or invalid.
403 · The caller does not hold the `settings:read` permission.
422 · The formula could not be parsed, or it did not evaluate to a number.
| Variable | Comes from |
|---|---|
due | The due value in the request body |
total | The total value in the request body |
lateBills | The lateBills value in the request body |
lateDays | The lateDays value in the request body |
gracePeriod | The gracePeriod value in the request body |
graceBalance | The graceBalance value in the request body |
Formulas are arithmetic expressions with functions such as Min and Max. The result is rounded to two decimal places, halves away from zero. A formula that does not parse, or that evaluates to something other than a number, comes back as a 422.