Files
sendico/api/payments/orchestrator/internal/service/shared/idempotency.go

18 lines
263 B
Go

package shared
import (
"fmt"
"strings"
)
func PerIntentIdempotencyKey(base string, index int, total int) string {
base = strings.TrimSpace(base)
if base == "" {
return ""
}
if total <= 1 {
return base
}
return fmt.Sprintf("%s:%d", base, index+1)
}