fix expired creation transaction events cancelation (#13235)
This commit is contained in:
parent
9968aef215
commit
4bfb9e3331
|
@ -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',
|
||||
|
|
Reference in New Issue