Skip to content

Payment providers should be constructed from database configs (complete PaymentMethodFactory integration) #182

Description

@v0l

PaymentMethodFactory (lnvps_api/src/payment_factory.rs) can build payment handlers from database payment_method_config rows (create_lightning_node, create_fiat_service, create_onchain_provider, get_*_for_company), and the startup data migration seeds those rows from YAML — but nothing at runtime actually uses the factory:

  • The Lightning node is built from YAML settings (Settings::get_node()) and injected into SubscriptionHandler
  • The on-chain provider likewise comes from Settings::get_onchain() (reusing the YAML LND section with hardcoded defaults), so DB fields like min_confirmations, address_type and account on the new OnChainProviderConfig have no runtime effect yet
  • Revolut/Stripe payment handlers load DB configs directly in payments/mod.rs, bypassing the factory

The DB config was presumably intended to be the source of truth (per-company payment providers). Completing the integration means:

  • Build the Lightning node and on-chain provider from payment_method_config via the factory at startup (fall back to YAML settings when no DB config exists)
  • Respect the on-chain config fields (min_confirmations, address_type, account) — currently hardcoded to 1 / p2wkh / default account in Settings::get_onchain()
  • Route the Revolut/Stripe listeners through the factory for consistency
  • Decide multi-company semantics: SubscriptionHandler currently holds a single global node/provider, while the factory is per-company

Related: #109 / PR #180 introduced create_onchain_provider + get_onchain_provider_for_company and the seeded OnChain DB config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    databaseMigration or schema changesenhancementNew feature or requestpaymentsPayment/invoice logicrefactorInternal restructuring without behaviour change

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions