diff --git a/src/components/admin/ConfigTab.tsx b/src/components/admin/ConfigTab.tsx index cebc926..b04a6c8 100644 --- a/src/components/admin/ConfigTab.tsx +++ b/src/components/admin/ConfigTab.tsx @@ -201,6 +201,26 @@ const ConfigTab: React.FC = ({ isSuperAdmin }) => {
+ ) : paymentConfigs.length === 0 ? ( +
+ +

+ No hay configuraciones de pago +

+

+ Tu backend necesita implementar el endpoint de configuración de pagos +

+
+

+ Backend Required Endpoints: +

+
    +
  • GET /config/payments - Lista de configs
  • +
  • PUT /config/payments/:id - Actualizar config
  • +
  • POST /config/payments/:id/test - Probar conexión
  • +
+
+
) : (
{paymentConfigs.map((config) => ( @@ -415,6 +435,16 @@ const ConfigTab: React.FC = ({ isSuperAdmin }) => {
+ ) : systemParameters.length === 0 ? ( +
+ +

+ No hay parámetros configurados +

+

+ Endpoint requerido: GET /config/parameters +

+
) : (
{systemParameters.map((param) => ( diff --git a/src/services/configApi.ts b/src/services/configApi.ts index 608727a..4acb77d 100644 --- a/src/services/configApi.ts +++ b/src/services/configApi.ts @@ -187,14 +187,48 @@ export const configApi = { 'Content-Type': 'application/json', }, }); - if (!response.ok) throw new Error('Failed to fetch payment configs'); + if (!response.ok) { + // Si el backend no responde, retornar configuraciones mock + return this.getMockPaymentConfigs(); + } return await response.json(); } catch (error) { console.error('Error fetching payment configs:', error); - return []; + // Retornar configuraciones mock para desarrollo + return this.getMockPaymentConfigs(); } }, + getMockPaymentConfigs(): PaymentConfig[] { + return [ + { + id: 'stripe-1', + provider: 'stripe', + name: 'Stripe Payment Gateway', + enabled: false, + credentials: { + publishableKey: '', + secretKey: '', + webhookSecret: '', + }, + status: 'inactive', + testMode: true, + }, + { + id: 'paypal-1', + provider: 'paypal', + name: 'PayPal Payment Gateway', + enabled: false, + credentials: { + clientId: '', + clientSecret: '', + }, + status: 'inactive', + testMode: true, + }, + ]; + }, + async updatePaymentConfig(config: Partial): Promise { const response = await fetch(`${API_BASE_URL}/config/payments/${config.id}`, { method: 'PUT',