From: Radek Czajka <rczajka@rczajka.pl> Date: Fri, 15 Apr 2022 14:55:13 +0000 (+0200) Subject: Club renewal procedure fixes. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/72fe2a679f27d81c92c65cf005ebf13fae7c7e34 Club renewal procedure fixes. --- diff --git a/src/catalogue/locale/pl/LC_MESSAGES/django.po b/src/catalogue/locale/pl/LC_MESSAGES/django.po index 07af503db..9c9c66192 100644 --- a/src/catalogue/locale/pl/LC_MESSAGES/django.po +++ b/src/catalogue/locale/pl/LC_MESSAGES/django.po @@ -164,7 +164,7 @@ msgstr "slug" msgid "language code" msgstr "Kod jÄzyka" -#: catalogue/models/book.py:67 catalogue/models/book.py:429 +#: catalogue/models/book.py:67 catalogue/models/book.py:436 #: catalogue/models/collection.py:16 catalogue/models/tag.py:61 #: catalogue/models/tag.py:137 msgid "description" @@ -253,21 +253,21 @@ msgstr "ksiÄ Å¼ka" msgid "books" msgstr "ksiÄ Å¼ki" -#: catalogue/models/book.py:621 +#: catalogue/models/book.py:628 #, python-format msgid "Book \"%s\" does not exist." msgstr "Utwór \"%s\" nie istnieje." -#: catalogue/models/book.py:637 +#: catalogue/models/book.py:644 #, python-format msgid "Book %s already exists" msgstr "KsiÄ Å¼ka %s już istnieje" -#: catalogue/models/book.py:955 +#: catalogue/models/book.py:962 msgid "This work needs modernisation" msgstr "Ten utwór wymaga uwspóÅczeÅnienia" -#: catalogue/models/book.py:1045 catalogue/models/bookmedia.py:34 +#: catalogue/models/book.py:1052 catalogue/models/bookmedia.py:34 #, python-format msgid "%s file" msgstr "plik %s" @@ -792,12 +792,14 @@ msgstr "Przepraszamy! Zapytanie jest zbyt dÅugie." msgid "Sorry! Search query must have at least two characters." msgstr "Przepraszamy! Zapytanie musi zawieraÄ co najmniej dwa znaki." -#: catalogue/templates/catalogue/snippets/2022_jplayer.html:53 +#: catalogue/templates/catalogue/snippets/2022_jplayer.html:47 +#: catalogue/templates/catalogue/snippets/2022_jplayer.html:113 #: catalogue/templates/catalogue/snippets/jplayer.html:36 msgid "Artist:" msgstr "Czyta" -#: catalogue/templates/catalogue/snippets/2022_jplayer.html:54 +#: catalogue/templates/catalogue/snippets/2022_jplayer.html:48 +#: catalogue/templates/catalogue/snippets/2022_jplayer.html:114 #: catalogue/templates/catalogue/snippets/jplayer.html:37 msgid "director:" msgstr "reż." diff --git a/src/catalogue/templates/catalogue/2022/book_detail.html b/src/catalogue/templates/catalogue/2022/book_detail.html index a265abef8..a70cba0f7 100644 --- a/src/catalogue/templates/catalogue/2022/book_detail.html +++ b/src/catalogue/templates/catalogue/2022/book_detail.html @@ -321,7 +321,7 @@ <div class="c-support"> <div> <h2>Ta ksiÄ Å¼ka jest dostÄpna dla tysiÄcy dzieciaków dziÄki <span>darowiznom</span> od osób takich jak <span>Ty</span>!</h2> - <a href="/towarzystwo/">DorzuÄ siÄ!</a> + <a href="{% url 'club_join' %}">DorzuÄ siÄ!</a> </div> <figure> <img src="{% static '2022/images/dziecko.jpeg' %}" alt="DorzuÄ siÄ!"> diff --git a/src/catalogue/templates/catalogue/audiobook_zip_readme.txt b/src/catalogue/templates/catalogue/audiobook_zip_readme.txt index 9ffa03ff4..f7933ba48 100644 --- a/src/catalogue/templates/catalogue/audiobook_zip_readme.txt +++ b/src/catalogue/templates/catalogue/audiobook_zip_readme.txt @@ -1,7 +1,7 @@ Ten audiobook pochodzi z darmowej biblioteki internetowej Wolne Lektury. Znajdziesz w niej tysiÄ ce ebooków i setki audiobooków. Wolne Lektury to projekt prowadzony przez fundacjÄ Nowoczesna Polska. JesteÅmy organizacjÄ pozarzÄ dowÄ . DziaÅamy dziÄki wsparciu darczyÅców takich jak Ty. Wspólnie możemy udostÄpniÄ kolejne ksiÄ Å¼ki. Wspieraj Wolne Lektury staÅÄ comiesiÄcznÄ kwotÄ . DziÄki temu wczeÅniej uzyskasz dostÄp do wyjÄ tkowych publikacji! Możesz też wesprzeÄ nas jednorazowo. -Wejdź na https://wolnelektury.pl/towarzystwo/ i dorzuÄ siÄ do nowych nagraÅ. +Wejdź na https://wolnelektury.pl/pomagam/ i dorzuÄ siÄ do nowych nagraÅ. Audiobooki Wolnych Lektur sÄ udostÄpniane na wolnych licencjach, co oznacza, że możesz je swobodnie wykorzystywaÄ, udostÄpniaÄ i publikowaÄ pod warunkiem zachowania warunków licencji i zgodnie z Zasadami wykorzystania Wolnych Lektur: https://wolnelektury.pl/info/zasady-wykorzystania/ @@ -9,7 +9,7 @@ Audiobooki Wolnych Lektur sÄ udostÄpniane na wolnych licencjach, co oznacza, {% endif %}Przekaż 1% na wolnÄ bibliotekÄ KRS 0000070056: https://wolnelektury.pl/info/wesprzyj-nas/ -ZostaÅ Przyjacielem Wolnych Lektur: https://wolnelektury.pl/towarzystwo/ +ZostaÅ Przyjacielem Wolnych Lektur: https://wolnelektury.pl/pomagam/ SÅuchaj nas na YouTube: https://wolnelektury.pl/re/WolneLekturyYT/ diff --git a/src/catalogue/templates/catalogue/book_short.html b/src/catalogue/templates/catalogue/book_short.html index 25c130908..6f88cf0b6 100644 --- a/src/catalogue/templates/catalogue/book_short.html +++ b/src/catalogue/templates/catalogue/book_short.html @@ -150,7 +150,7 @@ {% block preview-info %} <p class="book-box-tools book-box-tools-warn"> {% trans "For now this work is only available for our subscribers." %} - <a href="/towarzystwo/">DoÅÄ cz do Towarzystwa PrzyjacióŠWolnych Lektur</a> + <a href="{% url 'club_join' %}">Wspieraj Wolne Lektury</a> </p> <div>{% content_warning book %}</div> {% endblock %} diff --git a/src/catalogue/templates/catalogue/book_wide.html b/src/catalogue/templates/catalogue/book_wide.html index d7c2a09d5..9413ee70f 100644 --- a/src/catalogue/templates/catalogue/book_wide.html +++ b/src/catalogue/templates/catalogue/book_wide.html @@ -46,7 +46,7 @@ {% if book|status:request.user == 'closed' %} {% with form=club_form %} - <form method="POST" action="/towarzystwo/" id="payment-form" class="wlform"> + <form method="POST" action="{% url 'club_join' %}" id="payment-form" class="wlform"> {% csrf_token %} {% include "club/payment_form.html" %} {% chunk 'club_form_bottom' %} diff --git a/src/club/civicrm.py b/src/club/civicrm.py index c44f6f893..ac3de7039 100644 --- a/src/club/civicrm.py +++ b/src/club/civicrm.py @@ -9,8 +9,8 @@ import yaml class CiviCRM: def __init__(self, base, key): self.base = base - self.api_base = base + 'civicrm/ajax/api4/' self.key = key + self.api_base = (base or '') + 'civicrm/ajax/api4/' self.enabled = bool(self.base and self.key) def request(self, resource, method, params): @@ -89,6 +89,9 @@ class CiviCRM: def report_activity(self, email, tpwl_key, key, name, datetime, details): + if not self.enabled: + return + contact_id = self.create_or_update_contact(email, tpwl_key) activity_id = self.get_activity_id(key) diff --git a/src/club/locale/pl/LC_MESSAGES/django.mo b/src/club/locale/pl/LC_MESSAGES/django.mo index 882e493a6..34073f1ec 100644 Binary files a/src/club/locale/pl/LC_MESSAGES/django.mo and b/src/club/locale/pl/LC_MESSAGES/django.mo differ diff --git a/src/club/locale/pl/LC_MESSAGES/django.po b/src/club/locale/pl/LC_MESSAGES/django.po index 729cb8b17..e8dabe1cf 100644 --- a/src/club/locale/pl/LC_MESSAGES/django.po +++ b/src/club/locale/pl/LC_MESSAGES/django.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2021-08-23 11:23+0200\n" +"PO-Revision-Date: 2022-04-15 16:32+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: pl\n" @@ -17,7 +17,7 @@ msgstr "" "Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n" "%100<12 || n%100>=14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n" "%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" -"X-Generator: Poedit 2.4.1\n" +"X-Generator: Poedit 3.0\n" #: club/admin.py:46 msgid "payment complete" @@ -226,12 +226,6 @@ msgstr "ambasador" msgid "ambassadors" msgstr "ambasadorowie" -#: club/models.py:281 club/templates/club/index.html:7 -#: club/templates/club/index.html:13 club/templates/club/thanks.html:6 -#: club/templates/payu/rec_payment.html:5 -msgid "Towarzystwo PrzyjacióŠWolnych Lektur" -msgstr "" - #: club/payu/models.py:17 club/payu/models.py:29 msgid "POS id" msgstr "" @@ -316,6 +310,15 @@ msgstr "Aktywne roczne wpÅaty cykliczne" msgid "One-time donations in last 30 days" msgstr "Jednorazowe wpÅaty w ciÄ gu ostatnich 30 dni" +#: club/templates/club/dummy_payment.html:4 club/templates/club/index.html:7 +#: club/templates/club/index.html:13 +#: club/templates/club/membership_form_app.html:5 +#: club/templates/club/schedule.html:5 club/templates/club/thanks.html:6 +#: club/templates/club/year_summary.html:5 +#: club/templates/payu/rec_payment.html:5 +msgid "Wolne Lektury need your help!" +msgstr "Wolne Lektury potrzebujÄ Twojej pomocy!" + #: club/templates/club/index.html:20 msgid "Congratulations â you're already a supporter of Wolne Lektury!" msgstr "Gratulacje â należysz już do Towarzystwa PrzyjacióŠWolnych Lektur!" @@ -341,19 +344,19 @@ msgid "Thank you for your support! Support us again!" msgstr "" "DziÄkujemy za Twoje dotychczasowe zaangażowanie! Wesprzyj nas ponownie!" -#: club/templates/club/membership_form.html:21 -msgid "Thank you for wanting to free the books with us!" -msgstr "DziÄkujemy, że chcesz razem z nami uwalniaÄ ksiÄ Å¼ki!" - -#: club/templates/club/membership_form.html:26 +#: club/templates/club/membership_form.html:20 msgid "See your past support." msgstr "Zobacz swoje dotychczasowe wsparcie." -#: club/templates/club/membership_form.html:41 +#: club/templates/club/membership_form.html:24 +msgid "Thank you for wanting to free the books with us!" +msgstr "DziÄkujemy, że chcesz razem z nami uwalniaÄ ksiÄ Å¼ki!" + +#: club/templates/club/membership_form.html:43 msgid "Help us get 100 new Friends by the end of the school semester." msgstr "Pomóż nam zdobyÄ 100 nowych PrzyjacióŠdo koÅca semestru szkolnego." -#: club/templates/club/membership_form.html:42 +#: club/templates/club/membership_form.html:44 #, python-format msgid "" "\n" @@ -382,7 +385,7 @@ msgstr[3] "" "Od poczÄ tku tej kampanii staÅÄ wpÅatÄ wsparÅo nas już <b style=\"color: " "#0d7e85\">%(supporters)s</b> czytelników i czytelniczek," -#: club/templates/club/membership_form.html:47 +#: club/templates/club/membership_form.html:49 #, python-format msgid "" "\n" @@ -509,6 +512,11 @@ msgstr "" "\n" "Zlecasz comiesiÄcznÄ pÅatnoÅÄ w wysokoÅci %(amount)s zÅ. DziÄkujemy!" +#, fuzzy +#~| msgid "Support Wolne Lektury" +#~ msgid "Wolne Lektury" +#~ msgstr "Wspieraj Wolne Lektury" + #~ msgid "sex" #~ msgstr "pÅeÄ" diff --git a/src/club/management/commands/payu_fake_notify.py b/src/club/management/commands/payu_fake_notify.py new file mode 100644 index 000000000..a216ac5b7 --- /dev/null +++ b/src/club/management/commands/payu_fake_notify.py @@ -0,0 +1,25 @@ +# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. +# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. +# +import json +from django.core.management.base import BaseCommand +from club.models import PayUOrder + + +class Command(BaseCommand): + def add_arguments(self, parser): + parser.add_argument('--rejected', '-r', type=bool, default=False) + parser.add_argument('order_id', type=int) + + def handle(self, **options): + order = PayUOrder.objects.get(id=options['order_id']) + status = 'REJECTED' if options['rejected'] else 'COMPLETED' + notification = order.notification_set.create( + body=json.dumps({ + 'order': { + 'status': status, + 'fake': True, + } + }) + ) + notification.apply() diff --git a/src/club/models.py b/src/club/models.py index 548423a1b..f09b68ec7 100644 --- a/src/club/models.py +++ b/src/club/models.py @@ -278,7 +278,7 @@ class PayUOrder(payu_models.Order): self.schedule.get_thanks_url()) def get_description(self): - return ugettext('Towarzystwo PrzyjacióŠWolnych Lektur') + return 'Wolne Lektury' def is_recurring(self): return self.schedule.get_payment_method().is_recurring diff --git a/src/club/payment_methods.py b/src/club/payment_methods.py index c20768546..0c187a826 100644 --- a/src/club/payment_methods.py +++ b/src/club/payment_methods.py @@ -9,6 +9,9 @@ from paypal.rest import agreement_approval_url class PaymentMethod(object): is_onetime = False is_recurring = False + expiration_reliable = False + cancellable = False + updateable = False def initiate(self, request, schedule): return reverse('club_dummy_payment', args=[schedule.key]) @@ -16,6 +19,7 @@ class PaymentMethod(object): class PayU(PaymentMethod): is_onetime = True + expiration_reliable = True slug = 'payu' name = 'PayU' template_name = 'club/payment/payu.html' @@ -39,6 +43,9 @@ class PayURe(PaymentMethod): name = 'PayU recurring' template_name = 'club/payment/payu-re.html' is_recurring = True + expiration_reliable = True + cancellable = True + updateable = True def __init__(self, pos_id): self.pos_id = pos_id diff --git a/src/club/payu/models.py b/src/club/payu/models.py index 5764f8842..6ed329da8 100644 --- a/src/club/payu/models.py +++ b/src/club/payu/models.py @@ -89,7 +89,7 @@ class Order(models.Model): "merchantPosId": self.pos_id, "currencyCode": self.get_pos().currency_code, "totalAmount": str(int(self.get_amount() * 100)), - "extOrderId": "wolne-lektury-rcz-%d" % self.pk, + "extOrderId": "wolne-lektury-%d" % self.pk, "buyer": self.get_buyer() or {}, "continueUrl": self.get_continue_url(), diff --git a/src/club/payu/tests/integration.py b/src/club/payu/tests/integration.py index 3cef8ae41..64f2fe7d5 100644 --- a/src/club/payu/tests/integration.py +++ b/src/club/payu/tests/integration.py @@ -18,6 +18,6 @@ class SandboxTestCase(StaticLiveServerTestCase): super().tearDownClass() def test_payment(self): - self.selenium.get('%s%s' % (self.live_server_url, '/towarzystwo/')) + self.selenium.get('%s%s' % (self.live_server_url, '/pomagam/')) from time import sleep sleep(10) diff --git a/src/club/static/club/form.js b/src/club/static/club/form.js index 3b85a4e11..a32a5896e 100644 --- a/src/club/static/club/form.js +++ b/src/club/static/club/form.js @@ -26,7 +26,7 @@ $(function() { $("#payment-form").submit(function() { let camp = qs('pk_campaign'); - if (!camp && window.location.pathname !== "/towarzystwo/") { + if (!camp && window.location.pathname !== "/pomagam/") { camp = window.location.pathname; } let dims = camp ? {dimension1: camp} : {}; diff --git a/src/club/templates/club/dummy_payment.html b/src/club/templates/club/dummy_payment.html index 2809c5e1a..d776e75a8 100644 --- a/src/club/templates/club/dummy_payment.html +++ b/src/club/templates/club/dummy_payment.html @@ -1,72 +1,72 @@ {% extends request.session.from_app|yesno:"base/app.html,base/base.html" %} -{% block titleextra %}Towarzystwo Wolnych Lektur{% endblock %} +{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %} {% block body %} -<div class="white-box normal-text"> - - <h1>Testowa pÅatnoÅÄ</h1> - - <p> {{ schedule.email }}</p> - <p> {{ schedule.amount }}</p> - <p> {{ schedule.plan.get_interval_display }}</p> - -<!--form method="POST" action=""> - {% csrf_token %} - - {{ form.as_p }} - <button type='submit'>ZapÅaÄ</button> -</form--> - - -{% if request.GET.p == 'inline' %} -<div id="payu-widget"></div> -{% else %} -{% if request.GET.p == 'popup' %} -<form action="http://exampledomain.com/processOrder.php" method="post"> - <button id="pay-button">Pay now</button> -</form> -<script - src="https://secure.payu.com/front/widget/js/payu-bootstrap.js" - pay-button="#pay-button" - merchant-pos-id="145227" - shop-name="Nazwa sklepu" - total-amount="9.99" - currency-code="PLN" - customer-language="pl" - store-card="true" - customer-email="email@exampledomain.com" - sig="250f5f53e465777b6fefb04f171a21b598ccceb2899fc9f229604ad529c69532"> -</script> - - -{% else %} - <form method="POST" action=""> - {% csrf_token %} - - {{ form.as_p }} - <button type='submit'>ZapÅaÄ</button> -</form> -{% endif %} -{% endif %} - -</div> - -<script - src="https://secure.payu.com/front/widget/js/payu-bootstrap.js" - merchant-pos-id="145227" - shop-name="TEST" - total-amount="12345" - currency-code="PLN" - customer-language="en" - store-card="true" - payu-brand="false" - success-callback="test" - widget-mode="use" - customer-email="test@test.com" - sig="203ec8c4b9571ce6b4c03058f57264f04d06d00a86da19390d47ba1be4551578" -</script> + <div class="white-box normal-text"> + + <h1>Testowa pÅatnoÅÄ</h1> + + <p> {{ schedule.email }}</p> + <p> {{ schedule.amount }}</p> + <p> {{ schedule.plan.get_interval_display }}</p> + + <!--form method="POST" action=""> + {% csrf_token %} + + {{ form.as_p }} + <button type='submit'>ZapÅaÄ</button> + </form--> + + + {% if request.GET.p == 'inline' %} + <div id="payu-widget"></div> + {% else %} + {% if request.GET.p == 'popup' %} + <form action="http://exampledomain.com/processOrder.php" method="post"> + <button id="pay-button">Pay now</button> + </form> + <script + src="https://secure.payu.com/front/widget/js/payu-bootstrap.js" + pay-button="#pay-button" + merchant-pos-id="145227" + shop-name="Nazwa sklepu" + total-amount="9.99" + currency-code="PLN" + customer-language="pl" + store-card="true" + customer-email="email@exampledomain.com" + sig="250f5f53e465777b6fefb04f171a21b598ccceb2899fc9f229604ad529c69532"> + </script> + + + {% else %} + <form method="POST" action=""> + {% csrf_token %} + + {{ form.as_p }} + <button type='submit'>ZapÅaÄ</button> + </form> + {% endif %} + {% endif %} + + </div> + + <script + src="https://secure.payu.com/front/widget/js/payu-bootstrap.js" + merchant-pos-id="145227" + shop-name="TEST" + total-amount="12345" + currency-code="PLN" + customer-language="en" + store-card="true" + payu-brand="false" + success-callback="test" + widget-mode="use" + customer-email="test@test.com" + sig="203ec8c4b9571ce6b4c03058f57264f04d06d00a86da19390d47ba1be4551578" + </script> {% endblock %} diff --git a/src/club/templates/club/index.html b/src/club/templates/club/index.html index 6796f25d5..4268be1ad 100644 --- a/src/club/templates/club/index.html +++ b/src/club/templates/club/index.html @@ -4,13 +4,13 @@ {% load chunks %} -{% block titleextra %}{% trans "Towarzystwo PrzyjacióŠWolnych Lektur" %}{% endblock %} +{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %} {% block body %} <div class="white-box normal-text"> - <h1>{% trans "Towarzystwo PrzyjacióŠWolnych Lektur" %}</h1> + <h1>{% trans "Wolne Lektury need your help!" %}</h1> {% chunk 'club' %} diff --git a/src/club/templates/club/membership_form_app.html b/src/club/templates/club/membership_form_app.html index 62ad6883a..433b6fcb9 100644 --- a/src/club/templates/club/membership_form_app.html +++ b/src/club/templates/club/membership_form_app.html @@ -1,19 +1,20 @@ {% extends "base/app.html" %} +{% load i18n %} -{% block titleextra %}Towarzystwo Wolnych Lektur{% endblock %} +{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %} {% block body %} -<div class="white-box normal-text"> + <div class="white-box normal-text"> - <h1>{% if membership %}Odnów swoje czÅonkostwo w Towarzystwie Wolnych Lektur{% else %}DoÅÄ cz do Towarzystwa Wolnych Lektur{% endif %}</h1> + <h1>{% if membership %}Odnów swoje wsparcie dla Wolnych Lektur{% else %}Wspieraj Wolne Lektury{% endif %}</h1> -<form method="POST" action=""> - {% csrf_token %} + <form method="POST" action=""> + {% csrf_token %} - {{ form.as_p }} - <button type='submit'>DoÅÄ cz</button> + {{ form.as_p }} + <button type='submit'>Wspieraj</button> </form> </div> diff --git a/src/club/templates/club/schedule.html b/src/club/templates/club/schedule.html index adf8f91ef..9505cdda5 100644 --- a/src/club/templates/club/schedule.html +++ b/src/club/templates/club/schedule.html @@ -1,35 +1,75 @@ {% extends "base/base.html" %} +{% load i18n %} -{% block titleextra %}Towarzystwo PrzyjacióŠWolnych Lektur{% endblock %} +{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %} {% block body %} <div class="white-box normal-text"> -<h1> -Cieszymy siÄ, że jesteÅ z nami! DziÄkujemy za wsparcie! -</h1> -<p> -Od <strong>{{ schedule.started_at.date }}</strong> -{% if schedule.expires_at %} - do <strong>{{ schedule.expires_at.date }}</strong> -{% endif %} -wspierasz nas kwotÄ {{ schedule.amount }} zÅ{% if schedule.monthly %} miesiÄcznie{% endif %}{% if schedule.yearly %} rocznie{% endif %}. -</p> + <h1> + Cieszymy siÄ, że jesteÅ z nami! DziÄkujemy za wsparcie! + </h1> + <p> + + + {% if schedule.payed_at %} + Kwota: + {{ schedule.amount }} zÅ + + <br> + + Pierwsza wpÅata: + {{ schedule.payed_at.date }} + + <br> + + {% if schedule.is_expired %} + <strong style="color: red"> + Status darczyÅcy nieaktywny od + {{ schedule.expires_at.date }} + </strong> + {% else %} + <strong style="color: green"> + Status darczyÅcy aktywny + {% if schedule.get_payment_method.expiration_reliable %} + do + {{ schedule.expires_at.date }} + {% endif %} + </strong> + {% endif %} + + <br> + + {% endif %} + + {% if schedule.is_active %} {% if schedule.is_recurring %} {% if schedule.is_cancelled %} <p><strong>PÅatnoÅÄ anulowana.</strong></p> <p> - <a style="background:#018189;color:white;border-radius: 10px;padding:1em 2em" href="/towarzystwo/dolacz/">WpÅaÄ ponownie</a> + <a style="background:#018189;color:white;border-radius: 10px;padding:1em 2em" href="/pomagam/">WpÅaÄ ponownie</a> </p> {% else %} - <form class="wlform" method='post' action="{% url 'club_cancel' schedule.key %}"> - {% csrf_token %} - <button type="submit" class="submit" style="font-size: .9em">Zrezygnuj z kolejnej pÅatnoÅci</button> - </form> + {% if schedule.get_payment_method.updateable %} + <form method='post' action='' class="wlform"> + {% csrf_token %} + <button type="submit" class="submit"> + Zaktualizuj dane pÅatnoÅci + </button> + </form> + <br> + {% endif %} + + {% if schedule.get_payment_method.cancellable %} + <form class="wlform" method='post' action="{% url 'club_cancel' schedule.key %}"> + {% csrf_token %} + <button type="submit" class="submit" style="font-size: .9em">Zrezygnuj z kolejnych pÅatnoÅci</button> + </form> + {% endif %} {% endif %} {% else %} <form class="wlform" method='post' action=''> @@ -40,12 +80,18 @@ wspierasz nas kwotÄ {{ schedule.amount }} zÅ{% if schedule.monthly %} miesiÄc {% else %} - {% if schedule.is_expired %} - CzÅonkostwo wygasÅo. - <form method='post' action='' class="wlform"> - {% csrf_token %} - <button type="submit" class="submit">DorzuÄ siÄ ponownie</button> - </form> + {% if schedule.is_expired %} + + <form method='post' action='' class="wlform"> + {% csrf_token %} + <button type="submit" class="submit"> + {% if schedule.is_recurring %} + Zaktualizuj dane pÅatnoÅci + {% else %} + DorzuÄ siÄ ponownie + {% endif %} + </button> + </form> {% else %} @@ -55,9 +101,9 @@ wspierasz nas kwotÄ {{ schedule.amount }} zÅ{% if schedule.monthly %} miesiÄc Czekamy na potwierdzenie pÅatnoÅci. {% else %} - <form method='post' action=''> + <form method='post' action='' class="wlform"> {% csrf_token %} - <button type="submit" class="submit">DorzuÄ siÄ</button> + <button type="submit" class="submit">DokoÅcz pÅatnoÅÄ</button> </form> {% endif %} @@ -66,32 +112,34 @@ wspierasz nas kwotÄ {{ schedule.amount }} zÅ{% if schedule.monthly %} miesiÄc {% endif %} -<hr style="margin: 2em 0;"> - +{% if not schedule.membership %} -<h2>Towarzystwo PrzyjacióŠWolnych Lektur</h2> + <hr style="margin: 2em 0;"> + <h2>PowiÄ zanie z kontem użytkownika</h2> -{% if schedule.membership %} - <p> - Należysz już do Towarzystwa PrzyjacióŠWolnych Lektur!</p> -{% else %} <p> -Twoje wsparcie upoważnia CiÄ do czÅonkostwa w Towarzystwie PrzyjacióŠWolnych Lektur. -Aby w peÅni z niego korzystaÄ, zapisz siÄ do Towarzystwa swoim kontem użytkownika na Wolnych Lekturach. +Twoje wsparcie upoważnia CiÄ do przedpremierowego dostÄpu do publikacji. +Aby z niego korzystaÄ, powiÄ Å¼ darowiznÄ ze swoim kontem użytkownika na Wolnych Lekturach. </p> -<p> -<a style="background:#018189;color:white;border-radius: 10px;padding:1em 2em;" href="{% url 'club_claim' schedule.key %}">Zapisz siÄ</a> +<p style="margin-top:2em;"> + <a style="background:#018189;color:white;border-radius: 10px;padding:1em 2em;" href="{% url 'club_claim' schedule.key %}"> + {% if request.user.is_authenticated %} + PowiÄ Å¼ darowiznÄ z kontem <strong>{{ request.user.username }}</strong> + {% else %} + Zaloguj siÄ i powiÄ Å¼ darowiznÄ z kontem + {% endif %} + </a> </p> {% endif %} - + <a href=""> </div> diff --git a/src/club/templates/club/thanks.html b/src/club/templates/club/thanks.html index eff910a50..a527d00dc 100644 --- a/src/club/templates/club/thanks.html +++ b/src/club/templates/club/thanks.html @@ -3,20 +3,20 @@ {% load i18n %} -{% block titleextra %}{% trans "Towarzystwo PrzyjacióŠWolnych Lektur" %}{% endblock %} +{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %} {% block body %} -<div class="white-box normal-text"> + <div class="white-box normal-text"> - <h1>{% trans "Thank you" %}</h1> + <h1>{% trans "Thank you" %}</h1> - {% chunk 'club_thanks' %} + {% chunk 'club_thanks' %} - {% if request.session.from_app %} - <a href="wolnelekturyapp://paypal_return">{% trans "Go back to the app" %}</a> + {% if request.session.from_app %} + <a href="wolnelekturyapp://paypal_return">{% trans "Go back to the app" %}</a> {% endif %} </div> diff --git a/src/club/templates/club/year_summary.html b/src/club/templates/club/year_summary.html index 20ed198e2..32e1ffd61 100644 --- a/src/club/templates/club/year_summary.html +++ b/src/club/templates/club/year_summary.html @@ -2,7 +2,7 @@ {% load chunks i18n %} -{% block titleextra %}Towarzystwo PrzyjacióŠWolnych Lektur{% endblock %} +{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %} {% block body %} diff --git a/src/club/templates/payu/rec_payment.html b/src/club/templates/payu/rec_payment.html index 71dcdca37..4c840a699 100644 --- a/src/club/templates/payu/rec_payment.html +++ b/src/club/templates/payu/rec_payment.html @@ -2,7 +2,7 @@ {% load i18n %} -{% block titleextra %}{% trans "Towarzystwo PrzyjacióŠWolnych Lektur" %}{% endblock %} +{% block titleextra %}{% trans "Wolne Lektury need your help!" %}{% endblock %} {% block body %} @@ -17,31 +17,31 @@ {% endblocktrans %} </p> - <form id="theform" method='POST'> - {% csrf_token %} - {{ form }} - </form> + <form id="theform" method='POST'> + {% csrf_token %} + {{ form }} + </form> -<script> - function paymentcallback(data) { - $("#theform #id_token").val(data.value); - $("#theform").submit() - } -</script> + <script> + function paymentcallback(data) { + $("#theform #id_token").val(data.value); + $("#theform").submit() + } + </script> -<div id="payu-widget"></div> -<script - src="{{ pos.get_api_host }}/front/widget/js/payu-bootstrap.js" + <div id="payu-widget"></div> + <script + src="{{ pos.get_api_host }}/front/widget/js/payu-bootstrap.js" - {% for k, v in widget_args.items %} - {{ k }}="{{ v }}" - {% endfor %} + {% for k, v in widget_args.items %} + {{ k }}="{{ v }}" + {% endfor %} - success-callback="paymentcallback" - sig="{{ widget_sig }}"> -</script> + success-callback="paymentcallback" + sig="{{ widget_sig }}"> + </script> </div> diff --git a/src/club/urls.py b/src/club/urls.py index d55ef171f..9b9d89725 100644 --- a/src/club/urls.py +++ b/src/club/urls.py @@ -2,12 +2,15 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django.urls import path +from django.views.generic import RedirectView from annoy.utils import banner_exempt from . import views urlpatterns = [ path('', banner_exempt(views.JoinView.as_view()), name='club_join'), + path('dolacz/', RedirectView.as_view( + url='/pomagam/', permanent=False)), path('info/', banner_exempt(views.ClubView.as_view()), name='club'), path('plan/<key>/', banner_exempt(views.ScheduleView.as_view()), name='club_schedule'), @@ -23,7 +26,5 @@ urlpatterns = [ path('notify/<int:pk>/', views.PayUNotifyView.as_view(), name='club_payu_notify'), - path('czlonek/', views.MembershipView.as_view(), name='club_membership'), - path('weryfikacja/', views.member_verify, name='club_member_verify'), ] diff --git a/src/club/views.py b/src/club/views.py index dc1bef07b..74d86de9e 100644 --- a/src/club/views.py +++ b/src/club/views.py @@ -149,17 +149,6 @@ class PayUNotifyView(payu_views.NotifyView): order_model = models.PayUOrder -class MembershipView(UpdateView): - fields = ['name'] - - def get_success_url(self): - # TODO: get only current schedule if multiple. - return self.object.schedule_set.first().get_absolute_url() - - def get_object(self): - return self.request.user.membership - - class ScheduleThanksView(DetailView): model = models.Schedule slug_field = slug_url_kwarg = 'key' diff --git a/src/paypal/urls.py b/src/paypal/urls.py index 7adf644a2..7c4f6933d 100644 --- a/src/paypal/urls.py +++ b/src/paypal/urls.py @@ -6,8 +6,8 @@ from django.views.generic import RedirectView from . import views urlpatterns = ( - path('form/', RedirectView.as_view(url='/towarzystwo/dolacz/')), - path('app-form/', RedirectView.as_view(url='/towarzystwo/dolacz/app/')), + path('form/', RedirectView.as_view(url='/pomagam/')), + path('app-form/', RedirectView.as_view(url='/pomagam/?pk_campaign=aplikacja')), path('return/<key>/', views.paypal_return, name='paypal_return'), path('app-return/<key>/', views.paypal_return, kwargs={'app': True}, name='paypal_app_return'), diff --git a/src/wolnelektury/templates/board_base.html b/src/wolnelektury/templates/board_base.html index 29dff3c56..0a83b8077 100644 --- a/src/wolnelektury/templates/board_base.html +++ b/src/wolnelektury/templates/board_base.html @@ -14,7 +14,7 @@ <nav class="navbar navbar-expand-lg navbar-dark bg-dark"> <a class="navbar-brand" href="{% url 'forum:index' %}"> {% block brand %} - <img src="{% static 'img/logo-neon-transp.png' %}" alt="Towarzystwo PrzyjacióŠWolnych Lektur"> + <img src="{% static 'img/logo-neon-transp.png' %}" alt="Wolne Lektury"> {% endblock %} </a> diff --git a/src/wolnelektury/templates/user.html b/src/wolnelektury/templates/user.html index 0f261f92b..3adb03028 100644 --- a/src/wolnelektury/templates/user.html +++ b/src/wolnelektury/templates/user.html @@ -12,7 +12,7 @@ <p><a href="{% url 'account_email' %}">{% trans "E-mail" %}</a></p> <p><a href="{% url 'socialaccount_connections' %}">{% trans "Social accounts" %}</a></p> {% if request.user.membership %} - <p><a href="{% url 'club_join' %}">Należysz do Towarzystwa PrzyjacióŠWolnych Lektur</a></p> + <p><a href="{% url 'club_join' %}">Wspierasz Wolne Lektury, dziÄkujemy!</a></p> {% endif %} </div> {% endblock %} diff --git a/src/wolnelektury/urls.py b/src/wolnelektury/urls.py index 11722fc51..5fdff167c 100644 --- a/src/wolnelektury/urls.py +++ b/src/wolnelektury/urls.py @@ -49,19 +49,11 @@ urlpatterns += [ path('messaging/', include('messaging.urls')), path('re/', include('redirects.urls')), path('stats/', include('stats.urls')), - - path('paypal/app-form/', RedirectView.as_view( - url='/towarzystwo/?pk_campaign=aplikacja', permanent=False)), - path('towarzystwo/dolacz/', RedirectView.as_view( - url='/towarzystwo/', permanent=False)), - path('paypal/', include('paypal.urls')), path('powiadomienie/', include('push.urls')), - path('towarzystwo/', include('club.urls')), - #path('pomagam/', include('club.urls2')), - path('pomagam/', RedirectView.as_view( - url='/towarzystwo/?pk_campaign=pomagam', permanent=False)), - + path('pomagam/', include('club.urls')), + path('towarzystwo/<path:path>', RedirectView.as_view( + url='/pomagam/%(path)s', permanent=False)), # Admin panel path('admin/catalogue/book/import', catalogue.views.import_book, name='import_book'),