Skip to content
River

Sheet RP-11Principle

Logic in declarative formats

How is the logic of a payment written down?

What happens to a payment is described as data: short rules, each answering one question, and the company’s settings beside them. The engine reads them, so the logic changes without a change of code.

§ 1

In brief

A rule · one record

Capture after picking

Question
May this payment be captured now?
When
the order is picked and the funds are held
Then
capture the picked amount
  • Policies

    Limits, instruments, capture

  • Risk rules

    Conditions and an action

  • Routing

    A strategy and a threshold

  • Distribution

    Shares and a reserve

The engine

Reads the version in force

for every payment, and records which one decided

Fig. 11.1 — a rule is one record that answers one question; the company’s policies, risk rules, routing and distribution are data of the same kind, read by the engine.
One question per rule
A rule says when it applies and what follows, for example when a payment may be captured.
Settings are data too
Limits, the routing strategy, the capture mode and the allowed instruments are settings of a unit, not code.
A versioned set
Rules are kept as a set with a version; a payment records which version decided it.
Readable by people
Each rule states its question in plain words, so a person can read what AI has written.

§ 2

In detail

2.1

A rule answers one question

The logic of a payment is a set of rules the engine reads, not a program someone runs. Each rule answers one question — when it applies and what follows: when enough is known to charge, when to hold, what to ask a bank. A rule that cannot be stated as one question is two rules.

2.2

What is kept as data

The company’s own settings are the same kind of data: limits, allowed instruments, the routing strategy and its threshold, the capture mode, the distribution plan, the days for reminders and what agents may do alone. Each has a definition — a type, a default, and the way it combines down the structure.

Demo scene 1

Settings in force for the online shop

Each setting of one unit, its value, and the unit where it was set; a lock names the unit that enforces it.

SettingValueSet atEnforced by
Maximum for one payment₴200,000.00Yarmarok Retail Group—
Allowed instrumentsCard, Apple Pay, Google Pay, QR transfer (NBU), Pay by bank, Bank transfer, Pay in parts, Bonus pointsYarmarok Retail Group—
How an acquirer is chosenon-us firstYarmarok Retail Group—
Approval threshold for routing90 %Yarmarok Retail Group—
Capturelater: after picking or at shipmentyarmarok.example—
Refunds allowed for14 daysYarmarok Retail Group—
Who holds the moneybanks settle to the merchant directlyYarmarok Retail GroupYarmarok Retail Group

2.3

Rules travel as a versioned set

Rules are kept as a set with a version: the rules themselves, the facts they read and write, and the scenarios they must pass. No code travels with them; a connection to a bank or a system is installed with the assembly and declared in the same way as the rules. A rule carried unchanged into a new version keeps what it has proven; a changed rule is checked again.

2.4

Written with AI, checked by the platform

Short rules, each with its question, are what AI writes well and a person can read. The format leaves no room for hidden logic: a condition names facts and their states, and anything that needs a calculation is a separate declared function. The platform loads only a complete set — every reference resolved, every rule with its question — and a person accepts it.

§ 3

Read next