refactor: remove PaymentProviderInterface and TelepagosProvider, simplify CheckoutService and related tests
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Integration\Services\Contracts;
|
||||
|
||||
interface PaymentProviderInterface
|
||||
{
|
||||
/**
|
||||
* Procesa un pago con las credenciales específicas del Tenant.
|
||||
*
|
||||
* @param array $paymentData Datos del pago, incluyendo el método (ej. qr, transferencia).
|
||||
* @param array $credentials Credenciales encriptadas previamente configuradas por el Tenant.
|
||||
* @return array
|
||||
*/
|
||||
public function process(array $paymentData, array $credentials): array;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Integration\Services;
|
||||
|
||||
use App\Domains\Integration\Services\Contracts\PaymentProviderInterface;
|
||||
use App\Domains\Integration\Services\Providers\TelepagosProvider;
|
||||
use InvalidArgumentException;
|
||||
|
||||
class PaymentProviderFactory
|
||||
{
|
||||
public function make(string $integrationCode): PaymentProviderInterface
|
||||
{
|
||||
return match ($integrationCode) {
|
||||
'telepagos' => new TelepagosProvider(),
|
||||
default => throw new InvalidArgumentException("Integración de pago no soportada: {$integrationCode}"),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Integration\Services\Providers;
|
||||
|
||||
use App\Domains\Integration\Services\Contracts\PaymentProviderInterface;
|
||||
use BadMethodCallException;
|
||||
|
||||
class TelepagosProvider implements PaymentProviderInterface
|
||||
{
|
||||
public function process(array $paymentData, array $credentials): array
|
||||
{
|
||||
// Mocked response for development and local testing
|
||||
return [
|
||||
'status' => 'approved',
|
||||
'transaction_id' => 'mock_tp_' . uniqid(),
|
||||
'payment_method' => $paymentData['payment_method'] ?? 'qr',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user