ldc-legaulois/app/Lib/Axepta/AxeptaConfig.php

36 lines
984 B
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace App\Lib\Axepta;
final readonly class AxeptaConfig
{
public function __construct(
#[\SensitiveParameter]
public string $endpoint,
#[\SensitiveParameter]
public string $merchantId,
#[\SensitiveParameter]
public string $apiKey,
#[\SensitiveParameter]
public string $hmac,
/** @param array<string,mixed> $axeptaConfig */
#[\SensitiveParameter]
public array $checkoutConfig = []
) {
if (empty(trim($endpoint))) {
throw new \DomainException('Endpoint cannot be empty');
}
if (empty(trim($merchantId))) {
throw new \DomainException('Merchant ID cannot be empty');
}
if (empty(trim($apiKey))) {
throw new \DomainException('API Key cannot be empty');
}
if (empty(trim($hmac))) {
throw new \DomainException('HMAC cannot be empty');
}
}
}