mirror of
https://github.com/pretix/pretix-servicefees.git
synced 2024-11-27 16:30:21 +01:00
Merge pull request #10 from labtwentyfive/add-relative-service-fees
Allow for service fees based on order total
This commit is contained in:
commit
54025208aa
18 changed files with 145 additions and 4 deletions
|
@ -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 ""
|
||||||
|
|
|
@ -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 ""
|
||||||
|
|
|
@ -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 ""
|
||||||
|
|
|
@ -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 (%)"
|
||||||
|
|
|
@ -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 (%)"
|
||||||
|
|
|
@ -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 ""
|
||||||
|
|
|
@ -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 ""
|
||||||
|
|
|
@ -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 ""
|
||||||
|
|
|
@ -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 (%)"
|
||||||
|
|
|
@ -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 ""
|
||||||
|
|
|
@ -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 (%)"
|
||||||
|
|
|
@ -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 ""
|
||||||
|
|
|
@ -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 (%)"
|
||||||
|
|
|
@ -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 ""
|
||||||
|
|
|
@ -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 (%)"
|
||||||
|
|
|
@ -4,6 +4,7 @@ from django.urls import resolve, reverse
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.http import HttpRequest
|
from django.http import HttpRequest
|
||||||
from django.utils.translation import ugettext_lazy as _, ugettext, get_language
|
from django.utils.translation import ugettext_lazy as _, ugettext, get_language
|
||||||
|
from pretix.base.decimal import round_decimal
|
||||||
from pretix.base.models import Event, Order, TaxRule
|
from pretix.base.models import Event, Order, TaxRule
|
||||||
from pretix.base.models.orders import OrderFee
|
from pretix.base.models.orders import OrderFee
|
||||||
from pretix.base.signals import order_fee_calculation
|
from pretix.base.signals import order_fee_calculation
|
||||||
|
@ -26,10 +27,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 = round_decimal(fee_abs + total * (fee_percent / 100), event.currency)
|
||||||
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)
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -9,7 +9,19 @@ 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 (%)'),
|
||||||
|
help_text=_('Percentage of the order total. Note that this percentage will currently only '
|
||||||
|
'be calculated on the summed price of sold tickets, not on other fees like e.'
|
||||||
|
'g. shipping fees, if there are any.')
|
||||||
|
)
|
||||||
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 (%)'),
|
||||||
|
help_text=_('Percentage of the order total. Note that this percentage will currently only '
|
||||||
|
'be calculated on the summed price of sold tickets, not on other fees like e.'
|
||||||
|
'g. shipping fees, if there are any.')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class SettingsView(EventSettingsViewMixin, EventSettingsFormView):
|
class SettingsView(EventSettingsViewMixin, EventSettingsFormView):
|
||||||
|
|
Loading…
Reference in a new issue