Better experiments management.
[wolnelektury.git] / src / club / models.py
index 92d62c3..a0722d3 100644 (file)
@@ -299,6 +299,7 @@ class PayUOrder(payu_models.Order):
     def send_receipt(cls, email, year):
         Contact = apps.get_model('messaging', 'Contact')
         Funding = apps.get_model('funding', 'Funding')
     def send_receipt(cls, email, year):
         Contact = apps.get_model('messaging', 'Contact')
         Funding = apps.get_model('funding', 'Funding')
+        BillingAgreement = apps.get_model('paypal', 'BillingAgreement')
         payments = []
 
         try:
         payments = []
 
         try:
@@ -325,6 +326,9 @@ class PayUOrder(payu_models.Order):
                 'amount': order.get_amount(),
             })
 
                 'amount': order.get_amount(),
             })
 
+        for ba in BillingAgreement.objects.filter(schedule__email=email):
+            payments.extend(ba.get_donations(year))
+
         fundings = Funding.objects.filter(
             email=email,
             payed_at__year=year
         fundings = Funding.objects.filter(
             email=email,
             payed_at__year=year
@@ -354,7 +358,7 @@ class PayUOrder(payu_models.Order):
             })
 
         message = EmailMessage(
             })
 
         message = EmailMessage(
-                f'Odlicz od podatku swoje darowizny przekazane dla Wolnych Lektur',
+                'Odlicz darowiznÄ™ na Wolne Lektury od podatku',
                 template.loader.render_to_string('club/receipt_email.txt', ctx),
                 settings.CONTACT_EMAIL, [email]
             )
                 template.loader.render_to_string('club/receipt_email.txt', ctx),
                 settings.CONTACT_EMAIL, [email]
             )