country_mode in database/ payment options

This commit is contained in:
Vladless
2025-12-10 12:44:27 +03:00
parent 82c664fa68
commit 54c8b8cee9
10 changed files with 196 additions and 91 deletions
+16
View File
@@ -11,6 +11,22 @@ from ..defaults import DEFAULT_MONEY_CONFIG
MONEY_CONFIG: dict[str, Any] = DEFAULT_MONEY_CONFIG.copy()
def get_currency_mode() -> tuple[str, bool]:
mode_cfg = MONEY_CONFIG.get("CURRENCY_MODE", "RUB")
raw = str(mode_cfg or "RUB").upper()
if raw not in ("RUB", "USD", "RUB+USD", "RUB+USD_ONE_SCREEN"):
raw = "RUB"
one_screen = raw == "RUB+USD_ONE_SCREEN"
if raw in ("RUB+USD", "RUB+USD_ONE_SCREEN"):
base_mode = "RUB+USD"
else:
base_mode = raw
return base_mode, one_screen
async def load_money_config(session: AsyncSession) -> None:
stmt = select(Setting).where(Setting.key == "MONEY_CONFIG")
result = await session.execute(stmt)