by eksith · 13y ago · 0 comments
http://dreamhost.com/dreamscape/2008/01/15/um-whoops/
At the very least, it would be wise for any company to implement billing features that will under bill rather than overbill. Under billing at least gives you the option of notifying users later (or you just eat it). Overbilling can sour a professional relationship to the point of ending it.
Having built several automation systems that bill millions of dollars, I can say that it's quite challenging to build things that have no visible output, run by themselves and often sit there for years without being touched, while everything changes around them!
It's not sexy work, but when it goes wrong the shit really can hit the fan!
if prorated_amount > (cost_per_month * 2)
raise "critical! we were about to prorate-charge someone #{prorated_amount}"
end
It's never been triggered, but this is probably the only place in our system where we're actually responsible for an exact amount that ends up on an invoice, so having a reasonable upper limit seems like a no-brainer.This code -- while good for catching bad single calculations -- wouldn't catch that.
We can't prevent every mistake but we can make sure the same one doesn't happen again.