Merge branch 'main' into storefront-nuxt

This commit is contained in:
Egor Pavlovich Gorbunov 2025-11-12 13:15:04 +03:00
commit ddb12b75c4

View file

@ -1,6 +1,5 @@
from datetime import datetime, time
from constance import config
from django.conf import settings
from django.contrib.postgres.indexes import GinIndex
from django.db.models import (
@ -48,17 +47,10 @@ class Transaction(NiceModel):
)
def save(self, **kwargs):
if self.amount != 0.0 and (
(config.PAYMENT_GATEWAY_MINIMUM <= self.amount <= config.PAYMENT_GATEWAY_MAXIMUM)
or (config.PAYMENT_GATEWAY_MINIMUM == 0 and config.PAYMENT_GATEWAY_MAXIMUM == 0)
):
if len(str(self.amount).split(".")[1]) > 2:
self.amount = round(self.amount, 2)
super().save(**kwargs)
return self
raise ValueError(
_(f"transaction amount must fit into {config.PAYMENT_GATEWAY_MINIMUM}-{config.PAYMENT_GATEWAY_MAXIMUM}")
)
class Meta:
verbose_name = _("transaction")