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:
parent
b4292fde53
commit
0c990291a4
1 changed files with 2 additions and 0 deletions
2
core/vendors/__init__.py
vendored
2
core/vendors/__init__.py
vendored
|
|
@ -315,6 +315,8 @@ class AbstractVendor:
|
|||
return round(price, 2)
|
||||
|
||||
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)
|
||||
|
||||
rate = rates.get(currency or self.currency) if rates else 1
|
||||
|
|
|
|||
Loading…
Reference in a new issue