I need to send a receipt when a contribution has been paid (either when the payment provider confirmed the payment, or when receiving the check).
This is for tax reduction purpose, in France you can deduce 2/3 of the amount you give to a registered NGO (lots of rules and limits, but that's the idea). the NGO has to send to the contributors that request it a specific pdf mentioning the amount and so on.
We have implemented it using the pdf letter templating system and some custom token, but not sure what's the best way to send it.
What would you suggest?
I'm thinking of using the send confirmation feature ( CRM/Core/BAO/MessageTemplates.php ) but I don't see any hook to alter the way the pdf is generated. Would it make sense to add one?
The other hook I can think of is on the alterMailParams, but it doesn't seem that the param contains the "type" of email, eg. so that's easy to see if it's a contribution receipt, civimail...
Any suggestion on how to do it?
Also, is there a suggestion on how to test the payment provider callback? I'd want to generate a unique receipt id (following a different number schema than the contrib id) there, but so far I didn't manage to catch it on a post hook.
Is there a clever way of testing/debugging that part?