Features: 1) Add logging warning to update_currencies_to_euro for deprecation notice.

Fixes: 1) None.

Extra: 1) Remove deprecated payment gateway configuration settings; 2) Refactor `EXCHANGE_RATE_API_KEY` usage into `COMPANY_CONFIGURATION` group; 3) Add logging import to `currencies.py` module.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-11-10 11:37:40 +03:00
parent 4f885f45a8
commit dd2922e3e6
2 changed files with 5 additions and 11 deletions

View file

@ -1,11 +1,15 @@
import logging
from decimal import Decimal
import requests
from constance import config
from django.core.cache import cache
logger = logging.getLogger(__name__)
def update_currencies_to_euro(currency: str, amount: str | float | int | Decimal) -> float:
logger.warning("update_currencies_to_euro will be deprecated soon!")
rates = cache.get("rates", None)
if not rates:

View file

@ -33,10 +33,6 @@ CONSTANCE_CONFIG = OrderedDict(
("EMAIL_HOST_USER", (getenv("EMAIL_HOST_USER", "no-user@fix.this"), _("SMTP username"))),
("EMAIL_HOST_PASSWORD", (getenv("EMAIL_HOST_PASSWORD", "SUPERsecretPASSWORD"), _("SMTP password"))),
("EMAIL_FROM", (getenv("EMAIL_FROM", "eVibes"), _("Mail from option"))),
("PAYMENT_GATEWAY_URL", (getenv("PAYMENT_GATEWAY_URL", "http://404.org"), _("Payment gateway URL"))),
("PAYMENT_GATEWAY_TOKEN", (getenv("PAYMENT_GATEWAY_TOKEN", "example token"), _("Payment gateway token"))),
("PAYMENT_GATEWAY_MINIMUM", (getenv("PAYMENT_GATEWAY_MINIMUM", 5.0), _("Payment gateway minimum amount"))),
("PAYMENT_GATEWAY_MAXIMUM", (getenv("PAYMENT_GATEWAY_MAXIMUM", 500.0), _("Payment gateway maximum amount"))),
("EXCHANGE_RATE_API_KEY", (getenv("EXCHANGE_RATE_API_KEY", "example token"), _("Exchange rate API key"))),
("NOMINATIM_URL", (getenv("NOMINATIM_URL", ""), _("OpenStreetMap Nominatim API URL"))),
("OPENAI_API_KEY", (getenv("OPENAI_API_KEY", "example key"), _("OpenAI API Key"))),
@ -61,6 +57,7 @@ CONSTANCE_CONFIG_FIELDSETS = OrderedDict(
"COMPANY_NAME",
"COMPANY_ADDRESS",
"COMPANY_PHONE_NUMBER",
"EXCHANGE_RATE_API_KEY",
),
gettext_noop("Email Options"): (
"EMAIL_BACKEND",
@ -72,13 +69,6 @@ CONSTANCE_CONFIG_FIELDSETS = OrderedDict(
"EMAIL_HOST_PASSWORD",
"EMAIL_FROM",
),
gettext_noop("Payment Gateway Options"): (
"PAYMENT_GATEWAY_URL",
"PAYMENT_GATEWAY_TOKEN",
"EXCHANGE_RATE_API_KEY",
"PAYMENT_GATEWAY_MINIMUM",
"PAYMENT_GATEWAY_MAXIMUM",
),
gettext_noop("Features Options"): (
"TELEGRAM_API_TOKEN",
"DAYS_TO_STORE_ANON_MSGS",