Further work on payment.create consolidation - always handle financials from payment...
authoreileen <emcnaughton@wikimedia.org>
Fri, 28 Jun 2019 23:46:26 +0000 (11:46 +1200)
committereileen <emcnaughton@wikimedia.org>
Sat, 29 Jun 2019 00:00:20 +0000 (12:00 +1200)
commit362f37fc946519771aa4ec3e5783c46aa5a1e40b
tree53198a6aae0c514c817528b846c084a4ce20c0f0
parentaf89853e301194c4e0a683a86cd5e79676b65607
Further work on payment.create consolidation - always handle financials from payment.create

This fixes a 2-track processing in payment.create whereby financial transactions for most payments were being handled by payment.create
but for payments transitioning from 'Pending' to 'Completed' the contribution bao was handling them (via completetransaction).

I've added a new parameter to allow opting out of recording payments in completetransation (is_post_payment_create). I believe
ideally our eventual position is that this would be the case whenever a payment is added. I exposed the parameter to getfields
in the spec for completetransaction but not contribution.create. It kind of is an internal / transitional param but the
eventual logic is that completetransaction would never handle financials whereas the eventual for contribution.create is more
muddy.

This surfaced what I believe is a bug in the getToFinancialAccount function. This is only called when adding payments
so I believe it should never transfer TO accounts receivable (which it was doing). In practical terms this
would only have been hit (prior to this) when adding a payment to a partially paid transaction
CRM/Contribute/BAO/Contribution.php
CRM/Financial/BAO/Payment.php
api/v3/Contribution.php