Fix Paddle customer lookup for billing

This commit is contained in:
Codex Agent
2025-12-22 15:55:01 +01:00
parent d78ed0961b
commit 526e59dc27
4 changed files with 156 additions and 6 deletions

View File

@@ -32,10 +32,19 @@ class TenantBillingController extends Controller
}
if (! $tenant->paddle_customer_id) {
return response()->json([
'data' => [],
'message' => 'Tenant has no Paddle customer identifier.',
]);
try {
$this->paddleCustomers->ensureCustomerId($tenant);
} catch (\Throwable $exception) {
Log::warning('Failed to resolve Paddle customer for tenant', [
'tenant_id' => $tenant->id,
'error' => $exception->getMessage(),
]);
return response()->json([
'data' => [],
'message' => 'Failed to resolve Paddle customer.',
], 502);
}
}
$cursor = $request->query('cursor');