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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user