From 4bfb9e333132fde8e0063d74280f708ce68b0702 Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Tue, 20 Sep 2016 14:47:51 +0200 Subject: [PATCH] fix expired creation transaction events cancelation (#13235) --- facturier/management/commands/cleanup_transactionevents.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/facturier/management/commands/cleanup_transactionevents.py b/facturier/management/commands/cleanup_transactionevents.py index a862b61..f338088 100644 --- a/facturier/management/commands/cleanup_transactionevents.py +++ b/facturier/management/commands/cleanup_transactionevents.py @@ -9,7 +9,7 @@ class Command(BaseCommand): def handle(self, *args, **options): delta = timezone.now() - timezone.timedelta(minutes=10) for event in TransactionEvent.objects.filter(status='CREATED', date__lte=delta): - if not TransactionEvent.objects.filter(invoice_id=event.invoice_id, + if not TransactionEvent.objects.filter(invoice_id=event.invoice_id, date__gt=event.date, status__in=['CANCELED', 'ERROR', 'PAID', 'DENIED']).exists(): TransactionEvent.objects.create(transaction_id=event.transaction_id, status='CANCELED',