From f1e811553157906f93ac42c00f3bb522e6354612 Mon Sep 17 00:00:00 2001 From: kvn <42082827+crypto-rizzo@users.noreply.github.com> Date: Mon, 20 Nov 2023 08:53:35 -0500 Subject: [PATCH] temp: imrpove address already redeemed check --- backend/apps/root/models.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/backend/apps/root/models.py b/backend/apps/root/models.py index a0aaeef94..5228e6d04 100644 --- a/backend/apps/root/models.py +++ b/backend/apps/root/models.py @@ -1523,13 +1523,18 @@ def _process_wallet_address(self, checkout_session=None): {"wallet_address": "Address was recovered, but did not match"} ) - # Last, check if other wallets have + # TEMP + # Last, check if same wallet has already redeemed for this event # This is to prevent one person grabbing multiple tickets existing_wallets = TxAssetOwnership.objects.filter( checkoutsession__event=checkout_session.event, - checkoutsession__tx_status=CheckoutSession.OrderStatus.FULFILLED, wallet_address=recovered_address + ).exclude( + checkoutsession__tx_status=CheckoutSession.OrderStatus.FAILED, + ).exclude( + checkoutsession__tx_status=CheckoutSession.OrderStatus.VALID, ) + print(existing_wallets) if existing_wallets: raise TxAssetOwnershipProcessingError( {"wallet_address": "Address has already redeemed tickets for this event."}