Extract repeat code from test_invoice for model
Update invoice API, add tests