Centarra/panel2 — pull request #9 by nasonfish (2014-02-24 09:19:16+00:00)
Title: service/refunding: only delete an InvoiceItem from an Invoice if the invoice hasn't already been paid

When a VPS is deleted, all of the invoices related to it are deleted to, so it's as if you're just getting a refund for the entire lifetime of the server. That's probably not intended...

If an invoice item is already paid for, that means it's either already used up or it's for the current month. Since we already refund for the current month, it doesn't make sense to give them twice the money for that.

It seems like it's only intended for pending invoice items that haven't been paid for yet, since those are going to be useless.