Take a look at beancount or ledger cli. Both are command line accounting. You can use beancount ingest to automate banking. Integrate with some Python our while ingest to automate invoices to an extent.