diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index 94f73a1..ec903e4 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-07-19 19:01+0000\n" +"POT-Creation-Date: 2020-07-19 19:38+0000\n" "PO-Revision-Date: 2016-04-07 01:32+0000\n" "Last-Translator: \n" "Language-Team: \n" @@ -283,15 +283,15 @@ msgstr "État" msgid "Mark as cancelled (do not actually cancel)" msgstr "Marquer comme annulé (n'annule pas)" -#: payments/admin.py:37 payments/admin.py:92 +#: payments/admin.py:37 payments/admin.py:98 msgid "Payment Data" msgstr "Données de paiement" -#: payments/admin.py:60 +#: payments/admin.py:66 msgid "Amount" msgstr "Montant" -#: payments/admin.py:64 +#: payments/admin.py:70 msgid "Paid amount" msgstr "Montant payé" @@ -714,13 +714,20 @@ msgstr "Voir toutes les questions" msgid "Did you find this answer useful?" msgstr "Avez-vous trouvé cette réponse utile ?" +#: templates/lambdainst/account.html:24 +msgid "ACTIVE" +msgstr "ACTIF" + +#: templates/lambdainst/account.html:26 +msgid "INACTIVE" +msgstr "INACTIF" + #: templates/lambdainst/account.html:31 templates/lambdainst/account.html:63 msgid "Subscription" msgstr "Abonnement" #: templates/lambdainst/account.html:34 -#, fuzzy, python-format -#| msgid "ACTIF. Renews on %(until)s via %(backend)s." +#, python-format msgid "ACTIVE. Renews on %(until)s via %(backend)s." msgstr "ACTIF. Renouvellement: %(until)s via %(backend)s" diff --git a/payments/admin.py b/payments/admin.py index 8b21633..649ec2a 100644 --- a/payments/admin.py +++ b/payments/admin.py @@ -46,14 +46,20 @@ class PaymentAdmin(admin.ModelAdmin): search_fields = ('user__username', 'user__email', 'backend_extid', 'backend_data') def backend(self, object): - return object.backend.backend_verbose_name + try: + return object.backend.backend_verbose_name + except KeyError: + return "#" + object.backend_id def backend_data_fmt(self, object): return json_format(object.backend_data) def backend_extid_link(self, object): - ext_url = object.backend.get_ext_url(object) - return link(object.backend_extid, ext_url) + try: + ext_url = object.backend.get_ext_url(object) + return link(object.backend_extid, ext_url) + except KeyError: + return "#" + object.backend_id def amount_fmt(self, object): return '%.2f %s' % (object.amount / 100, object.currency_name) diff --git a/payments/backends/stripe.py b/payments/backends/stripe.py index 4052421..fd70caa 100644 --- a/payments/backends/stripe.py +++ b/payments/backends/stripe.py @@ -147,17 +147,6 @@ class StripeBackend(BackendBase): subscr.backend_data['subscription_id'] = sub_id subscr.save() - payment = subscr.create_payment() - payment.status = 'confirmed' - payment.paid_amount = payment.amount - payment.backend_extid = None - #payment.save() - - payment.user.vpnuser.add_paid_time(payment.time) - payment.user.vpnuser.on_payment_confirmed(payment) - payment.user.vpnuser.save() - payment.save() - else: from payments.models import Payment payment = Payment.objects.filter(backend_extid=session['id']).get() @@ -199,8 +188,8 @@ class StripeBackend(BackendBase): if not subscr: # the subscription does not exist # checkout.confirmed event will create it and handle the initial payment - return True - # raise Exception("Unknown subscription for invoice %r" % invoice['id']) + # return True + raise Exception("Unknown subscription for invoice %r" % invoice['id']) # Prevent making duplicate Payments if event is received twice pc = Payment.objects.filter(backend_extid=invoice['id']).count() @@ -216,7 +205,7 @@ class StripeBackend(BackendBase): payment.backend_sub_id = invoice['subscription'] else: payment.backend_sub_id = invoice['subscription']['id'] - payment.backend_data = {'event_id': event['id']} + payment.backend_data = {'event_id': event['id'], 'sub_id': payment.backend_sub_id} payment.save() payment.user.vpnuser.add_paid_time(payment.time) diff --git a/templates/lambdainst/account.html b/templates/lambdainst/account.html index a048a05..e0b4690 100644 --- a/templates/lambdainst/account.html +++ b/templates/lambdainst/account.html @@ -21,9 +21,9 @@
{% trans "Current address" %}: {{user.email|default:"none"}}
+{% trans "Current address" %}: {{user.email|default:"-"}}