Add service fees based on order volume

This commit is contained in:
Thomas Hollstegge 2019-04-03 14:58:57 +02:00
parent 089eec77ac
commit c2e5dff72b
18 changed files with 134 additions and 4 deletions

View file

@ -45,5 +45,13 @@ msgid "Service fee"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr ""
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr ""

View file

@ -45,5 +45,13 @@ msgid "Service fee"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr ""
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr ""

View file

@ -48,5 +48,13 @@ msgid "Service fee"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr ""
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr ""

View file

@ -45,5 +45,13 @@ msgid "Service fee"
msgstr "Servicegebühr" msgstr "Servicegebühr"
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr "Servicegebühr (%)"
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "Servicegebühr für Vorverkaufsstellen" msgstr "Servicegebühr für Vorverkaufsstellen"
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr "Servicegebühr für Vorverkaufsstellen (%)"

View file

@ -45,5 +45,13 @@ msgid "Service fee"
msgstr "Servicegebühr" msgstr "Servicegebühr"
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr "Servicegebühr (%)"
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "Servicegebühr für Vorverkaufsstellen" msgstr "Servicegebühr für Vorverkaufsstellen"
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr "Servicegebühr für Vorverkaufsstellen (%)"

View file

@ -46,5 +46,13 @@ msgid "Service fee"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr ""
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr ""

View file

@ -45,5 +45,13 @@ msgid "Service fee"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr ""
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr ""

View file

@ -48,5 +48,13 @@ msgid "Service fee"
msgstr "Tarifa por servicio" msgstr "Tarifa por servicio"
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr "Tarifa por servicio (%)"
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr ""

View file

@ -48,7 +48,15 @@ msgid "Service fee"
msgstr "Frais de service" msgstr "Frais de service"
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr "Frais de service (%)"
#: pretix_servicefees/views.py:13
#, fuzzy #, fuzzy
#| msgid "Service fees" #| msgid "Service fees"
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "Frais de service" msgstr "Frais de service"
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr "Frais de service (%)"

View file

@ -45,5 +45,13 @@ msgid "Service fee"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr ""
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr ""

View file

@ -50,5 +50,13 @@ msgid "Service fee"
msgstr "Servicekosten" msgstr "Servicekosten"
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr "Servicekosten (%)"
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "Servicekosten voor wederverkopers" msgstr "Servicekosten voor wederverkopers"
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr "Servicekosten voor wederverkopers (%)"

View file

@ -45,5 +45,13 @@ msgid "Service fee"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr ""
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr ""

View file

@ -50,5 +50,13 @@ msgid "Service fee"
msgstr "Servicekosten" msgstr "Servicekosten"
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr "Servicekosten (%)"
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "Servicekosten voor wederverkopers" msgstr "Servicekosten voor wederverkopers"
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr "Servicekosten voor wederverkopers (%)"

View file

@ -45,5 +45,13 @@ msgid "Service fee"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr ""
#: pretix_servicefees/views.py:13
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "" msgstr ""
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr ""

View file

@ -50,7 +50,15 @@ msgid "Service fee"
msgstr "Servis ücreti" msgstr "Servis ücreti"
#: pretix_servicefees/views.py:12 #: pretix_servicefees/views.py:12
msgid "Service fee (%)"
msgstr "Servis ücreti (%)"
#: pretix_servicefees/views.py:13
#, fuzzy #, fuzzy
#| msgid "Service fees" #| msgid "Service fees"
msgid "Service fee with resellers" msgid "Service fee with resellers"
msgstr "Servis ücretleri" msgstr "Servis ücretleri"
#: pretix_servicefees/views.py:14
msgid "Service fee with resellers (%)"
msgstr "Servis ücretleri (%)"

View file

@ -26,10 +26,16 @@ def navbar_settings(sender, request, **kwargs):
def get_fees(event, total, invoice_address, mod=''): def get_fees(event, total, invoice_address, mod=''):
fee = event.settings.get('service_fee_abs' + mod, as_type=Decimal) fee_abs = event.settings.get('service_fee_abs' + mod, as_type=Decimal)
if mod and fee is None: if mod and fee_abs is None:
fee = event.settings.get('service_fee_abs', as_type=Decimal) fee_abs = event.settings.get('service_fee_abs', as_type=Decimal)
if fee and total != Decimal('0.00'):
fee_percent = event.settings.get('service_fee_percent' + mod, as_type=Decimal)
if mod and fee_percent is None:
fee_percent = event.settings.get('service_fee_percent', as_type=Decimal)
if fee_abs and fee_percent and total != Decimal('0.00'):
fee = fee_abs + total * (fee_percent / 100)
tax_rule = event.settings.tax_rate_default or TaxRule.zero() tax_rule = event.settings.tax_rate_default or TaxRule.zero()
if tax_rule.tax_applicable(invoice_address): if tax_rule.tax_applicable(invoice_address):
tax = tax_rule.tax(fee) tax = tax_rule.tax(fee)

View file

@ -8,7 +8,9 @@
{% bootstrap_form_errors form %} {% bootstrap_form_errors form %}
<fieldset> <fieldset>
{% bootstrap_field form.service_fee_abs layout="control" %} {% bootstrap_field form.service_fee_abs layout="control" %}
{% bootstrap_field form.service_fee_percent layout="control" %}
{% bootstrap_field form.service_fee_abs_resellers layout="control" %} {% bootstrap_field form.service_fee_abs_resellers layout="control" %}
{% bootstrap_field form.service_fee_percent_resellers layout="control" %}
</fieldset> </fieldset>
<div class="form-group submit-group"> <div class="form-group submit-group">
<button type="submit" class="btn btn-primary btn-save"> <button type="submit" class="btn btn-primary btn-save">

View file

@ -9,7 +9,9 @@ from pretix.control.views.event import EventSettingsViewMixin, EventSettingsForm
class ServiceFeeSettingsForm(SettingsForm): class ServiceFeeSettingsForm(SettingsForm):
service_fee_abs = forms.DecimalField(label=_('Service fee')) service_fee_abs = forms.DecimalField(label=_('Service fee'))
service_fee_percent = forms.DecimalField(label=_('Service fee (%)'))
service_fee_abs_resellers = forms.DecimalField(label=_('Service fee with resellers')) service_fee_abs_resellers = forms.DecimalField(label=_('Service fee with resellers'))
service_fee_percent_resellers = forms.DecimalField(label=_('Service fee with resellers (%)'))
class SettingsView(EventSettingsViewMixin, EventSettingsFormView): class SettingsView(EventSettingsViewMixin, EventSettingsFormView):