mirror of
https://github.com/Dvorinka/Bookra.git
synced 2026-06-04 12:33:00 +00:00
cleanup
This commit is contained in:
@@ -5,6 +5,8 @@ import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
||||
"bookra/apps/backend/internal/shared"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
@@ -112,7 +114,7 @@ func (cfg Config) PaddleWebhookConfigured() bool {
|
||||
}
|
||||
|
||||
func (cfg Config) PaddleCheckoutConfigured(planCode string) bool {
|
||||
planCode = normalizePlanCode(planCode)
|
||||
planCode = shared.NormalizePlanCode(planCode)
|
||||
return cfg.PaddleConfigured() && cfg.PaddleWebhookConfigured() && cfg.PaddlePriceMatrix[planCode]["czk"] != "" && cfg.PaddlePriceMatrix[planCode]["usd"] != ""
|
||||
}
|
||||
|
||||
@@ -139,17 +141,6 @@ func normalizePaddleEnvironment(value string) string {
|
||||
}
|
||||
}
|
||||
|
||||
func normalizePlanCode(planCode string) string {
|
||||
switch strings.TrimSpace(planCode) {
|
||||
case "growth":
|
||||
return "pro"
|
||||
case "multi-location":
|
||||
return "business"
|
||||
default:
|
||||
return strings.TrimSpace(planCode)
|
||||
}
|
||||
}
|
||||
|
||||
func valueOrDefault(key string, fallback string) string {
|
||||
if value := strings.TrimSpace(os.Getenv(key)); value != "" {
|
||||
return value
|
||||
|
||||
Reference in New Issue
Block a user