Features: 1) Add currency handling logic in resolve_price_with_currency method to ensure correct conversion when the currency matches the provider or default currency;

Fixes: 1) None;

Extra: 1) None;
This commit is contained in:
Egor Pavlovich Gorbunov 2025-10-26 22:37:38 +03:00
parent b4292fde53
commit 0c990291a4

View file

@ -315,6 +315,8 @@ class AbstractVendor:
return round(price, 2) return round(price, 2)
def resolve_price_with_currency(self, price: float | int | Decimal, provider: str, currency: str = "") -> float: def resolve_price_with_currency(self, price: float | int | Decimal, provider: str, currency: str = "") -> float:
if currency == self.currency or currency == settings.CURRENCY_CODE:
return float(price)
rates = get_rates(provider) rates = get_rates(provider)
rate = rates.get(currency or self.currency) if rates else 1 rate = rates.get(currency or self.currency) if rates else 1