45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Domains\Integration\Services;
|
|
|
|
use Exception;
|
|
|
|
class TelepagosIntegrationService extends BaseIntegrationService
|
|
{
|
|
/**
|
|
* TelepagosIntegrationService constructor.
|
|
*
|
|
* @param string $integrationCode
|
|
*/
|
|
public function __construct(string $integrationCode = 'telepagos')
|
|
{
|
|
$this->integrationCode = $integrationCode;
|
|
}
|
|
|
|
/**
|
|
* Get the headers for Telepagos integration.
|
|
*
|
|
* @return array
|
|
* @throws Exception
|
|
*/
|
|
public function getHeaders(): array
|
|
{
|
|
if (!$this->tenantIntegration) {
|
|
throw new Exception("Tenant integration is not loaded. Call forTenant() first.");
|
|
}
|
|
|
|
$username = $this->getIntegrationSetting('username');
|
|
$password = $this->getIntegrationSetting('password');
|
|
|
|
if (empty($username) || empty($password)) {
|
|
throw new Exception("Missing username or password in Telepagos integration settings.");
|
|
}
|
|
|
|
return [
|
|
'Authorization' => 'Basic ' . base64_encode($username . ':' . $password),
|
|
'Content-Type' => 'application/json',
|
|
'Accept' => 'application/json',
|
|
];
|
|
}
|
|
}
|