mirror of
https://github.com/pretix/pretix.git
synced 2026-05-05 15:14:04 +00:00
Do not allow currency codes that to not represent money (#4056)
* Do not allow currency codes that to not represent money * Rebase migration * Fix blacklist
This commit is contained in:
@@ -199,6 +199,7 @@ error_messages = {
|
||||
),
|
||||
'addon_no_multi': gettext_lazy('You can select every add-on from the category %(cat)s for the product %(base)s at most once.'),
|
||||
'addon_already_checked_in': gettext_lazy('You cannot remove the position %(addon)s since it has already been checked in.'),
|
||||
'currency_XXX': gettext_lazy('Paid products not supported without a valid currency.'),
|
||||
}
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -1129,6 +1130,9 @@ def _perform_order(event: Event, payment_requests: List[dict], position_ids: Lis
|
||||
id__in=position_ids, event=event
|
||||
)
|
||||
|
||||
if shown_total is not None and Decimal(shown_total) > Decimal("0.00") and event.currency == "XXX":
|
||||
raise OrderError(error_messages['currency_XXX'])
|
||||
|
||||
validate_order.send(
|
||||
event,
|
||||
payment_provider=payment_requests[0]['provider'] if payment_requests else None, # only for backwards compatibility
|
||||
@@ -2125,6 +2129,9 @@ class OrderChangeManager:
|
||||
)
|
||||
|
||||
def _check_paid_to_free(self):
|
||||
if self.event.currency == 'XXX' and self.order.total + self._totaldiff > Decimal("0.00"):
|
||||
raise OrderError(error_messages['currency_XXX'])
|
||||
|
||||
if self.order.total == 0 and (self._totaldiff < 0 or (self.split_order and self.split_order.total > 0)) and not self.order.require_approval:
|
||||
if not self.order.fees.exists() and not self.order.positions.exists():
|
||||
# The order is completely empty now, so we cancel it.
|
||||
|
||||
Reference in New Issue
Block a user