fix: gate PayKilla by minimum payment amount

This commit is contained in:
3252a8
2026-06-04 16:21:10 +03:00
parent bdf0622be5
commit ae7bfb9621
15 changed files with 567 additions and 25 deletions
+16
View File
@@ -1052,6 +1052,22 @@ async def _create_subscription_payment(
"unsupported_currency",
"Payment method does not support this currency",
)
if not provider_spec.is_usable_for_payment_amount(
settings,
payment_currency,
price,
):
logger.warning(
"WebApp payment method does not support amount: method=%s amount=%s currency=%s",
method,
price,
payment_currency,
)
return _json_error(
400,
"payment_amount_below_minimum",
"Payment amount is below the provider minimum",
)
return await provider_spec.create_webapp_payment(
WebAppPaymentContext(
request=request,
+9 -7
View File
@@ -943,13 +943,15 @@ def _serialize_payment_methods(
and spec.is_usable_for_payment_currency(settings, payment_currency)
):
presentation = resolve_provider_presentation(spec, settings, language=lang)
methods.append(
{
"id": method,
"name": presentation.webapp_label,
"icon": presentation.webapp_icon,
}
)
payload = {
"id": method,
"name": presentation.webapp_label,
"icon": presentation.webapp_icon,
}
minimum = spec.payment_minimum(settings, payment_currency)
if minimum:
payload.update(minimum)
methods.append(payload)
return methods