1. You assume monthly_rate exists. It's usually not defined that way...
2. Imagine some things are billed on a recurring basis (e.g., every 30 days), and some are every 1st of the month...
3. Assume, for example, that you charge per-user. What if there are 300 users added and 20 removed in one day. Do you refund the remaining time in the month? Is this a credit on their next invoice, a negative item on the current invoice, etc...
There are many more situations that can mess this up even further.
2. Imagine some things are billed on a recurring basis (e.g., every 30 days), and some are every 1st of the month...
3. Assume, for example, that you charge per-user. What if there are 300 users added and 20 removed in one day. Do you refund the remaining time in the month? Is this a credit on their next invoice, a negative item on the current invoice, etc...
There are many more situations that can mess this up even further.