Moving away from getpaid for now.
[wolnelektury.git] / src / club / management / commands / send_receipts.py
index d29c372..acf8bc4 100644 (file)
@@ -18,6 +18,9 @@ class Command(BaseCommand):
         parser.add_argument(
             '--emails',
             help='Send only to these emails.')
+        parser.add_argument(
+            '--resend', action='store_true',
+            help='This is a re-send.')
 
     def handle(self, *args, **options):
         year = options['year']
@@ -36,7 +39,7 @@ class Command(BaseCommand):
         )
         emails.update(
             Funding.objects.exclude(email='').filter(
-                payed_at__year=year
+                completed_at__year=year
             ).order_by('email').values_list(
                 'email', flat=True
             ).distinct()
@@ -48,6 +51,6 @@ class Command(BaseCommand):
         for email in emails:
             print(email)
             try:
-                PayUOrder.send_receipt(email, year)
+                PayUOrder.send_receipt(email, year, resend=options['resend'])
             except:
                 print('ERROR')