refactor exchange rates (#1847)

* simplify and cache exchange rate

note that exir was removed as a provider

* add binance as provider

* log exception

* add test

* add blockchain.com provider
This commit is contained in:
jackstar12
2023-08-24 11:59:57 +01:00
committed by GitHub
parent 7343d1e0a0
commit e50a7fb2d1
2 changed files with 46 additions and 47 deletions
+13
View File
@@ -84,6 +84,19 @@ async def test_create_invoice(client, inkey_headers_to):
return invoice
@pytest.mark.asyncio
async def test_create_invoice_fiat_amount(client, inkey_headers_to):
data = await get_random_invoice_data()
data["unit"] = "EUR"
response = await client.post(
"/api/v1/payments", json=data, headers=inkey_headers_to
)
assert response.status_code == 201
invoice = response.json()
decode = bolt11.decode(invoice["payment_request"])
assert decode.amount_msat != data["amount"] * 1000
# check POST /api/v1/payments: invoice creation for internal payments only
@pytest.mark.asyncio
async def test_create_internal_invoice(client, inkey_headers_to):