Spaces:
Sleeping
Sleeping
File size: 468 Bytes
cf05092 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | """Checkout flow."""
import cart
import payments
def submit_order(items: list[dict[str, float]]) -> str:
total = cart.calculate_total(items)
# Cascading symptom: negative total is observed here but root cause is config -> cart.
if total < 0:
return "error: negative total"
gateway_ok = payments.run_gateway_check("https://gateway.example.com/health")
if gateway_ok != 0:
return "error: gateway"
return payments.charge(total)
|