Fix and finish the Invoice API controller