Lender Integration

A lender integration built from an empty repository on WeGetFinancing's multi-lender platform: full installment-payment lifecycle, an API tracing system that cut production debugging from hours to minutes, and geographic expansion.
Overview
WeGetFinancing is a multi-lender financing platform that connects merchants with lending partners at the point of sale. I built this lender integration from an empty repository. The integration had to fit into the platform's shared lender lifecycle (a common facade governing all lenders), handle real financial data with strict precision requirements, and be observable enough for production debugging without exposing sensitive information.
What I built
- The full lender lifecycle — eligibility checks, offer generation, installment plan creation, authorization verification, shipping status updates, and refunds. Each step maps domain objects (Loan, LenderApplication, Offer) through typed adapter classes into SDK requests, and back again.
- An API tracer singleton — captures every request and response (real and mock) as structured JSON to a timestamped path in the datastore. Built after a production debugging incident; now installed automatically on startup in all environments.
- A full mock system — mock SDK clients replace the real one in test environments with zero network calls. Behavior is controlled through sentinel values in request fields (e.g. street1 = "3 offers" returns exactly 3 installment options), which keeps tests readable and decoupled from internal mock state.
- Geographic expansion — extended address handling with country codes, wired a new Country enum from the shared data-model library and added a supported-countries configuration layer.
What I learned
Fitting a third-party SDK into a framework-governed lifecycle forced me to keep every adapter narrow and stateless — the facade is the only place that orchestrates, and the adapters are pure transformers. That boundary made it easy to unit test each step in isolation and to add the tracer after the fact without touching core logic.
Outcomes
- Integration shipped to production, covering the full installment payment lifecycle for live merchants.
- The API tracer reduced time-to-diagnosis on production issues from hours to minutes.
- 197 unit tests running in parallel (pytest-xdist) with no flakiness on the changed code paths.
- Added other countries support without touching the existing US flow — a config-layer approach that generalizes to other countries.