2026.06.04 frontend építés közben
This commit is contained in:
92
backend/complete_kyc_script.py
Normal file
92
backend/complete_kyc_script.py
Normal file
@@ -0,0 +1,92 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Complete KYC for User 55 with test data
|
||||
"""
|
||||
import asyncio
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
from datetime import datetime
|
||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
||||
|
||||
from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from app.services.auth_service import AuthService
|
||||
from app.core.config import settings
|
||||
from app.schemas.auth import UserKYCComplete
|
||||
|
||||
async def complete_kyc_for_user_55():
|
||||
# Create database connection
|
||||
engine = create_async_engine(settings.DATABASE_URL, echo=False)
|
||||
async_session = sessionmaker(engine, class_=AsyncSession, expire_on_commit=False)
|
||||
|
||||
async with async_session() as db:
|
||||
print("🔍 Completing KYC for User 55")
|
||||
|
||||
# Prepare KYC data
|
||||
kyc_data = UserKYCComplete(
|
||||
phone_number="+36301234567",
|
||||
address_zip="1234",
|
||||
address_city="Budapest",
|
||||
address_street_name="Teszt utca",
|
||||
address_street_type="utca",
|
||||
address_house_number="1",
|
||||
address_hrsz=None,
|
||||
mothers_last_name="Teszt",
|
||||
mothers_first_name="Anya",
|
||||
birth_place="Budapest",
|
||||
birth_date=datetime(1990, 1, 1).date(),
|
||||
identity_docs={
|
||||
"ID_CARD": {
|
||||
"number": "123456AB",
|
||||
"expiry_date": "2030-01-01"
|
||||
}
|
||||
},
|
||||
ice_contact={
|
||||
"name": "Teszt ICE Kapcsolat",
|
||||
"phone": "+36309876543",
|
||||
"relationship": "családtag"
|
||||
},
|
||||
preferred_currency="HUF"
|
||||
)
|
||||
|
||||
print(f"KYC data: {kyc_data.model_dump_json(indent=2)}")
|
||||
|
||||
# Call the complete_kyc method
|
||||
try:
|
||||
user = await AuthService.complete_kyc(db, 55, kyc_data)
|
||||
|
||||
if user:
|
||||
print("✅ KYC completion successful!")
|
||||
print(f"User 55 status after KYC:")
|
||||
print(f" - is_active: {user.is_active}")
|
||||
print(f" - person_id: {user.person_id}")
|
||||
print(f" - scope_id: {user.scope_id}")
|
||||
|
||||
# Check person details
|
||||
from sqlalchemy import select
|
||||
from app.models.identity import Person
|
||||
|
||||
result = await db.execute(select(Person).where(Person.id == user.person_id))
|
||||
person = result.scalar_one_or_none()
|
||||
|
||||
if person:
|
||||
print(f"Person {person.id} details:")
|
||||
print(f" - phone: {person.phone}")
|
||||
print(f" - address_id: {person.address_id}")
|
||||
print(f" - is_active: {person.is_active}")
|
||||
|
||||
return True
|
||||
else:
|
||||
print("❌ KYC completion failed - user not found")
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
print(f"❌ KYC completion error: {e}")
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
result = asyncio.run(complete_kyc_for_user_55())
|
||||
sys.exit(0 if result else 1)
|
||||
Reference in New Issue
Block a user