freeleaps-service-hub/apps/payment/backend/business/payment_manager.py
2024-11-18 22:01:54 -08:00

29 lines
1022 B
Python

from typing import Dict, Optional
from backend.services.project.models import ProjectDoc
from backend.services.payment.models import IncomeProfileDoc
class PaymentManager:
def __init__(self) -> None:
pass
async def fetch_wechat_qr_code(self, project_id: str) -> Optional[Dict[str, any]]:
project = await ProjectDoc.get(project_id)
proposer = project.proposer_id
income_profile = await IncomeProfileDoc.find_one(
IncomeProfileDoc.user_id == proposer
)
if income_profile:
return income_profile.bank_account.money_collecting_methods[
0
].wechat_qr_code
return None
async def fetch_stripe_account_id(self, user_id: str) -> Optional[str]:
income_profile = await IncomeProfileDoc.find_one(IncomeProfileDoc.user_id == user_id)
if income_profile:
return income_profile.bank_account.money_collecting_methods[
0
].stripe_account_id
return None