Strange logic around Contributions without LineItems
The code that checks the eligibility of a contribution at:
...handles missing line items (comment references #9 (closed)) by using the contribution's financial_type_id
However, except in the case that all financial types are considered eligible, the calculation of amount gift-aidable is always done on line items.
So the work-around linked above will possibly do random things:
-
✔ if no line items were returned because it's api3 and quirky but they do exist, and the financial type ID on the contribution is elgible, then the totals should be correct. -
✖ if no line items were returned because it's api3 and quirky but they do exist, and the financial type ID on the contribution is ineligible, then the totals will be wrong; always zero. -
😑 if no line items were returned because there aren't any (this should be considered broken data) then the contribution's financial type is used; the ga amounts are always 0, leading to possibilities like £10 contrib, is eligible, amount eligible: £0.
I came across this while trying to write a phpunit test.