a few last minute fixes

master
Alice 4 years ago
parent 1380f21d00
commit d47f75426e

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \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" "PO-Revision-Date: 2016-04-07 01:32+0000\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
@ -283,15 +283,15 @@ msgstr "État"
msgid "Mark as cancelled (do not actually cancel)" msgid "Mark as cancelled (do not actually cancel)"
msgstr "Marquer comme annulé (n'annule pas)" 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" msgid "Payment Data"
msgstr "Données de paiement" msgstr "Données de paiement"
#: payments/admin.py:60 #: payments/admin.py:66
msgid "Amount" msgid "Amount"
msgstr "Montant" msgstr "Montant"
#: payments/admin.py:64 #: payments/admin.py:70
msgid "Paid amount" msgid "Paid amount"
msgstr "Montant payé" msgstr "Montant payé"
@ -714,13 +714,20 @@ msgstr "Voir toutes les questions"
msgid "Did you find this answer useful?" msgid "Did you find this answer useful?"
msgstr "Avez-vous trouvé cette réponse utile ?" 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 #: templates/lambdainst/account.html:31 templates/lambdainst/account.html:63
msgid "Subscription" msgid "Subscription"
msgstr "Abonnement" msgstr "Abonnement"
#: templates/lambdainst/account.html:34 #: templates/lambdainst/account.html:34
#, fuzzy, python-format #, python-format
#| msgid "<b>ACTIF</b>. Renews on %(until)s via %(backend)s."
msgid "<b>ACTIVE</b>. Renews on %(until)s via %(backend)s." msgid "<b>ACTIVE</b>. Renews on %(until)s via %(backend)s."
msgstr "<b>ACTIF</b>. Renouvellement: %(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') search_fields = ('user__username', 'user__email', 'backend_extid', 'backend_data')
def backend(self, object): 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): def backend_data_fmt(self, object):
return json_format(object.backend_data) return json_format(object.backend_data)
def backend_extid_link(self, object): def backend_extid_link(self, object):
ext_url = object.backend.get_ext_url(object) try:
return link(object.backend_extid, ext_url) 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): def amount_fmt(self, object):
return '%.2f %s' % (object.amount / 100, object.currency_name) return '%.2f %s' % (object.amount / 100, object.currency_name)

@ -147,17 +147,6 @@ class StripeBackend(BackendBase):
subscr.backend_data['subscription_id'] = sub_id subscr.backend_data['subscription_id'] = sub_id
subscr.save() 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: else:
from payments.models import Payment from payments.models import Payment
payment = Payment.objects.filter(backend_extid=session['id']).get() payment = Payment.objects.filter(backend_extid=session['id']).get()
@ -199,8 +188,8 @@ class StripeBackend(BackendBase):
if not subscr: if not subscr:
# the subscription does not exist # the subscription does not exist
# checkout.confirmed event will create it and handle the initial payment # checkout.confirmed event will create it and handle the initial payment
return True # return True
# raise Exception("Unknown subscription for invoice %r" % invoice['id']) raise Exception("Unknown subscription for invoice %r" % invoice['id'])
# Prevent making duplicate Payments if event is received twice # Prevent making duplicate Payments if event is received twice
pc = Payment.objects.filter(backend_extid=invoice['id']).count() pc = Payment.objects.filter(backend_extid=invoice['id']).count()
@ -216,7 +205,7 @@ class StripeBackend(BackendBase):
payment.backend_sub_id = invoice['subscription'] payment.backend_sub_id = invoice['subscription']
else: else:
payment.backend_sub_id = invoice['subscription']['id'] 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.save()
payment.user.vpnuser.add_paid_time(payment.time) payment.user.vpnuser.add_paid_time(payment.time)

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

@ -9,7 +9,7 @@
<div class="content-box"> <div class="content-box">
<h3>{% trans 'Change e-mail address' %}</h3> <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"> <form action="/account/settings" method="post" class="pure-form pure-form-aligned">
{% csrf_token %} {% csrf_token %}

Loading…
Cancel
Save