From 40a4c79ba29b5de6d4a168e365d2725ad82b6503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20L=C3=B3pez?= Date: Tue, 31 Oct 2023 13:43:14 -0600 Subject: [PATCH] comments --- speid/tasks/transactions.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/speid/tasks/transactions.py b/speid/tasks/transactions.py index c00937f8..c9af929c 100644 --- a/speid/tasks/transactions.py +++ b/speid/tasks/transactions.py @@ -146,16 +146,17 @@ def send_transaction_status(self, transaction_id: str, state: str) -> None: @celery.task def check_deposits_status(deposit: Dict) -> None: req = DepositStatusQuery(**deposit) - try: - transaction = Transaction.objects.get( - clave_rastreo=req.clave_rastreo, - cuenta_beneficiario=req.cuenta_beneficiario, - tipo=TipoTransaccion.deposito, + transactions = Transaction.objects( + clave_rastreo=req.clave_rastreo, + cuenta_beneficiario=req.cuenta_beneficiario, + tipo=TipoTransaccion.deposito, + ).all() + + if transactions: + retry_incoming_transactions.apply_async( + ([t.speid_id for t in transactions],) ) - except DoesNotExist: - ... - else: - retry_incoming_transactions.apply_async(([transaction.speid_id],)) + return # Si no existe en los registros se obtiene de STP y se intenta con 3 fechas # operativas próximas a la fecha que el cliente nos proporcionó