|
@@ -14,8 +14,9 @@ class AsaasClient
|
|
|
public function __construct(?string $apiKey = null)
|
|
public function __construct(?string $apiKey = null)
|
|
|
{
|
|
{
|
|
|
$this->baseUrl = config('services.asaas.base_url');
|
|
$this->baseUrl = config('services.asaas.base_url');
|
|
|
- // Allows overriding the API key for subaccounts
|
|
|
|
|
- $this->apiKey = $apiKey ?? config('services.asaas.api_key');
|
|
|
|
|
|
|
+ // Chave explícita (ex.: conta da unidade) tem prioridade. Sem ela, usa a
|
|
|
|
|
+ // chave da matriz resolvida do banco (UI) com fallback para o .env.
|
|
|
|
|
+ $this->apiKey = $apiKey ?? \App\Models\CompanyPaymentAccount::resolveApiKey();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected function request(): PendingRequest
|
|
protected function request(): PendingRequest
|