Agrega API de pagos externos: tokens por servicio, atados a pasarela e IP

Permite emitir credenciales (token hasheado + IP/CIDR opcional) desde
/app/pagos-externos para que aplicaciones de terceros pidan cobros a
través de Bold/dLocal/PayPal sin acceso a nada más del sistema:

- POST /api/v1/pagos-externos/solicitar genera el link de cobro real
  usando solo las pasarelas habilitadas para ese servicio.
- Los webhooks existentes de Bold/dLocal/PayPal (firma obligatoria,
  idempotentes) ahora también resuelven referencias "extpay-…" sin
  tocar el flujo de contratos ("contrato-{id}").
- Al confirmarse el pago se notifica por webhook firmado (HMAC) y/o
  Telegram, configurable por servicio.
- CRUD de servicios protegido con SoloAdmin; token y callback_secret
  solo se muestran una vez, en DB se guardan hasheados.
This commit is contained in:
Lizandro GD
2026-08-04 14:16:13 +00:00
parent 3e2e4b63e9
commit e5849549a0
15 changed files with 1424 additions and 5 deletions
+2 -1
View File
@@ -263,7 +263,8 @@ func AuthAdmin(c *fiber.Ctx) error {
func AuthApi() func(*fiber.Ctx) error {
return func(c *fiber.Ctx) error {
// Excluir rutas públicas y /api/v2 (tiene su propio middleware)
if c.Path() == "/api/v1/oauth/token" || c.Path() == "/api/sms/send" || strings.HasPrefix(c.Path(), "/api/v2") {
if c.Path() == "/api/v1/oauth/token" || c.Path() == "/api/sms/send" || strings.HasPrefix(c.Path(), "/api/v2") ||
strings.HasPrefix(c.Path(), "/api/v1/pagos-externos") {
return c.Next()
}