mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-22 19:34:18 +01:00
Fix wallet backwards paid flag melt (#659)
* backwards compat for melt quote without state * backwards compat for quote without state
This commit is contained in:
@@ -331,6 +331,13 @@ class MeltQuote(LedgerEvent):
|
|||||||
def from_resp_wallet(
|
def from_resp_wallet(
|
||||||
cls, melt_quote_resp, mint: str, amount: int, unit: str, request: str
|
cls, melt_quote_resp, mint: str, amount: int, unit: str, request: str
|
||||||
):
|
):
|
||||||
|
# BEGIN: BACKWARDS COMPATIBILITY < 0.16.0: "paid" field to "state"
|
||||||
|
if melt_quote_resp.state is None:
|
||||||
|
if melt_quote_resp.paid is True:
|
||||||
|
melt_quote_resp.state = MeltQuoteState.paid
|
||||||
|
elif melt_quote_resp.paid is False:
|
||||||
|
melt_quote_resp.state = MeltQuoteState.unpaid
|
||||||
|
# END: BACKWARDS COMPATIBILITY < 0.16.0
|
||||||
return cls(
|
return cls(
|
||||||
quote=melt_quote_resp.quote,
|
quote=melt_quote_resp.quote,
|
||||||
method="bolt11",
|
method="bolt11",
|
||||||
@@ -433,6 +440,13 @@ class MintQuote(LedgerEvent):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_resp_wallet(cls, mint_quote_resp, mint: str, amount: int, unit: str):
|
def from_resp_wallet(cls, mint_quote_resp, mint: str, amount: int, unit: str):
|
||||||
|
# BEGIN: BACKWARDS COMPATIBILITY < 0.16.0: "paid" field to "state"
|
||||||
|
if mint_quote_resp.state is None:
|
||||||
|
if mint_quote_resp.paid is True:
|
||||||
|
mint_quote_resp.state = MintQuoteState.paid
|
||||||
|
elif mint_quote_resp.paid is False:
|
||||||
|
mint_quote_resp.state = MintQuoteState.unpaid
|
||||||
|
# END: BACKWARDS COMPATIBILITY < 0.16.0
|
||||||
return cls(
|
return cls(
|
||||||
quote=mint_quote_resp.quote,
|
quote=mint_quote_resp.quote,
|
||||||
method="bolt11",
|
method="bolt11",
|
||||||
|
|||||||
Reference in New Issue
Block a user