fix: apply ruff formatting
This commit is contained in:
@@ -671,10 +671,7 @@ async def device_topup_options_route(request: web.Request) -> web.Response:
|
||||
default_packages = packages.for_currency(default_currency)
|
||||
else:
|
||||
default_packages = getattr(packages, default_currency, []) if packages else []
|
||||
currency_counts = {
|
||||
int(package.count)
|
||||
for package in default_packages
|
||||
}
|
||||
currency_counts = {int(package.count) for package in default_packages}
|
||||
stars_counts = {int(package.count) for package in (packages.stars if packages else [])}
|
||||
plans = []
|
||||
for count in sorted(currency_counts | stars_counts):
|
||||
|
||||
@@ -454,9 +454,7 @@ async def format_user_card(
|
||||
# Total revenue from referrals
|
||||
referral_revenue = await payment_dal.get_referral_revenue(session, user.user_id)
|
||||
referral_revenue_text = hcode(f"{referral_revenue:.2f} {currency}")
|
||||
card_parts.append(
|
||||
f"{_('admin_user_referral_revenue_label')} {referral_revenue_text}"
|
||||
)
|
||||
card_parts.append(f"{_('admin_user_referral_revenue_label')} {referral_revenue_text}")
|
||||
except Exception as e_fin:
|
||||
logging.error(
|
||||
f"Failed to build financial analytics for admin card {user.user_id}: {e_fin}"
|
||||
|
||||
@@ -777,8 +777,7 @@ SPEC = PaymentProviderSpec(
|
||||
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
||||
supported_currencies=FREEKASSA_SUPPORTED_CURRENCIES,
|
||||
currency_support_note=(
|
||||
"FreeKassa SCI documents the payment currency parameter as "
|
||||
"RUB, USD, EUR, UAH or KZT."
|
||||
"FreeKassa SCI documents the payment currency parameter as RUB, USD, EUR, UAH or KZT."
|
||||
),
|
||||
currency_support_url="https://docs.freekassa.net/",
|
||||
)
|
||||
|
||||
@@ -682,8 +682,7 @@ SPEC = PaymentProviderSpec(
|
||||
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
||||
supported_currencies_resolver=lambda config: getattr(config, "SUPPORTED_CURRENCIES", "RUB,USD"),
|
||||
currency_support_note=(
|
||||
"SeverPay PayIn requires a currency; keep this list aligned with your "
|
||||
"merchant account."
|
||||
"SeverPay PayIn requires a currency; keep this list aligned with your merchant account."
|
||||
),
|
||||
currency_support_url="https://docs.severpay.io/ru/payin/create",
|
||||
)
|
||||
|
||||
@@ -1208,8 +1208,7 @@ SPEC = PaymentProviderSpec(
|
||||
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
||||
supported_currencies=WATA_SUPPORTED_CURRENCIES,
|
||||
currency_support_note=(
|
||||
"WATA H2H payment links and widget document RUB, USD and EUR as "
|
||||
"payment currencies."
|
||||
"WATA H2H payment links and widget document RUB, USD and EUR as payment currencies."
|
||||
),
|
||||
currency_support_url="https://wata.pro/api",
|
||||
)
|
||||
|
||||
@@ -248,10 +248,9 @@ class SubscriptionLifecycleMixin:
|
||||
traffic_used_bytes=used_sub,
|
||||
)
|
||||
update_data["period_start_at"] = None
|
||||
update_data["effective_monthly_price_rub"] = (
|
||||
target.period_price(1, default_currency_key_for_settings(self.settings))
|
||||
or target.min_period_price(default_currency_key_for_settings(self.settings))
|
||||
)
|
||||
update_data["effective_monthly_price_rub"] = target.period_price(
|
||||
1, default_currency_key_for_settings(self.settings)
|
||||
) or target.min_period_price(default_currency_key_for_settings(self.settings))
|
||||
if mode == "recalc_days" and options.get("recalc_days") is not None:
|
||||
update_data["end_date"] = now + timedelta(days=int(options["recalc_days"]))
|
||||
else:
|
||||
|
||||
@@ -44,9 +44,7 @@ class RenewalMixin:
|
||||
currency = default_payment_currency_code_for_settings(self.settings)
|
||||
amount = None
|
||||
tariffs_config = (
|
||||
self._tariffs_config()
|
||||
if callable(getattr(self, "_tariffs_config", None))
|
||||
else None
|
||||
self._tariffs_config() if callable(getattr(self, "_tariffs_config", None)) else None
|
||||
)
|
||||
if tariffs_config and callable(getattr(self, "_resolve_tariff", None)):
|
||||
try:
|
||||
|
||||
@@ -132,9 +132,7 @@ class PackageSet(RootModel[Dict[str, List[TrafficPackage]]]):
|
||||
@property
|
||||
def non_stars_currencies(self) -> List[str]:
|
||||
return [
|
||||
currency
|
||||
for currency, packages in self.root.items()
|
||||
if currency != "stars" and packages
|
||||
currency for currency, packages in self.root.items() if currency != "stars" and packages
|
||||
]
|
||||
|
||||
def has_any(self) -> bool:
|
||||
|
||||
@@ -350,7 +350,6 @@ def test_webapp_payment_methods_filter_by_default_currency(monkeypatch):
|
||||
assert [method["id"] for method in methods] == ["wata"]
|
||||
|
||||
|
||||
|
||||
def test_admin_only_provider_toggle_pairs_are_declared():
|
||||
pairs = set(provider_admin_only_pairs())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user