feat(payment): enhance payment configuration to include active gateways and update CORS settings
This commit is contained in:
@@ -21,6 +21,13 @@ class MellatGateway implements PaymentGatewayInterface
|
||||
|
||||
public function getName(): string { return 'mellat'; }
|
||||
|
||||
public function isConfigured(): bool
|
||||
{
|
||||
return $this->cfg('mellat_terminal_id', $this->terminalId) !== ''
|
||||
&& $this->cfg('mellat_username', $this->username) !== ''
|
||||
&& $this->cfg('mellat_password', $this->password) !== '';
|
||||
}
|
||||
|
||||
private function cfg(string $key, string $envFallback): string
|
||||
{
|
||||
return $this->configRepo->get($key) ?: $envFallback;
|
||||
|
||||
@@ -6,6 +6,8 @@ class MockGateway implements PaymentGatewayInterface
|
||||
{
|
||||
public function getName(): string { return 'mock'; }
|
||||
|
||||
public function isConfigured(): bool { return true; }
|
||||
|
||||
public function initiate(int $amountRials, string $orderId, string $callbackUrl): PaymentInitResult
|
||||
{
|
||||
$redirectUrl = $callbackUrl . '&mock=1&ResCode=0&RefId=MOCK-' . $orderId;
|
||||
|
||||
@@ -6,6 +6,11 @@ interface PaymentGatewayInterface
|
||||
{
|
||||
public function getName(): string;
|
||||
|
||||
/**
|
||||
* Whether this gateway has valid credentials configured and can be offered to users.
|
||||
*/
|
||||
public function isConfigured(): bool;
|
||||
|
||||
/**
|
||||
* Initiates payment, returns redirect URL or token.
|
||||
*/
|
||||
|
||||
@@ -20,6 +20,11 @@ class SepGateway implements PaymentGatewayInterface
|
||||
|
||||
public function getName(): string { return 'sep'; }
|
||||
|
||||
public function isConfigured(): bool
|
||||
{
|
||||
return $this->cfg('sep_terminal_id', $this->terminalId) !== '';
|
||||
}
|
||||
|
||||
private function cfg(string $key, string $envFallback): string
|
||||
{
|
||||
return $this->configRepo->get($key) ?: $envFallback;
|
||||
|
||||
Reference in New Issue
Block a user