refactor: payment.check_status() into check_payment_status(payment) (#3747)
Co-authored-by: Vlad Stan <stan.v.vlad@gmail.com>
This commit is contained in:
@@ -7,7 +7,11 @@ from lnbits import bolt11
|
||||
from lnbits.core.crud import get_standalone_payment, update_payment
|
||||
from lnbits.core.crud.wallets import create_wallet, get_wallet
|
||||
from lnbits.core.models import CreateInvoice, Payment, PaymentState
|
||||
from lnbits.core.services import fee_reserve_total, get_balance_delta
|
||||
from lnbits.core.services import (
|
||||
check_payment_status,
|
||||
fee_reserve_total,
|
||||
get_balance_delta,
|
||||
)
|
||||
from lnbits.core.services.payments import pay_invoice, update_wallet_balance
|
||||
from lnbits.core.services.users import create_user_account
|
||||
from lnbits.exceptions import PaymentError
|
||||
@@ -355,7 +359,7 @@ async def test_pay_hold_invoice_check_pending_and_fail_cancel_payment_task_in_me
|
||||
assert payment_db_after_settlement is not None
|
||||
|
||||
# payment is failed
|
||||
status = await payment_db_after_settlement.check_status()
|
||||
status = await check_payment_status(payment_db_after_settlement)
|
||||
assert not status.paid
|
||||
assert status.failed
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from lnbits.core.crud.wallets import create_wallet
|
||||
from lnbits.core.models.payments import CreateInvoice, PaymentState
|
||||
from lnbits.core.models.users import User
|
||||
from lnbits.core.models.wallets import Wallet
|
||||
from lnbits.core.services import payments
|
||||
from lnbits.core.services import check_payment_status, payments
|
||||
from lnbits.core.services.fiat_providers import (
|
||||
check_stripe_signature,
|
||||
handle_fiat_payment_confirmation,
|
||||
@@ -221,7 +221,7 @@ async def test_create_wallet_fiat_invoice_success(
|
||||
assert payment.checking_id.startswith("fiat_stripe_")
|
||||
assert payment.fee <= 0
|
||||
|
||||
status = await payment.check_status()
|
||||
status = await check_payment_status(payment)
|
||||
assert status.success is False
|
||||
assert status.pending is True
|
||||
|
||||
@@ -230,7 +230,7 @@ async def test_create_wallet_fiat_invoice_success(
|
||||
"lnbits.fiat.StripeWallet.get_invoice_status",
|
||||
AsyncMock(return_value=fiat_mock_status),
|
||||
)
|
||||
status = await payment.check_status()
|
||||
status = await check_payment_status(payment)
|
||||
assert status.paid is True
|
||||
assert status.success is True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user