# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from django.utils import timezone
from django.conf import settings
from .models import BillingPlan, BillingAgreement
from django.utils import timezone
from django.conf import settings
from .models import BillingPlan, BillingAgreement
-def absolute_url(url_name):
- return "http://%s%s" % (Site.objects.get_current().domain, reverse(url_name))
+def absolute_url(url_name, kwargs=None):
+ return "http://%s%s" % (Site.objects.get_current().domain, reverse(url_name, kwargs=kwargs))
"description": "Cykliczna darowizna na wsparcie Wolnych Lektur",
"merchant_preferences": {
"auto_bill_amount": "yes",
"description": "Cykliczna darowizna na wsparcie Wolnych Lektur",
"merchant_preferences": {
"auto_bill_amount": "yes",
"cancel_url": absolute_url('paypal_cancel'),
# "initial_fail_amount_action": "continue",
"max_fail_attempts": "3",
"cancel_url": absolute_url('paypal_cancel'),
# "initial_fail_amount_action": "continue",
"max_fail_attempts": "3",
plan_id = plan.plan_id
start = (timezone.now() + timedelta(0, 3600*24)).astimezone(pytz.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
billing_agreement = paypalrestsdk.BillingAgreement({
plan_id = plan.plan_id
start = (timezone.now() + timedelta(0, 3600*24)).astimezone(pytz.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
billing_agreement = paypalrestsdk.BillingAgreement({
- "name": u"Subskrypcja klubu WL",
- "description": u"Stałe wsparcie Wolnych Lektur kwotą %s złotych" % amount,
+ "name": "Subskrypcja klubu WL",
+ "description": "Stałe wsparcie Wolnych Lektur kwotą %s złotych" % amount,
-def agreement_approval_url(amount, app=False):
- agreement = create_agreement(amount, app=app)
+def agreement_approval_url(amount, key, app=False):
+ agreement = create_agreement(amount, key, app=app)