mirror of
https://github.com/lnbits/lnbits.git
synced 2025-07-01 02:51:29 +02:00
fix boltcard refunds
This commit is contained in:
@ -130,7 +130,7 @@ async def delete_card(card_id: str) -> None:
|
|||||||
for hit in hits:
|
for hit in hits:
|
||||||
await db.execute("DELETE FROM boltcards.hits WHERE id = ?", (hit.id,))
|
await db.execute("DELETE FROM boltcards.hits WHERE id = ?", (hit.id,))
|
||||||
# Delete refunds
|
# Delete refunds
|
||||||
refunds = await get_refunds([hit])
|
refunds = await get_refunds([hit.id])
|
||||||
for refund in refunds:
|
for refund in refunds:
|
||||||
await db.execute(
|
await db.execute(
|
||||||
"DELETE FROM boltcards.refunds WHERE id = ?", (refund.hit_id,)
|
"DELETE FROM boltcards.refunds WHERE id = ?", (refund.hit_id,)
|
||||||
@ -266,7 +266,7 @@ async def get_refund(refund_id: str) -> Optional[Refund]:
|
|||||||
return Refund.parse_obj(refund)
|
return Refund.parse_obj(refund)
|
||||||
|
|
||||||
|
|
||||||
async def get_refunds(hits_ids: List[Hit]) -> List[Refund]:
|
async def get_refunds(hits_ids: Union[str, List[str]]) -> List[Refund]:
|
||||||
if len(hits_ids) == 0:
|
if len(hits_ids) == 0:
|
||||||
return []
|
return []
|
||||||
|
|
||||||
|
@ -158,5 +158,8 @@ async def api_refunds(
|
|||||||
for card in cards:
|
for card in cards:
|
||||||
cards_ids.append(card.id)
|
cards_ids.append(card.id)
|
||||||
hits = await get_hits(cards_ids)
|
hits = await get_hits(cards_ids)
|
||||||
|
hits_ids = []
|
||||||
|
for hit in hits:
|
||||||
|
hits_ids.append(hit.id)
|
||||||
|
|
||||||
return [refund.dict() for refund in await get_refunds(hits)]
|
return [refund.dict() for refund in await get_refunds(hits_ids)]
|
||||||
|
Reference in New Issue
Block a user