Add option to charge fee on free products (#22)

This commit is contained in:
Raphael Michel 2022-03-31 21:19:38 +02:00 committed by GitHub
parent 870999729b
commit 30e55b5b8e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 2 deletions

View file

@ -32,6 +32,9 @@ def navbar_settings(sender, request, **kwargs):
def get_fees(event, total, invoice_address, mod='', request=None, positions=[], gift_cards=None):
if request is not None and not positions:
positions = get_cart(request)
skip_free = event.settings.get('service_fee_skip_free', as_type=bool)
if skip_free:
positions = [pos for pos in positions if pos.price != Decimal('0.00')]
skip_addons = event.settings.get('service_fee_skip_addons', as_type=bool)
@ -163,3 +166,4 @@ def order_meta_signal(sender: Event, request: HttpRequest, **kwargs):
settings_hierarkey.add_default('service_fee_skip_addons', 'True', bool)
settings_hierarkey.add_default('service_fee_skip_free', 'True', bool)

View file

@ -11,6 +11,7 @@
{% bootstrap_field form.service_fee_per_ticket addon_after=request.event.currency layout="control" %}
{% bootstrap_field form.service_fee_skip_non_admission layout="control" %}
{% bootstrap_field form.service_fee_skip_addons layout="control" %}
{% bootstrap_field form.service_fee_skip_free layout="control" %}
{% bootstrap_field form.service_fee_abs addon_after=request.event.currency layout="control" %}
{% bootstrap_field form.service_fee_percent addon_after="%" layout="control" %}
{% bootstrap_field form.service_fee_skip_if_gift_card layout="control" %}

View file

@ -41,6 +41,11 @@ class ServiceFeeSettingsForm(SettingsForm):
label=_('Do not charge per-ticket service fee on non-admission products'),
required=False
)
service_fee_skip_free = forms.BooleanField(
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
)
service_fee_abs_resellers = forms.DecimalField(
label=_('Fixed fee per order'),