Closed wmortada closed 3 years ago
(I updated the link to the 1.8 version of the code, master has moved on)
Yes, it would be good to sort that one out. There's 2 reasons for it:
GoCardless itself is quite chatty with sending receipts directly, so we'd be sending people 2 emails each month. I think you can turn those off at GC (I'm not sure), though.
Historically I didn't write this for CiviCRM's built in contribution forms, and I didn't want Civi sending receipts. The only way in CiviCRM to control these is via the Contribution Pages' config; there's nothing in the contribution or contribution recur tables that stores this preference. So if you don't have a contribution page, you need another place for that setting. The contributions are generated when GC sends a notification and the code to handle that is common to Core and bespoke uses.
So I probably need to find a place to inject a setting like:
☑ Send email receipts if there is no Contribution Page associated with a contribution
Then when one comes in:
PRs welcome.
Thanks for the clarification (and fixing my link :-)). That helps to explain the rationale.
I believe that GoCardless only sends emails when a subscriber first sets up the mandate. They get one to confirm the mandate and one for the subscription. I don't think they get an email for each subsequent payment (at least that hasn't been my experience in testing it). So this means that subscribers are currently getting no emails for second and subsequent payments.
Your approach seems sensible and it would be good to have this as an option in the UI.
Linking this https://lab.civicrm.org/dev/core/issues/1423 since fixing that would give a more CiviCRM-centered way to acheive it.
Worth also noting that:
is_email_receipt
preference for an existing recurring contribis_email_receipt
has a default of 1 in the SQL but is manually set to 0 in the creation code(!)Sounds like this should ideally be tackled in CiviCRM core first and then get this extension to plug in to this.
Currently this extension disables the sending of receipts. I'm not quite sure of the rationale behind this particularly as this can be controlled per contribution page.
This is the relevant section of the code:
https://github.com/artfulrobot/uk.artfulrobot.civicrm.gocardless/blob/1.8/CRM/GoCardless/Page/Webhook.php#L202
As it says in the comment, if there is a requirement for receipts to be disabled it would be better to do this via a setting so that it can be turned on or off per site rather than hard-coded.
I'd be interested in hearing from others about whether they feel this is needed at all, if we should allow sites to control this via the setting on the contribution page or if we need a setting for this extension.