Update routes/hello.py
Browse files- routes/hello.py +5 -12
routes/hello.py
CHANGED
@@ -40,18 +40,11 @@ def create_account(account_data: AccountRequest):
|
|
40 |
def check_onboarding(account_id: str):
|
41 |
try:
|
42 |
account = stripe.Account.retrieve(account_id)
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
# Se a conta tiver pelo menos um banco vinculado, consideramos como onboarding concluído
|
49 |
-
bank_accounts = account.external_accounts.list(object="bank_account")
|
50 |
-
if len(bank_accounts.data) > 0:
|
51 |
-
return {"status": "complete"}
|
52 |
-
|
53 |
-
# Caso contrário, onboarding ainda tem pendências
|
54 |
-
return {"status": "incomplete", "reason": "Onboarding not fully completed"}
|
55 |
|
56 |
except Exception as e:
|
57 |
raise HTTPException(status_code=500, detail=str(e))
|
|
|
40 |
def check_onboarding(account_id: str):
|
41 |
try:
|
42 |
account = stripe.Account.retrieve(account_id)
|
43 |
+
|
44 |
+
if account.requirements.currently_due:
|
45 |
+
return {"status": "incomplete", "pending_requirements": account.requirements.currently_due}
|
46 |
+
|
47 |
+
return {"status": "complete"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
except Exception as e:
|
50 |
raise HTTPException(status_code=500, detail=str(e))
|