Most promo validators return a boolean. The user reads "invalid code", support gets a ticket, and analytics gets nothing: expired, wrong region, basket below minimum — all collapse into the same false. Rejection reasons are public API surface, so give them a type. Strings rot the first time someone renames one. And the discount arithmetic belongs in the money type with hard clamps, not in ifs at the call site. Where does your checkout actually decide a code is invalid? https://shipmindlabs.com/c/005dff7c
Was this useful?