Skip to content

Commit

Permalink
Delete cashback after claim
Browse files Browse the repository at this point in the history
Signed-off-by: alfred richardsn <rchrdsn@protonmail.ch>
  • Loading branch information
r4rdsn committed Aug 25, 2020
1 parent bc597f4 commit 6bf3ed4
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/handlers/cashback.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,17 @@ async def transfer_cashback(user_id: int, currency: str, address: str):
]
)
amount_document = await cursor.to_list(length=1)
return await get_escrow_instance(currency).transfer(
address,
amount_document[0]["amount"].to_decimal(),
currency,
memo="cashback for using escrow service on https://t.me/TellerBot",
)
try:
return await get_escrow_instance(currency).transfer(
address,
amount_document[0]["amount"].to_decimal(),
currency,
memo="cashback for using escrow service on https://t.me/TellerBot",
)
except Exception as error:
raise error
else:
await database.cashback.delete_many({"id": user_id, "currency": currency})


@private_handler(state=states.cashback_address)
Expand Down

0 comments on commit 6bf3ed4

Please sign in to comment.