refactor: remove PaymentProviderInterface and TelepagosProvider, simplify CheckoutService and related tests

This commit is contained in:
2026-07-03 16:55:11 -03:00
parent 057e6757dc
commit 0cb1c37566
7 changed files with 9 additions and 105 deletions

View File

@@ -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;
}

View File

@@ -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}"),
};
}
}

View File

@@ -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',
];
}
}