Premium selection lost when paying via offsite payment processor
I have a donation form which uses both iAts but also the option to pay via paypal using "website payments standard" processor.
If the donor pays via iAts the premium they selected is recorded in the db along with the contribution. However, if they pay via PayPal then the premium is not recorded.
I tried tracking down this bug. I got as far as Contribute/Form/Contribution/Confirm.php where postProcessPremium is called within processFormSubmission. However, CRM_Contribute_BAO_Contribution_Utils::processConfirm is called which if using PayPal calls a redirect and exits the code. Then PayPal pings back via the IPN. It's somewhere there where the premium isn't getting saved.
Maybe in Contribute/BAO/Contribution.php completeOrder is where the problem is?
I did have a ACH/EFT payment with a premium work correctly. I.e. it started out in Pending with the premium shown. Then when the "iATS Payments Verification" job ran the contribution was updated to complete with the premium still attached.