Marcin Kozłowski

Work

Concept

A leasing platform, from application to the books

A small company wants to lease a machine, quickly. To make that possible, sales, risk, compliance, finance and the supplier all have to do their part. I know this process from the client’s side of the desk. Here I designed the system for it.

Domain
SME equipment leasing
Scope
Application to early settlement
My part
Analysis, architecture, API contracts
Experience behind it
Seven years in leasing and banking

What this project shows

I understand the business

I know what leasing looks like from the client’s, sales and finance side. I can turn that into rules.

I connect requirements to the system

For every rule you can find the step, service, data and API that implement it.

I plan for failure

I work out duplicates, timeouts and unavailable services before coding starts.

Everyone needs something different

The goal: “a decision in fifteen minutes”. Everyone agrees, but sales thinks about the client, risk about losses, and finance about the paperwork. So I start by talking to each of them and writing down what they want, what worries them, and what rule follows from it.

WhoWantsWorries aboutSo we agree that
ClientThe machine this weekA no without a reasona person can review a refusal
SalesAn offer during the callLosing the client overnightthe offer shows how long it is valid
RiskPolicy applied every timeExceptions nobody recordedevery decision records the rules it used
ComplianceA legal basis for every checkData pulled without consentwithout consent we check nothing
SupplierMoney on deliveryWaiting for a missing paperwe pay after the signature and a matching invoice
FinanceA balance it can proveA correction in a spreadsheetwe never edit an entry, we reverse it

From a rule to the code

Pick a rule and switch between the views. You will see which part of the process, system, data and API is responsible for it. This way it’s easy to answer the question: why do we need this?

Equipment leasing, from application to ledger

Business rules

Client
Platform
People and partners
Applies
Gives consent
Signs
Uses the asset
Scores
Decision?
Makes an offer
Matches invoice
Pays supplier
Books entries
Credit bureau
A person reviews
Supplier invoice
Bank transfer
NeedWe only check data the client agreed to share.

What if something goes wrong?

When everything works, it’s simple. I like to check the harder moments before anyone starts coding. Here are four of them, step by step.

ClientOriginationContractsPayoutsBankLedgerpay (key K1)transfer (ref K1)pay (key K1) againknown key, return first resultsettledjournal (event K1)

The supplier gets one transfer. The key is created with the decision to pay, so a retry can never become a second payment.

Who gets a yes straight away?

Two settings decide who is approved automatically, whose application goes to a person, and who is refused. Move the sliders and see what it means for the company. This is a decision for the business. My job is to show what follows from it.

approved automatically
40%
applications a day to review by hand
59
expected loss on the money lent
1.0%
Applications by score
  • Decline 10%
  • Review 49%
  • Approve 40%
400500600700800Score

Model: 120 applications a day, equal amounts, normal scores (600, 80), logistic default curve, 45% loss given default, officers catch half of the bad cases. Illustrative only.

What finance will see

Example: 100,000 PLN for 36 months at 8.4% a year. Pick an event and a month to see the accounting entries. Both sides always have to add up to the same amount.

Instalment
3,152.12
Receivable before
72,566.95
Receivable after
69,414.83
AccountDebitCredit
Bank3,152.12
Lease receivable3,152.12
Total3,152.123,152.12

✓ Balanced

Simplified: VAT, initial fee, residual value and settlement fee are left out. The last instalment absorbs rounding.

Rollout plan

First one product, one supplier and decisions made by people. That is enough to check the whole path, from consent to the accounting entries.

Then automatic scoring works in the background. We compare it with people’s decisions before we start to rely on it.

Finally automatic approval for the simplest applications, followed by early settlement and collections.

From day one we measure how long a decision takes, how many payouts are unclear, how often a person changes a refusal, and whether the books balance.

Why this way

One place that runs the application, events for the rest
Why
An application has steps, deadlines and people. When someone calls to ask what’s going on with it, one place should know.
Alternative
Services reacting only to each other’s events. It is hard to find where an application got stuck.
What it costs
This part is critical, so we keep it as small as possible.
We add to the ledger, we don’t change it
Why
A correction is a new entry that points to the old one. Years later you can still see what happened.
Alternative
Editable balances with a separate history table.
What it costs
Reports may be a few seconds behind.
Risk can change the rules without a release
Why
The thresholds change often. Each decision remembers which version of the rules it used.
Alternative
A big rules engine from the start, or thresholds written into the code.
What it costs
A second person has to approve every change.
One application to start with, with money kept apart
Why
One team can handle one application. Payouts and the ledger still get their own database and access rights.
Alternative
Nine microservices from day one.
What it costs
If we split it later, it will take work. So we test the module boundaries from the start.
We count money in grosze
Why
Whole numbers don’t lose a grosz on rounding.
Alternative
Decimal fractions in the code.
What it costs
We have to convert amounts wherever the system meets another one.