chore(cap): raise per-order spend cap default from 200 to 500 (#39)

This commit is contained in:
2026-06-07 23:47:43 +02:00
committed by GitHub
parent fc02f331d2
commit 53e934be3b
2 changed files with 11 additions and 9 deletions

View File

@@ -137,11 +137,13 @@ func getEnvOrDefault(key, defaultValue string) string {
return defaultValue
}
// loadMaxOrderCents reads MAX_ORDER_CENTS. Default $200. Explicit 0 disables
// the cap. Garbage or negative values fall back to the default with a warning
// so an operator typo cannot silently disable a fraud control.
// loadMaxOrderCents reads MAX_ORDER_CENTS. Default $500 — aligns with the
// PSD2 TRA exemption ceiling (above this, Stripe always requests SCA, so the
// cap is only meaningful below it). Explicit 0 disables the cap. Garbage or
// negative values fall back to the default with a warning so an operator
// typo cannot silently disable a fraud control.
func loadMaxOrderCents() int {
const defaultCap = 20000
const defaultCap = 50000
raw := os.Getenv("MAX_ORDER_CENTS")
if raw == "" {
return defaultCap

View File

@@ -24,12 +24,12 @@ func TestLoadMaxOrderCents(t *testing.T) {
env string // "" means unset
want int
}{
{"empty falls back to default", "", 20000},
{"empty falls back to default", "", 50000},
{"explicit zero disables", "0", 0},
{"valid override", "50000", 50000},
{"negative falls back to default", "-1", 20000},
{"garbage falls back to default", "two hundred", 20000},
{"empty after trim falls back to default", "", 20000},
{"valid override", "30000", 30000},
{"negative falls back to default", "-1", 50000},
{"garbage falls back to default", "two hundred", 50000},
{"empty after trim falls back to default", "", 50000},
}
for _, tc := range cases {