The personal finance app for everyone (by everyone)
Provider integration guidance
Read architecture for provider concepts, runtime registry
selection and Provided concerns. For a new securities price provider, follow
the complete workflow, including response
types, MIC mapping, currency handling, settings encryption, UI, locales and tests.
Provider logos
A provider's logo comes from ProviderLogo: the
Brandfetch icon for the domain in its
Provider::Metadata::REGISTRY entry, falling back
to logo_icon, then logo_text initials on logo_color. Anything identifying a provider
renders render ProviderLogo.new(provider_key: :<x>) — the _<x>_item card on Accounts,
the Bank Sync cards and connection rows, and the connection rows in
settings/providers/_<x>_panel — rather than a hand-built badge or the first letter of a
connection name. A panel's setup form and instructions carry no logo.
Give each new provider a registry entry with a brand domain. Only a provider with no single
brand behind it (on-chain wallets) omits the domain and sets logo_icon instead.
Institution logos are a separate concept and belong on accounts through
Account#logo_url, never on a provider.
Support diagnostics
When a provider sync/import path encounters a recoverable error, suspicious partial
response or other support-relevant incident, prefer
DebugLogEntry.capture over Rails.logger.*
so operators can inspect it in the super-admin /settings/debug UI.
- Include
category,level,message,source,provider_keyand useful structuredmetadata. - Attach
familyandaccount_providerwhenever available so support can filter and trace the affected connection. Account/user associations can add context. - Reserve raw Rails logging for low-value local noise; incidents operators need to investigate belong in the debug log.
Pending transactions and FX metadata
Store provider metadata on Transaction#extra under the provider namespace.
import_transaction deep-merges
that hash, so a key the provider stops sending keeps its previous value. A provider
that owns its namespace outright passes replace_extra_namespaces: ["<key>"]. When the
incoming payload includes that namespace, the existing namespace is replaced, so omitted
nested fields are removed. Send the provider's current namespace snapshot on every sync.
Transaction#pending? and pending scopes share
PENDING_PROVIDERS; that constant is the current list of supported namespaces,
including providers beyond the three described below. The UI shows a Pending
badge when transaction.pending? is true. A provider that supplies no pending
metadata produces no badge; manual/CSV imports have no pending concept.
| Provider | Detection and storage |
|---|---|
| SimpleFIN | SimplefinEntry::Processor.pending? accepts an explicitly truthy pending flag, or posted equal to numeric 0 or string "0" with a present, positive transacted_at timestamp. A blank/missing posted value does not imply pending. Writes extra["simplefin"]["pending"] as true or false so a posted update clears stale pending metadata. |
| Plaid | PlaidEntry::Processor stores bank/credit transaction pending and pending_transaction_id under extra["plaid"]; the linking ID supports pending-to-posted reconciliation. It also stores original_description, payment_channel, transaction_code, payment_meta and counterparties, and passes replace_extra_namespaces: ["plaid"] so the namespace is a snapshot of what Plaid currently reports. The investment transaction processor does not store pending metadata. |
| Lunchflow | LunchflowEntry::Processor stores the boolean-cast isPending value under extra["lunchflow"]["pending"] when the upstream key is present, or true when an unidentified card authorization hold is detected. |
| Monobank | MonobankEntry::Processor treats a hold: true statement item as pending and writes extra["monobank"]["pending"]. Monobank may settle a hold under a different id, so the settled record reconciles onto the pending entry through Account::ProviderImportAdapter's amount/date lookup. A hold that simply disappears is pruned, but only when the statement request actually covered its date range, and never when the entry is protected_from_sync? — those only lose the pending flag. currencyCode on a statement item is the operation currency, not the account's — it varies between items on one account — so entries take their currency from MonobankAccount#currency and currencyCode/operationAmount populate fx_from/fx_amount. Those two are emitted only for a recognized foreign operation — a known currencyCode differing from the account currency, and for fx_amount a parseable operationAmount, whose failure is captured as a provider_sync_error. Independently of that, operation_amount keeps the raw minor-unit figure whenever it differs from amount. |
SimpleFIN additionally stores extra["simplefin"]["fx_from"] when transaction and
account currencies differ, and fx_date from the transacted date with posted-date
fallback. Preserve these namespaced fields and the existing conversion behavior.
Pending inclusion is provider- and layer-specific:
- SimpleFIN: the initializer defaults
config.x.simplefin.include_pendingto true. The importer resolves an explicitpending:argument first, then a presentSIMPLEFIN_INCLUDE_PENDINGenvironment value, thenSetting.syncs_include_pending. The entry processor also checks the environment/Setting choice before importing cached pending payloads.SIMPLEFIN_INCLUDE_PENDING=0disables the environment-controlled path. The low-level provider does not resolve these settings: it addspending=1only for a truthy argument, and otherwise omits the parameter. Do not sendpending=0; bridges can interpret its presence as inclusion. - Plaid: the initializer defaults
config.x.plaid.include_pendingto true. The transaction processor uses a presentPLAID_INCLUDE_PENDINGenvironment value beforeSetting.syncs_include_pending;PLAID_INCLUDE_PENDING=0filters pending records out. This is processing-time filtering, not a pending query flag on the Plaid sync request. - Shared SimpleFIN/Plaid setting:
Setting.syncs_include_pendingdefaults true with both environment variables absent. Its initial default is computed from both provider environment values; a persisted runtime setting can differ. Do not infer effective importer behavior from an initializer alone. - Lunchflow: the initializer defaults
config.x.lunchflow.include_pendingto false. SetLUNCHFLOW_INCLUDE_PENDING=1to enable it. The importer passes that configuration asinclude_pending:. A direct provider call defaults the argument to false and addsinclude_pending=trueonly when enabled; it does not consult the shared SimpleFIN/Plaid setting. - Monobank: the initializer defaults
config.x.monobank.include_pendingto true;MONOBANK_INCLUDE_PENDING=0imports only settled transactions. The same initializer bounds a sync against Monobank's one-request-per-minute limit and 31-day statement window (max_statement_requests_per_sync,pending_lookback_days,initial_history_days); read the provider guide before changing the importer's request budgeting, and keep the pending lookback wide enough that live holds stay in the payload instead of being pruned as stale.
Exchange rate providers
Exchange rate providers include
Provider::ExchangeRateConcept,
which validates their responses: a rate that ExchangeRate.valid_rate? rejects
(zero, negative, NaN, infinite or missing) turns a single lookup into a failed
response and is dropped from a series, with a DebugLogEntry in the
exchange_rates category. Providers do not need their own check. A database
constraint on exchange_rates.rate rejects anything that still gets through.
Transaction naming
Where a provider supplies both a cleaned merchant name and the bank's own
description, combine them rather than choosing one:
SimplefinEntry::Processor emits
"#{payee} - #{description}" when both are present and differ, and
PlaidEntry::Processor does the same
with merchant_name and original_description.
The merchant name alone collapses distinct transactions into one name, and
rules match on transaction_name, so the
collapse removes the only signal that could separate them. Merchant records are
built from the cleaned name on a separate path, so grouping is unaffected.
Changing a name that rules already target is the cost of this, and it falls
entirely on the two operators with no substring tolerance. transaction_name is a
text filter, so it offers = and != alongside like/not_like
(condition_filter.rb); a like rule
written against the merchant name still matches the combined form, but an = rule
would stop matching and a != rule would start matching what it was written to
exclude — silently, in both directions.
Rule::ConditionFilter::TransactionName
absorbs that: for = and != only, a Plaid row also matches when its name is
exactly the rule's value joined to the stored original_description by
PlaidEntry::Processor::NAME_SEPARATOR. The comparison rebuilds the name; it does
not pattern match it. These properties make it safe, and a change here must
preserve all of them:
Exact, not a prefix match. When Plaid resolves no merchant, the name is the bank's description alone, and banks write dashes of their own, so an ACH row reading "ACH - PAYROLL DEPOSIT" would satisfy
= "ACH"under anyLIKE value || ' - %'. That row's name was never changed by the combining, so matching it would break a rule on a row this feature does not touch. Rebuilding from the stored description means only a genuinely combined name can match.Provenance-gated. Rules run against every transaction in the family (
resource_scope), not just provider rows. Without thesourcegate,= "Rent"would start matching a manually entered "Rent insurance".Case-preserving.
=compiles to a plain=and stays case-sensitive.NULL-safe.
entries.sourceis nullable, so the added arm isNULLfor manual rows and a bareNOT (...)would drop them out of every!=rule. The predicate is wrapped inCOALESCE(..., FALSE)before negation.Kept in step with the name. The comparison trusts that the stored
original_descriptionis the one the name was built from. A protected (user-modified) entry keeps its name when Plaid resends it, so the processor passesname_extra_keys: { "plaid" => ["original_description"] }andAccount::ProviderImportAdapterkeeps that value alongside the name rather than refreshing it. This guards one narrow case: Plaid resending the sametransaction_idinmodifiedwith a differentoriginal_description. Plaid does not document whether that happens, but says a posted transaction "cannot necessarily be considered immutable", so the name and its description are not left to drift. It costs nothing when the description does not change.Settling is not that case. A posted transaction gets a new
transaction_id, so it arrives as a new transaction rather than a resend of the pending one. Plaid links the two throughpending_transaction_idwhen it can match them and leaves the field null when it cannot, in which case the adapter falls back to an exact amount match on a recent pending entry. Whichever way it finds the pending entry, the claim updates the name and the description together. Categorizing lockscategory_id, not the name, so a categorized pending entry still takes the posted name. A pending entry the user renamed keeps that name.
like and not_like rules are deliberately left alone, and they do see the
change: the combined name contains the merchant as well as the description, so a
like "Amazon" rule now reaches Amazon - AMZN Mktp US*... rows it could not
before. That wider reach is the purpose of combining.
One known gap: Entry#split! gives each child no source and no extra, while the
split form prefills each child's name from the parent. A child of a combined Plaid
transaction therefore keeps the combined name but not the provenance, so = and
!= rules on the merchant do not reach it. Renaming the child, or using like,
does.
This is deliberately runtime behavior rather than a migration over saved rules: rewriting operators in place is irreversible, changes rules the user chose, and misses families who connect a provider later.
If another provider starts combining names, gate it the same way — do not widen the rule engine generally. SimpleFIN is excluded on purpose: it has always emitted the combined form, so its rules were written against it.
Raw payload debugging
Raw debugging is default-off. SIMPLEFIN_DEBUG_RAW=1 and
LUNCHFLOW_DEBUG_RAW=1 enable their importers' raw response logging through
Rails.configuration.x.simplefin.debug_raw and
Rails.configuration.x.lunchflow.debug_raw respectively.
UP_DEBUG_RAW=1 enables Up's debug configuration,
but its importer logs raw transactions only
when Rails.env.local? is also true. The dump contains PII: preserve this local-only
guard and do not enable raw Up dumps in managed/production. This guard is specific
to Up; the SimpleFIN and Lunchflow flags do not provide the same environment gate.
MONOBANK_DEBUG_RAW=1 behaves like the Up flag: its
importer dumps raw payloads only when
Rails.env.local? is also true, because the dump contains PII (merchant and
counterparty names, IBANs, amounts, account ids). Preserve that local-only guard.
FIO_DEBUG_RAW=1 has the same local-only guard in the
importer. Fio additionally authenticates by
putting the token in the URL path, so neither the client
nor the importer may put a resolved URL into an exception message, a log line or debug
metadata; requests are labelled with a static operation name instead. Fio reports no
pending state, so it is deliberately absent from Transaction::PENDING_PROVIDERS.
Wise payloads and clean-up
Each Wise balance stores the rows it books in raw_transactions_payload, and Sure
re-routes them on every sync. Keep these rules when changing the importer, the row
processors or the payload keys:
- A Wise amount reaches an entry a person categorized, noted or excluded, unless they
changed its amount or currency themselves (a lock), an import owns it, or it is
reconciled, split or in a transfer (
WiseItem::AmountCorrection). WiseItem::Importerfetches each source from where its coverage ends (sync_metadata["coverage"], raised byWiseItem::COVERAGE_VERSION), and the whole history while none is recorded.import[:complete]is true only when every source arrived in full, and coverage moves on only when the rows reached every payload. A statement 403 is a refusal, not a failure.- Rows carry Sure-owned keys: a transfer's
wise_activityandwise_refund_activity, which a re-fetched copy keeps unless it brings its own (STICKY_ROW_KEYS), andwise_missing_countwhile Wise no longer finds the transfer by id. WiseItem::BalanceReplaywriteswise_fundingandwise_split_parts/wise_split_estimatedonly for a full-history import whose balances reconcile to Wise's live amounts, and a split payment's parts only when every balance it lists reconciled and a rate bounds each part.WiseAccount::Transactions::Processordeletes the Wise entries no stored row books only after a complete import, where coverage reaches, from the payload's earliest row on, for entries booked since the balance was linked, never for an entry a person acted on, and at most max(5, 10 %) of the account's Wise entries per sync. Balance markers inraw_payload(WiseAccount::PRESERVED_KEYS) survive a new snapshot and are merged into the stored one.WiseItem::StatementMigrationhands a balance's transfer and activity rows over to the statement rows that carry them (wise_superseded_by,wise_supersedes), renaming their entries, and keeps each statement row's id (wise_statement_id) once given. A sync that re-fetched the whole history may delete beyond the cap the entries whose rows it moved out of the balance's payload or left booking nothing on it (prune_cap_bypass).- A jar move and interest stay on the balance they were first routed to
(
wise_jar_balance_id), and a row processor books nothing a payload holds for another balance. WiseItem::InterbalanceLinkerlinks each conversion, jar move and send to the profile's own account details as a confirmed transfer; removing such a link from the transfer drawer rejects it.