Functional Weave
Code in TypeScript

banking.faster-payments-limit@1.0.0

README.md

2,967 bytes · view raw

# banking.faster-payments-limit

Checks a UK Faster Payment against the three limits that can stop it, in the
order a payment system applies them:

1. the Faster Payments scheme maximum for a single payment on the payment
   date (`over-scheme-limit`);
2. the bank's own per-payment limit (`over-transaction-limit`);
3. what is left of the bank's own daily limit after what the customer has
   already sent today (`over-daily-limit`).

The decision names the first limit broken, or `allowed`. `remainingToday` is
the daily limit less what was sent today, never below zero, before this
payment, so a UI can say "you can send up to £X more today".

## Whose limits

The per-payment and daily limits are the caller's: each bank sets its own,
usually far below the scheme maximum and different by channel and account
type. Pay.UK says as much: individual payment service providers decide what
their customers can send within the scheme limit. Only the scheme maximum is
data here, because it is a published rule that has changed over time.

## The scheme maximum, as dated data

`data/scheme-limits.json`, one row per limit with `validFrom`/`validTo`:

| From | Limit | Source |
|------|-------|--------|
| 2008-05-27 | £10,000 | Scheme launch. Secondary sources only (e.g. The Global Treasurer, "UK Faster Payments: the end of the beginning?", 2010-12-08). |
| 2010-09-06 | £100,000 | Secondary sources only (The Global Treasurer, as above), which describe it as the Direct Corporate Access limit. |
| 2015-11-10 | £250,000 | Faster Payments Scheme press release "Faster Payments increases scheme limit to £250,000", reproduced at https://www.finextra.com/pressarticle/62073/faster-payments-increases-scheme-limit-to-250000 |
| 2022-02-10 | £1,000,000 | Pay.UK press release "£1 million Faster Payments now possible", 10 February 2022, https://newseventsinsights.wearepay.uk/media-centre/press-releases/1-million-faster-payments-now-possible/ ; Pay.UK "Transaction limits", https://www.wearepay.uk/what-we-do/payment-systems/faster-payment-system/transaction-limits/ |

Honesty about the dates: Pay.UK's press release says £1m payments are "now
possible" and gives no switch-on day, so the row starts on the release date;
it previously said the limit was £250,000. The 2008 and 2010 rows could not be
checked against a primary Faster Payments or Pay.UK source and should be
confirmed before relying on this for payments from those years. Before a
row changes, publish a new version with the corrected data.

A date before the scheme opened is an error. The data declares its effective
columns, so a project can install `history=current`; such a build refuses a
date before its earliest surviving limit rather than answering it with
today's £1m.

## Edge cases

- Sterling only: every amount must be GBP.
- The amount must be greater than zero; `sentToday` and the limits must not be
  negative. Limits are inclusive: a payment of exactly the limit is allowed.