From 20e0dc6db69d4000864c3ae16bc79d0c90aa5aec Mon Sep 17 00:00:00 2001 From: Noloquideus Date: Tue, 16 Jun 2026 18:54:21 +0300 Subject: [PATCH] fix: update quote sum --- src/application/services/payment_quote_service.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/application/services/payment_quote_service.py b/src/application/services/payment_quote_service.py index 631c151..b45648d 100644 --- a/src/application/services/payment_quote_service.py +++ b/src/application/services/payment_quote_service.py @@ -142,13 +142,11 @@ class PaymentQuoteService: usdt_exchange_rate, gas_fee = await self._load_prices() - u_budget = ((total_rub - gas_fee) / usdt_exchange_rate).quantize(Decimal('0.01'), rounding=ROUND_DOWN) u_cap = ((_MAX_TOTAL_RUB - gas_fee) / (usdt_exchange_rate * Decimal('1.04'))).quantize( Decimal('0.01'), rounding=ROUND_DOWN, ) - u_upper = min(u_budget, u_cap) - n_hi = int((u_upper * 100).to_integral_value(rounding=ROUND_DOWN)) + n_hi = int((u_cap * 100).to_integral_value(rounding=ROUND_DOWN)) if n_hi < 1: raise OrderTotalOutOfRangeException( message='Order total is below minimum allowed amount', @@ -163,15 +161,15 @@ class PaymentQuoteService: if quote is None: n_hi = mid - 1 continue - if quote.total_price <= total_rub: + if quote.total_price >= total_rub: best_cent = mid - n_lo = mid + 1 - else: n_hi = mid - 1 + else: + n_lo = mid + 1 if best_cent is None: raise OrderTotalOutOfRangeException( - message='Order total is below minimum allowed amount', + message='Order total exceeds maximum allowed amount', ) final = self._compose_quote(