artfulrobot / uk.artfulrobot.civicrm.gocardless

A CiviCRM extension providing GoCardless integration to handle UK Direct Debits.
GNU Affero General Public License v3.0
5 stars 18 forks source link

Does not handle payments that were confirmed, but subsequently failed #55

Closed artfulrobot closed 5 years ago

artfulrobot commented 5 years ago

GoCardless sends wordy webhooks like this:

Enough time has passed since the payment was submitted for the banks to return an error, so this payment is now confirmed.

But experience now shows that it's possible for this payment still to fail, resulting in a payments.failed webhook coming the day after:

The customer's bank wasn't able to pay the Direct Debit. This is almost always due to insufficient funds, but is occasionally used as a catch-all for other failures.

This is a bit embarrassing really - GC tells us "all is ok" and then says "no it's not". And the first one of those messages may be linked to receipts and memberships and who knows what!

Anyway, it results in CiviCRM having status Completed where actually it has now Failed.

I suppose this extension should just update it to Failed anyway?

artfulrobot commented 5 years ago

I heard back from GoCardless, apparently this sort of thing is inherant in the way BACS works (and SEPA is worse) and is known as late failure.

Upperholme commented 5 years ago

Ideally when this happens it would be great to have some sort of alert. No idea how that might work. Could maybe set something using CiviRules assuming there was something distinct to act as a trigger.

artfulrobot commented 5 years ago

Hi @Upperholme yes I'll leave that for local config. You could use CiviRules to trigger on a payment being set to Refunded.