fix: satisfy ruff line length
This commit is contained in:
@@ -25,7 +25,10 @@ async def admin_tariffs_get_route(request: web.Request) -> web.Response:
|
|||||||
"topup_packages_default": {"rub": [], "stars": []},
|
"topup_packages_default": {"rub": [], "stars": []},
|
||||||
"tariffs": [],
|
"tariffs": [],
|
||||||
},
|
},
|
||||||
"provider_currency_support": _provider_currency_support_payload(settings, request.app),
|
"provider_currency_support": _provider_currency_support_payload(
|
||||||
|
settings,
|
||||||
|
request.app,
|
||||||
|
),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -71,7 +74,10 @@ async def admin_tariffs_save_route(request: web.Request) -> web.Response:
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def _provider_currency_support_payload(settings: Settings, app: web.Application) -> List[Dict[str, Any]]:
|
def _provider_currency_support_payload(
|
||||||
|
settings: Settings,
|
||||||
|
app: web.Application,
|
||||||
|
) -> List[Dict[str, Any]]:
|
||||||
from bot.payment_providers import iter_provider_specs, resolve_provider_presentation
|
from bot.payment_providers import iter_provider_specs, resolve_provider_presentation
|
||||||
|
|
||||||
default_currency = default_payment_currency_code_for_settings(settings)
|
default_currency = default_payment_currency_code_for_settings(settings)
|
||||||
|
|||||||
@@ -453,8 +453,9 @@ async def format_user_card(
|
|||||||
|
|
||||||
# Total revenue from referrals
|
# Total revenue from referrals
|
||||||
referral_revenue = await payment_dal.get_referral_revenue(session, user.user_id)
|
referral_revenue = await payment_dal.get_referral_revenue(session, user.user_id)
|
||||||
|
referral_revenue_text = hcode(f"{referral_revenue:.2f} {currency}")
|
||||||
card_parts.append(
|
card_parts.append(
|
||||||
f"{_('admin_user_referral_revenue_label')} {hcode(f'{referral_revenue:.2f} {currency}')}"
|
f"{_('admin_user_referral_revenue_label')} {referral_revenue_text}"
|
||||||
)
|
)
|
||||||
except Exception as e_fin:
|
except Exception as e_fin:
|
||||||
logging.error(
|
logging.error(
|
||||||
|
|||||||
@@ -640,6 +640,9 @@ SPEC = PaymentProviderSpec(
|
|||||||
presentation_class=CryptoPayPresentation,
|
presentation_class=CryptoPayPresentation,
|
||||||
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
||||||
supported_currencies_resolver=_cryptopay_supported_currencies,
|
supported_currencies_resolver=_cryptopay_supported_currencies,
|
||||||
currency_support_note="Crypto Pay supports different sets for fiat invoices and crypto invoices; CURRENCY_TYPE selects which set is active.",
|
currency_support_note=(
|
||||||
|
"Crypto Pay supports different sets for fiat invoices and crypto invoices; "
|
||||||
|
"CURRENCY_TYPE selects which set is active."
|
||||||
|
),
|
||||||
currency_support_url="https://help.crypt.bot/crypto-pay-api/",
|
currency_support_url="https://help.crypt.bot/crypto-pay-api/",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -776,6 +776,9 @@ SPEC = PaymentProviderSpec(
|
|||||||
presentation_class=FreeKassaPresentation,
|
presentation_class=FreeKassaPresentation,
|
||||||
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
||||||
supported_currencies=FREEKASSA_SUPPORTED_CURRENCIES,
|
supported_currencies=FREEKASSA_SUPPORTED_CURRENCIES,
|
||||||
currency_support_note="FreeKassa SCI documents the payment currency parameter as RUB, USD, EUR, UAH or KZT.",
|
currency_support_note=(
|
||||||
|
"FreeKassa SCI documents the payment currency parameter as "
|
||||||
|
"RUB, USD, EUR, UAH or KZT."
|
||||||
|
),
|
||||||
currency_support_url="https://docs.freekassa.net/",
|
currency_support_url="https://docs.freekassa.net/",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -894,6 +894,9 @@ SPEC = PaymentProviderSpec(
|
|||||||
supported_currencies_resolver=lambda config: getattr(
|
supported_currencies_resolver=lambda config: getattr(
|
||||||
config, "SUPPORTED_CURRENCIES", HELEKET_DEFAULT_SUPPORTED_CURRENCIES
|
config, "SUPPORTED_CURRENCIES", HELEKET_DEFAULT_SUPPORTED_CURRENCIES
|
||||||
),
|
),
|
||||||
currency_support_note="Heleket supports crypto and fiat invoice currencies, but exact availability can depend on service/account settings.",
|
currency_support_note=(
|
||||||
|
"Heleket supports crypto and fiat invoice currencies, but exact availability "
|
||||||
|
"can depend on service/account settings."
|
||||||
|
),
|
||||||
currency_support_url="https://doc.heleket.com/methods/payments/creating-invoice",
|
currency_support_url="https://doc.heleket.com/methods/payments/creating-invoice",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -823,7 +823,10 @@ SBP_SPEC = PaymentProviderSpec(
|
|||||||
manifest_fields=_CONFIG_MANIFEST
|
manifest_fields=_CONFIG_MANIFEST
|
||||||
+ _platega_presentation_manifest("Platega", "CreditCard", "PLATEGA_SBP"),
|
+ _platega_presentation_manifest("Platega", "CreditCard", "PLATEGA_SBP"),
|
||||||
supported_currencies_resolver=lambda config: getattr(config, "SUPPORTED_CURRENCIES", "RUB"),
|
supported_currencies_resolver=lambda config: getattr(config, "SUPPORTED_CURRENCIES", "RUB"),
|
||||||
currency_support_note="Platega currencies are merchant/method-specific; configure the codes enabled for your account.",
|
currency_support_note=(
|
||||||
|
"Platega currencies are merchant/method-specific; configure the codes "
|
||||||
|
"enabled for your account."
|
||||||
|
),
|
||||||
currency_support_url="https://docs.platega.io/",
|
currency_support_url="https://docs.platega.io/",
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -851,7 +854,10 @@ CRYPTO_SPEC = PaymentProviderSpec(
|
|||||||
presentation_class=PlategaCryptoPresentation,
|
presentation_class=PlategaCryptoPresentation,
|
||||||
manifest_fields=_platega_presentation_manifest("Platega", "Bitcoin", "PLATEGA_CRYPTO"),
|
manifest_fields=_platega_presentation_manifest("Platega", "Bitcoin", "PLATEGA_CRYPTO"),
|
||||||
supported_currencies_resolver=lambda config: getattr(config, "SUPPORTED_CURRENCIES", "RUB"),
|
supported_currencies_resolver=lambda config: getattr(config, "SUPPORTED_CURRENCIES", "RUB"),
|
||||||
currency_support_note="Platega currencies are merchant/method-specific; configure the codes enabled for your account.",
|
currency_support_note=(
|
||||||
|
"Platega currencies are merchant/method-specific; configure the codes "
|
||||||
|
"enabled for your account."
|
||||||
|
),
|
||||||
currency_support_url="https://docs.platega.io/",
|
currency_support_url="https://docs.platega.io/",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -681,6 +681,9 @@ SPEC = PaymentProviderSpec(
|
|||||||
presentation_class=SeverPayPresentation,
|
presentation_class=SeverPayPresentation,
|
||||||
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
||||||
supported_currencies_resolver=lambda config: getattr(config, "SUPPORTED_CURRENCIES", "RUB,USD"),
|
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.",
|
currency_support_note=(
|
||||||
|
"SeverPay PayIn requires a currency; keep this list aligned with your "
|
||||||
|
"merchant account."
|
||||||
|
),
|
||||||
currency_support_url="https://docs.severpay.io/ru/payin/create",
|
currency_support_url="https://docs.severpay.io/ru/payin/create",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1207,6 +1207,9 @@ SPEC = PaymentProviderSpec(
|
|||||||
presentation_class=WataPresentation,
|
presentation_class=WataPresentation,
|
||||||
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
||||||
supported_currencies=WATA_SUPPORTED_CURRENCIES,
|
supported_currencies=WATA_SUPPORTED_CURRENCIES,
|
||||||
currency_support_note="WATA H2H payment links and widget document RUB, USD and EUR as payment currencies.",
|
currency_support_note=(
|
||||||
|
"WATA H2H payment links and widget document RUB, USD and EUR as "
|
||||||
|
"payment currencies."
|
||||||
|
),
|
||||||
currency_support_url="https://wata.pro/api",
|
currency_support_url="https://wata.pro/api",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -895,7 +895,10 @@ async def process_successful_payment(
|
|||||||
i18n=i18n,
|
i18n=i18n,
|
||||||
user_id=user_id,
|
user_id=user_id,
|
||||||
amount=payment_value,
|
amount=payment_value,
|
||||||
currency=amount_data.get("currency", default_payment_currency_code_for_settings(settings)),
|
currency=amount_data.get(
|
||||||
|
"currency",
|
||||||
|
default_payment_currency_code_for_settings(settings),
|
||||||
|
),
|
||||||
months_for_admin=int(subscription_months) if sale_mode_base == "subscription" else 0,
|
months_for_admin=int(subscription_months) if sale_mode_base == "subscription" else 0,
|
||||||
traffic_gb_for_admin=(
|
traffic_gb_for_admin=(
|
||||||
traffic_amount_gb if is_traffic_sale_base(sale_mode_base) else None
|
traffic_amount_gb if is_traffic_sale_base(sale_mode_base) else None
|
||||||
@@ -2941,6 +2944,9 @@ SPEC = PaymentProviderSpec(
|
|||||||
presentation_class=YooKassaPresentation,
|
presentation_class=YooKassaPresentation,
|
||||||
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
manifest_fields=_CONFIG_MANIFEST + _PRESENTATION_MANIFEST,
|
||||||
supported_currencies=("RUB",),
|
supported_currencies=("RUB",),
|
||||||
currency_support_note="YooKassa public payment API examples and limits are RUB-based; treat non-RUB as unsupported unless your YooKassa contract confirms otherwise.",
|
currency_support_note=(
|
||||||
|
"YooKassa public payment API examples and limits are RUB-based; "
|
||||||
|
"treat non-RUB as unsupported unless your YooKassa contract confirms otherwise."
|
||||||
|
),
|
||||||
currency_support_url="https://yookassa.ru/developers/payment-acceptance/integration-scenarios/smart-payment",
|
currency_support_url="https://yookassa.ru/developers/payment-acceptance/integration-scenarios/smart-payment",
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -43,7 +43,11 @@ class RenewalMixin:
|
|||||||
months = sub.duration_months or 1
|
months = sub.duration_months or 1
|
||||||
currency = default_payment_currency_code_for_settings(self.settings)
|
currency = default_payment_currency_code_for_settings(self.settings)
|
||||||
amount = None
|
amount = None
|
||||||
tariffs_config = self._tariffs_config() if callable(getattr(self, "_tariffs_config", None)) else None
|
tariffs_config = (
|
||||||
|
self._tariffs_config()
|
||||||
|
if callable(getattr(self, "_tariffs_config", None))
|
||||||
|
else None
|
||||||
|
)
|
||||||
if tariffs_config and callable(getattr(self, "_resolve_tariff", None)):
|
if tariffs_config and callable(getattr(self, "_resolve_tariff", None)):
|
||||||
try:
|
try:
|
||||||
tariff = self._resolve_tariff(getattr(sub, "tariff_key", None))
|
tariff = self._resolve_tariff(getattr(sub, "tariff_key", None))
|
||||||
|
|||||||
@@ -131,7 +131,11 @@ class PackageSet(RootModel[Dict[str, List[TrafficPackage]]]):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def non_stars_currencies(self) -> List[str]:
|
def non_stars_currencies(self) -> List[str]:
|
||||||
return [currency for currency, packages in self.root.items() if currency != "stars" and packages]
|
return [
|
||||||
|
currency
|
||||||
|
for currency, packages in self.root.items()
|
||||||
|
if currency != "stars" and packages
|
||||||
|
]
|
||||||
|
|
||||||
def has_any(self) -> bool:
|
def has_any(self) -> bool:
|
||||||
return any(bool(packages) for packages in self.root.values())
|
return any(bool(packages) for packages in self.root.values())
|
||||||
|
|||||||
@@ -258,7 +258,10 @@ def test_payment_method_keyboard_filters_providers_by_payment_currency(monkeypat
|
|||||||
)
|
)
|
||||||
|
|
||||||
callbacks = [
|
callbacks = [
|
||||||
button.callback_data for row in markup.inline_keyboard for button in row if button.callback_data
|
button.callback_data
|
||||||
|
for row in markup.inline_keyboard
|
||||||
|
for button in row
|
||||||
|
if button.callback_data
|
||||||
]
|
]
|
||||||
assert "pay_wata:1:10:subscription" in callbacks
|
assert "pay_wata:1:10:subscription" in callbacks
|
||||||
assert all(not callback.startswith("pay_yk:") for callback in callbacks)
|
assert all(not callback.startswith("pay_yk:") for callback in callbacks)
|
||||||
|
|||||||
Reference in New Issue
Block a user