fix: catch init fiat providers (#3281)

This commit is contained in:
dni ⚡
2025-07-17 14:58:03 +03:00
committed by GitHub
parent 851c952c6d
commit 133afff8ee
3 changed files with 19 additions and 4 deletions
+5
View File
@@ -176,6 +176,11 @@ async def test_connection(provider: str) -> SimpleStatus:
This function should be called when setting up or testing the Stripe integration.
"""
fiat_provider = await get_fiat_provider(provider)
if not fiat_provider:
return SimpleStatus(
success=False,
message=f"Fiat provider '{provider}' not found.",
)
status = await fiat_provider.status()
if status.error_message:
return SimpleStatus(
+3
View File
@@ -136,6 +136,9 @@ async def create_fiat_invoice(
internal_payment = await create_wallet_invoice(wallet_id, invoice_data)
fiat_provider = await get_fiat_provider(fiat_provider_name)
if not fiat_provider:
raise InvoiceError("No fiat provider found.", status="failed")
fiat_invoice = await fiat_provider.create_invoice(
amount=invoice_data.amount,
payment_hash=internal_payment.payment_hash,