Increase validated size of prices

This commit is contained in:
Raphael Michel
2023-03-16 21:26:37 +01:00
parent 4c9640561c
commit e83798a9b7
3 changed files with 4 additions and 4 deletions

View File

@@ -2843,7 +2843,7 @@ class CartPosition(AbstractPosition):
# Migrate from pre-discounts position
if self.item.free_price and self.custom_price_input is None:
custom_price = self.price
if custom_price > 100000000:
if custom_price > 99_999_999_999:
raise ValueError('price_too_high')
self.custom_price_input = custom_price
self.custom_price_input_is_net = not False

View File

@@ -726,7 +726,7 @@ class CartManager:
custom_price = None
if item.free_price and i.get('price'):
custom_price = Decimal(str(i.get('price')).replace(",", "."))
if custom_price > 100000000:
if custom_price > 99_999_999_999:
raise ValueError('price_too_high')
op = self.AddOperation(
@@ -841,7 +841,7 @@ class CartManager:
custom_price = None
if item.free_price and a.get('price'):
custom_price = Decimal(str(a.get('price')).replace(",", "."))
if custom_price > 100000000:
if custom_price > 99_999_999_999:
raise ValueError('price_too_high')
# Fix positions with wrong price (TODO: happens out-of-cartmanager-transaction and therefore a little hacky)

View File

@@ -70,7 +70,7 @@ def get_price(item: Item, variation: ItemVariation = None,
elif item.free_price and custom_price is not None and custom_price != "":
if not isinstance(custom_price, Decimal):
custom_price = Decimal(str(custom_price).replace(",", "."))
if custom_price > 100000000:
if custom_price > 99_999_999_999:
raise ValueError('price_too_high')
price = tax_rule.tax(price, invoice_address=invoice_address)