Functional Weave
Code in Rust

insurance.excess-apply@1.0.0

README.md

1,449 bytes · view raw

# insurance.excess-apply

What the insurer pays on a claim once the excess (deductible) has been taken
off and the policy limit applied, and what the policyholder is left bearing.

## The excess

The excess is the compulsory excess (set by the insurer) plus the voluntary
excess (chosen by the policyholder for a lower premium); UK motor and home
policies quote them separately but apply them together. A loss smaller than
the excess pays nothing, and `excessApplied` is only the part of the excess
the loss used up.

## Where the limit sits

Policies differ on whether the limit is applied before or after the excess,
so the caller says which:

- `excessWithinLimit = false` (the usual "the most we will pay" wording): the
  excess comes off the loss, then the payout is capped at the limit.
  payout = min(loss - excess, limit).
- `excessWithinLimit = true` (the excess erodes the limit): the loss is capped
  at the limit, then the excess comes off it.
  payout = min(loss, limit) - excess.

They differ whenever the loss is above the limit: a 10,400.00 loss with a
500.00 excess and a 10,000.00 limit pays 9,900.00 the first way and 9,500.00
the second. `limitApplied` is true only when the limit actually reduced what
is paid.

No rounding happens: every figure is a whole number of minor units already.
For underinsurance, see `insurance.sum-insured-average`;
whether average comes before or after the excess is a policy wording question
too.