2018-02-27 23:12:01 +01:00
|
|
|
|
from django import forms
|
|
|
|
|
from django.urls import reverse
|
2020-03-09 14:12:09 +01:00
|
|
|
|
from django.utils.translation import gettext_lazy as _
|
2018-02-27 23:12:01 +01:00
|
|
|
|
from pretix.base.forms import SettingsForm
|
|
|
|
|
from pretix.base.models import Event
|
2024-05-31 16:41:47 +02:00
|
|
|
|
from pretix.control.views.event import (
|
|
|
|
|
EventSettingsFormView, EventSettingsViewMixin,
|
|
|
|
|
)
|
2018-02-27 23:12:01 +01:00
|
|
|
|
|
2018-10-25 14:26:21 +02:00
|
|
|
|
|
2018-02-27 23:12:01 +01:00
|
|
|
|
class ServiceFeeSettingsForm(SettingsForm):
|
2024-05-31 16:41:47 +02:00
|
|
|
|
service_fee_abs = forms.DecimalField(label=_("Fixed fee per order"), required=False)
|
2019-04-03 15:31:16 +02:00
|
|
|
|
service_fee_percent = forms.DecimalField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_("Percentual fee per order"),
|
|
|
|
|
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."
|
|
|
|
|
),
|
|
|
|
|
required=False,
|
2019-04-03 15:31:16 +02:00
|
|
|
|
)
|
2019-05-20 14:54:27 +02:00
|
|
|
|
service_fee_per_ticket = forms.DecimalField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_("Fixed fee per ticket"),
|
|
|
|
|
help_text=_(
|
|
|
|
|
"This fee will be added for each ticket sold, except for free items and addons."
|
|
|
|
|
),
|
|
|
|
|
required=False,
|
2019-05-20 14:54:27 +02:00
|
|
|
|
)
|
2020-04-01 17:10:19 +02:00
|
|
|
|
service_fee_skip_if_gift_card = forms.BooleanField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_("Do not charge service fee on tickets paid with gift cards"),
|
|
|
|
|
help_text=_(
|
|
|
|
|
"If a gift card is used for the payment, the percentual fees will be applied on the value of the "
|
|
|
|
|
"tickets minus the value of the gift cards. All fixed fees will be dropped if the tickets can "
|
|
|
|
|
"be paid with gift cards entirely. This only works if the gift card is redeemd when the order is "
|
|
|
|
|
"submitted, not if it's used to pay an unpaid order later."
|
|
|
|
|
),
|
|
|
|
|
required=False,
|
2020-04-01 17:10:19 +02:00
|
|
|
|
)
|
2022-03-18 14:53:51 +01:00
|
|
|
|
service_fee_skip_addons = forms.BooleanField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_("Do not charge per-ticket service fee on add-on products"),
|
|
|
|
|
required=False,
|
2022-03-18 14:53:51 +01:00
|
|
|
|
)
|
2022-03-18 14:52:26 +01:00
|
|
|
|
service_fee_skip_non_admission = forms.BooleanField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_("Do not charge per-ticket service fee on non-admission products"),
|
|
|
|
|
required=False,
|
2022-03-18 14:52:26 +01:00
|
|
|
|
)
|
2022-03-31 21:19:38 +02:00
|
|
|
|
service_fee_skip_free = forms.BooleanField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_("Do not charge per-ticket service fee on free products"),
|
|
|
|
|
help_text=_(
|
|
|
|
|
"Note that regardless of this setting, a per-ticket fee will not be charged if the entire order is free."
|
|
|
|
|
),
|
|
|
|
|
required=False,
|
2022-03-31 21:19:38 +02:00
|
|
|
|
)
|
2022-09-19 17:33:27 +02:00
|
|
|
|
service_fee_split_taxes = forms.BooleanField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_(
|
|
|
|
|
"Split taxes proportionate to the tax rates and net values of the ordered products."
|
|
|
|
|
),
|
|
|
|
|
help_text=_(
|
|
|
|
|
"If not split based on ordered products, the tax rate falls back to the event’s base tax rate or no tax, if none is given."
|
|
|
|
|
),
|
|
|
|
|
required=False,
|
2022-09-19 17:33:27 +02:00
|
|
|
|
)
|
2019-05-20 14:54:27 +02:00
|
|
|
|
|
2019-05-29 09:27:24 +02:00
|
|
|
|
service_fee_abs_resellers = forms.DecimalField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_("Fixed fee per order"), required=False
|
2019-05-29 09:27:24 +02:00
|
|
|
|
)
|
2019-04-03 15:31:16 +02:00
|
|
|
|
service_fee_percent_resellers = forms.DecimalField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_("Percentual fee per order"),
|
|
|
|
|
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."
|
|
|
|
|
),
|
|
|
|
|
required=False,
|
2019-04-03 15:31:16 +02:00
|
|
|
|
)
|
2019-05-20 14:54:27 +02:00
|
|
|
|
service_fee_per_ticket_resellers = forms.DecimalField(
|
2024-05-31 16:41:47 +02:00
|
|
|
|
label=_("Fixed fee per ticket"),
|
2019-05-29 09:27:24 +02:00
|
|
|
|
required=False,
|
2024-05-31 16:41:47 +02:00
|
|
|
|
help_text=_(
|
|
|
|
|
"This fee will be added for each ticket sold, except for free items and addons."
|
|
|
|
|
),
|
2019-05-20 14:54:27 +02:00
|
|
|
|
)
|
2018-02-27 23:12:01 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SettingsView(EventSettingsViewMixin, EventSettingsFormView):
|
|
|
|
|
model = Event
|
|
|
|
|
form_class = ServiceFeeSettingsForm
|
2024-05-31 16:41:47 +02:00
|
|
|
|
template_name = "pretix_servicefees/settings.html"
|
|
|
|
|
permission = "can_change_event_settings"
|
2018-02-27 23:12:01 +01:00
|
|
|
|
|
|
|
|
|
def get_success_url(self) -> str:
|
2024-05-31 16:41:47 +02:00
|
|
|
|
return reverse(
|
|
|
|
|
"plugins:pretix_servicefees:settings",
|
|
|
|
|
kwargs={
|
|
|
|
|
"organizer": self.request.event.organizer.slug,
|
|
|
|
|
"event": self.request.event.slug,
|
|
|
|
|
},
|
|
|
|
|
)
|