fix: update quote sum
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user