Implement payment methods management and binding functionality

- Added new handlers for managing payment methods, including viewing, binding, and deleting payment methods.
- Introduced new inline keyboard options for payment method management in user interactions.
- Enhanced the YooKassa service to support card binding with minimal payment requirements.
- Updated localization files to include new messages related to payment methods and their management.
This commit is contained in:
machka-pasla
2025-09-03 18:07:18 +03:00
parent 0f69823192
commit 5b98e1a40c
6 changed files with 222 additions and 3 deletions
+13
View File
@@ -39,3 +39,16 @@ async def upsert_yk_payment_method(
await session.flush()
await session.refresh(record)
return record
async def delete_yk_payment_method(session: AsyncSession, user_id: int) -> bool:
existing = await get_user_billing(session, user_id)
if not existing:
return False
existing.yookassa_payment_method_id = None
existing.card_last4 = None
existing.card_network = None
existing.updated_at = func.now()
await session.flush()
await session.refresh(existing)
return True