36 lines
984 B
PHP
36 lines
984 B
PHP
|
|
<?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');
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|