a few last minute fixes

master
Alice 4 years ago
parent 1380f21d00
commit d47f75426e

@ -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 "<b>ACTIF</b>. Renews on %(until)s via %(backend)s."
#, python-format
msgid "<b>ACTIVE</b>. Renews on %(until)s via %(backend)s."
msgstr "<b>ACTIF</b>. Renouvellement: %(until)s via %(backend)s"

@ -46,14 +46,20 @@ class PaymentAdmin(admin.ModelAdmin):
search_fields = ('user__username', 'user__email', 'backend_extid', 'backend_data')
def backend(self, object):
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):
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)

@ -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)

@ -21,9 +21,9 @@
<td>{% trans "Status" %}</td>
<td class="account-status__status">
{% if user.vpnuser.is_paid %}
ACTIVE
{% trans "ACTIVE" %}
{% else %}
INACTIVE
{% trans "INACTIVE" %}
{% endif %}
</td>
</tr>

@ -9,7 +9,7 @@
<div class="content-box">
<h3>{% trans 'Change e-mail address' %}</h3>
<p>{% trans "Current address" %}: {{user.email|default:"none"}}</p>
<p>{% trans "Current address" %}: {{user.email|default:"-"}}</p>
<form action="/account/settings" method="post" class="pure-form pure-form-aligned">
{% csrf_token %}

Loading…
Cancel
Save