async def check_invoice_status( wallet_id: str, payment_hash: str, conn: Optional[Connection] = None, ) -> PaymentStatus: payment = await get_wallet_payment(wallet_id, payment_hash, conn=conn) if not payment: return PaymentStatus(None) if payment.is_out: status = await WALLET.get_payment_status(payment.checking_id) else: status = await WALLET.get_invoice_status(payment.checking_id) if not payment.pending: return status if payment.is_out and status.failed: print( f" - deleting outgoing failed payment {payment.checking_id}: {status}" ) await payment.delete() elif not status.pending: print( f" - marking '{'in' if payment.is_in else 'out'}' {payment.checking_id} as not pending anymore: {status}" ) await payment.set_pending(status.pending) return status
async def check_invoice_status(wallet_id: str, payment_hash: str) -> PaymentStatus: payment = await get_wallet_payment(wallet_id, payment_hash) if not payment: return PaymentStatus(None) return WALLET.get_invoice_status(payment.checking_id)
async def check_invoice_status( wallet_id: str, payment_hash: str, conn: Optional[Connection] = None, ) -> PaymentStatus: payment = await get_wallet_payment(wallet_id, payment_hash, conn=conn) if not payment: return PaymentStatus(None) return await WALLET.get_invoice_status(payment.checking_id)