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:
Raphael Michel
2024-04-22 16:22:30 +02:00
committed by GitHub
parent 79d59553d7
commit 0f696f42f6
5 changed files with 45 additions and 1 deletions

View File

@@ -1586,6 +1586,9 @@ class OrderCreateSerializer(I18nAwareModelSerializer):
if order.total == Decimal('0.00') and validated_data.get('status') == Order.STATUS_PAID and not payment_provider:
payment_provider = 'free'
if order.total != Decimal('0.00') and order.event.currency == "XXX":
raise ValidationError('Paid products not supported without a valid currency.')
if order.total == Decimal('0.00') and validated_data.get('status') != Order.STATUS_PAID and not validated_data.get('require_approval'):
order.status = Order.STATUS_PAID
order.save()