feat: add client method to BaseIntegrationService for pre-configured HTTP client and implement test for client functionality

This commit is contained in:
2026-07-06 08:50:52 -03:00
parent 387e136707
commit 1af5b1d7ed
2 changed files with 66 additions and 0 deletions

View File

@@ -4,6 +4,8 @@ namespace App\Domains\Integration\Services;
use App\Domains\Integration\Models\Integration;
use App\Domains\Integration\Models\TenantIntegration;
use Illuminate\Support\Facades\Http;
use Illuminate\Http\Client\PendingRequest;
use Exception;
abstract class BaseIntegrationService
@@ -132,6 +134,18 @@ abstract class BaseIntegrationService
return $this->tenantIntegration->integration_data[$key] ?? $default;
}
/**
* Get a pre-configured HTTP client builder.
*
* @return PendingRequest
* @throws Exception
*/
public function client(): PendingRequest
{
return Http::baseUrl($this->getUrl())
->withHeaders($this->getHeaders());
}
/**
* Get the headers for the integration.
*