Skip to content
Portal

Rule engine

The rule engine applies the bank’s policy to each authorization, at the rules step: fraud, compliance, routing, restrictions of a brand or a clientele. A rule is data: the bank writes, tests and activates it without a deployment. Module ubo-rule-engine.

Element Content
Identity Name, description, category (protocol, fraud, compliance, limits, routing, custom), tags
Scope Base (all the bank’s organisations), an organisation, a product; inclusions and exclusions card by card
Priority Evaluation order; the first rule that declines decides
Form Simple: a list of conditions and an action. Complex: a flow of nodes
Action Approve, decline with a code, flag, ask for strong authentication, approve partially
State Active or not; an inactive rule is never evaluated
Version Each change creates a version; each version’s snapshot is kept

All the usable data are filed by object, with their type, an example and help:

Object Examples
transaction amount (and in euros), currency, channel, type (purchase, withdrawal, credit), hour, weekday, recurrence, exemption
trame the fields of the request received from the network (entry mode, ECI, terminal, merchant…), with their label
carte status, product, network, type, form, BIN, expiry, creation and activation dates, language
porteur KYC level, PEP, AML risk, nationality, country, age, seniority
compte available, booked balance, overdraft, currency
commercant name, MCC, country, city, new merchant for this card, terminal
historique operations over 5 min, 1 h, 24 h; declines over 24 h; amounts today, 7 days, 30 days; withdrawals over 30 days; contactless since the last strong authentication
authentification PIN entered and verified, cryptogram, CVV2, ECI, CAVV result
appel.<node> the fields received from an external call, its status (success, timeout, error) and duration
vars the variables computed by “Enrich” nodes or scripts
reponse the response being prepared (readable fields, and those the bank may write)

The history is read from a cache of the card’s recent activity (Redis), kept right by the database’s signals: it costs almost nothing at each authorization.

Conditione-commerce, > €30yesExternal callfraud scoretimeout 100 ms · 1 retrysuccesstimeouterrorConditionscore ≥ 85yesnoDecline · 59suspected fraudApprovecontinue (P5)Flagalert, not blockingFlagservice unavailableEvery node, response and output taken is recorded in the decision.
The three outputs of an external call each link to the wanted next step.

Tests a data: equal, different, greater, lower, in a list, contains, starts with; conditions combine (and, or). Two outputs: true, false.

  1. The active rules applying to the card are selected: base, the card’s organisation, product, minus the card’s exclusions and plus its inclusions.
  2. They are evaluated by priority, with the operation’s context (the dictionary above).
  3. The first rule that declines decides the decline and its code; rules that flag add their alerts without stopping the operation.
  4. The whole step fits in a budget (800 ms by default, set per bank): beyond it, the remaining calls take the “timeout” output.
Guarantee How
The card number never leaves Only the token, the BIN, the last four digits and the other useful data can be sent
A service down does not slow everything Circuit breaker: after several failures within a minute, the service is set aside for a few seconds, its calls take the “error” output; event rule.service_degraded
A call is made once The same call (authorization, rule and version, node) is never repeated; a replay reuses the recorded answer
Secrets are protected The services’ API keys are in the vault
Everything is traced Each call: masked request, answer, duration, attempts, output taken; indicators per service for monitoring
  • Test a rule before activating it: replay it on past operations (which would it have declined?); enter services’ answers to exercise each output.
  • Replay a real decision as it was (versions of the time) or with today’s rules; measure the impact of today’s rules on a selection of decisions (500 at most).
  • Past versions stay readable: a decision keeps the version that made it.