[REF] extract internals of Payment.create into function on BAO class.
This is a partial of https://github.com/civicrm/civicrm-core/pull/13330 - trying
to separate out the main code move from the changes. My only change was to change the name to
addPayment since that is what we are doing but here are some additionaly thoughts.
1) I'm inclined to put the class onto a new pseudo-bao CRM_Finanial_BAO_Payment. We already have this
pseudo-entity on the api level & it gives us a way to build up a place for the functions we are migrating
towards.
2) I think we should consider changing the input parameters to this function to be
- contributionID, total_amount & line_items or in some way limiting the parameters tha
t get passed through. We have historically gotten ourselves in trouble by
having people hacking in another parameter to go through whereas the strength of the api
is clear inputs & outputs. I note the api will need to support
'is_email_receipt' as will this fn & the CRM_Contribute_Form_AdditionalPayment::emailReceipt
should be moved off the form layer - possibly to our new BAO
3) I think the exceptions need to be CRM_Core_Exceptions if thrown in the BAO although this is kinda cosmetic
Change-Id: Ib5caf0d878e9c5cc735cb1a20c640f61da2dbfc6