refactor: Explicitly check for FAILED state in get_payment_status

orig commit: 5374747667ea032fc45b4d60284a5112fa140120
This commit is contained in:
Vlad Stan 2025-05-16 11:00:35 +03:00
parent 05423d3508
commit 18ee896aa8

View File

@ -409,9 +409,9 @@ class StrikeWallet(Wallet):
preimage = data.get("preimage") or data.get("preImage")
if state in {"SUCCEEDED", "COMPLETED"}:
return PaymentSuccessStatus(fee_msat=0, preimage=preimage)
# todo: check for FAILED status and default to pending
if state == "FAILED":
return PaymentFailedStatus()
# Default to pending for PENDING and any other states
return PaymentPendingStatus()
except httpx.HTTPStatusError as e:
# todo: better handle this inside the try block