Start updating docs.
[wolnelektury.git] / src / club / payment_methods.py
index ca34ace..99694ef 100644 (file)
@@ -1,3 +1,6 @@
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
 from django.conf import settings
 from django.urls import reverse
 
 from django.conf import settings
 from django.urls import reverse
 
@@ -45,9 +48,13 @@ class PayURe(PaymentMethod):
     def pay(self, request, schedule):
         # Create order, put it and see what happens next.
         from .models import PayUOrder
     def pay(self, request, schedule):
         # Create order, put it and see what happens next.
         from .models import PayUOrder
+        if request is not None:
+            ip = request.META['REMOTE_ADDR']
+        else:
+            ip = '127.0.0.1'
         order = PayUOrder.objects.create(
             pos_id=self.pos_id,
         order = PayUOrder.objects.create(
             pos_id=self.pos_id,
-            customer_ip=request.META['REMOTE_ADDR'],
+            customer_ip=ip,
             schedule=schedule,
         )
         return order.put()
             schedule=schedule,
         )
         return order.put()