FKN SHITSTATION AND THEIR GODDAMN SANDBOX BS - Sandbox will be it's own separate entity

This commit is contained in:
2026-09-16 16:24:20 -05:00
parent b5570d39f0
commit 82e6148ca9
4 changed files with 531 additions and 20 deletions
+19 -10
View File
@@ -319,16 +319,25 @@ def is_shipstation_test_mode() -> bool:
def get_shipstation_setting(key: str) -> str:
"""
Test-mode-aware lookup for ShipStation-related settings (API key,
store/warehouse/carrier IDs). When SHIPSTATION_TEST_MODE is on, looks
for a TEST_{key} override first, falling back to the normal {key}
value if the override is blank - so test mode works immediately if
your test/sandbox account mirrors production's store/warehouse/
carrier IDs, while still letting you override specific values if your
test account uses different ones. When test mode is off, this is
identical to config.get(key).
store/warehouse/carrier IDs, service codes). When SHIPSTATION_TEST_MODE
is on, ONLY the TEST_{key} value is used - no fallback to the
production value. When test mode is off, this is identical to
config.get(key).
This used to fall back to the production value when the TEST_ override
was blank, on the theory the sandbox might share IDs with production.
Confirmed against ShipStation's own docs that it never does - "Sandbox
data is isolated from production data... anything you create in the
sandbox will not be accessible in production, or vice-versa." A
fallback to a production store/warehouse/carrier ID under a sandbox API
key isn't a convenience, it's a guaranteed rejection - and it's exactly
what produced three separate confusing "not found"/"invalid" errors in
a row (carrier, then warehouse, then store) before this was caught.
Every caller of this function already raises a clear, specific
"X is not configured" error when it gets back an empty string, so
isolating test mode fully just turns those three confusing
ShipStation-side rejections into one obvious message instead.
"""
if is_shipstation_test_mode():
test_value = get(f"TEST_{key}", "")
if test_value:
return test_value
return get(f"TEST_{key}", "")
return get(key, "")