fix(api): Add automatic token refresh on 401 errors in GoCardless service.

- Add _make_authenticated_request helper that automatically handles 401 errors
- Clear token cache and retry once when encountering expired tokens
- Refactor all API methods to use centralized request handling
- Fix banks API to properly handle institutions response structure
- Eliminates need for container restarts when tokens expire

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Elisiário Couto
2025-09-24 14:58:45 +01:00
parent d211a14703
commit 36d698f7ce
2 changed files with 44 additions and 55 deletions

View File

@@ -32,7 +32,7 @@ async def get_bank_institutions(
countries=inst["countries"],
logo=inst.get("logo"),
)
for inst in institutions_data
for inst in institutions_data.get("results", [])
]
return APIResponse(