upgrade
[wolnelektury.git] / src / club / models.py
index 0d75ec4..4f3a8f6 100644 (file)
@@ -316,7 +316,7 @@ class PayUOrder(payu_models.Order):
         if self.status == 'COMPLETED':
             self.schedule.set_payed()
 
-        elif self.status == 'CANCELED':
+        elif self.status == 'CANCELED' or self.status.startswith('ERR-'):
             if self.is_recurring() and self.schedule.expires_at:
                 self.schedule.send_email_failed_recurring()
             
@@ -352,7 +352,7 @@ class PayUOrder(payu_models.Order):
         )            
 
     @classmethod
-    def send_receipt(cls, email, year):
+    def send_receipt(cls, email, year, resend=False):
         Contact = apps.get_model('messaging', 'Contact')
         Funding = apps.get_model('funding', 'Funding')
         BillingAgreement = apps.get_model('paypal', 'BillingAgreement')
@@ -406,6 +406,7 @@ class PayUOrder(payu_models.Order):
             "total": sum(x['amount'] for x in payments),
             "payments": payments,
             "optout": optout,
+            "resend": resend,
         }
         temp = tempfile.NamedTemporaryFile(prefix='receipt-', suffix='.pdf', delete=False)
         temp.close()