silverstrike icon indicating copy to clipboard operation
silverstrike copied to clipboard

Adding split tests and transaction validation

Open qedi-r opened this issue 1 year ago • 0 comments

The goal here is to resolve #144, and ensure that there's some general validation on all transaction creation, regardless of api/import/ui creation. This will expose the following errors on transaction creation

  • deposit transaction accounts have src type of Foreign, dst type of Personal
  • withdraw transaction accounts have src type of Personal dst type of Foreign
  • transfer transaction accounts have src and dst of Personal
  • amounts on the source transaction are equal to the amounts specified in the splits
  • amounts in each of the accounts specified in splits add up to 0
  • saving transactions with negative amounts is not allowed

This last one is special; adding this as a condition means the firefly import tests fail. Is that expected? Should that be fixed in the firefly import tests, or in the firefly import code (as in, it might be choosing the wrong transaction type), or is that a special case that should be allowed?

qedi-r avatar Nov 03 '22 13:11 qedi-r