Fixes + stable gateway ids

This commit is contained in:
Stephan D
2026-02-18 20:38:08 +01:00
parent 4dc182bfa2
commit 770c7b9da9
119 changed files with 3000 additions and 734 deletions

View File

@@ -0,0 +1,27 @@
package discovery
import "strings"
// StableGatewayID composes a stable discovery entry ID from a base prefix and key.
func StableGatewayID(prefix string, key string) string {
cleanPrefix := strings.ToLower(strings.TrimSpace(prefix))
cleanKey := strings.ToLower(strings.TrimSpace(key))
if cleanKey == "" {
cleanKey = "unknown"
}
if cleanPrefix == "" {
return cleanKey
}
if strings.HasSuffix(cleanPrefix, "_") {
return cleanPrefix + cleanKey
}
return cleanPrefix + "_" + cleanKey
}
func StableCryptoRailGatewayID(network string) string {
return StableGatewayID("crypto_rail_gateway", network)
}
func StablePaymentGatewayID(rail string) string {
return StableGatewayID("payment_gateway", rail)
}