Project60 / org.project60.sepa

SEPA direct debit integration with civicrm
19 stars 46 forks source link

Self-Healing Mandates (After update to 1.6 recurring contributions are created with wrong payment_instrument_id and other issues) #629

Closed Matt5K closed 2 years ago

Matt5K commented 2 years ago

After an update to version 1.6 each time recurring contributions are updated via the dashboard new contributions are created for recurring mandates even if there is a contribution for the current period. All these contributions have the payment_instrument_id set for the first recurring payment.

bjendres commented 2 years ago

Thanks @Matt5K, we've just noticed that as well and are looking into this.

bjendres commented 2 years ago

I'm assuming that this might have to do with slightly incorrect mandates / recurring contributions created by payment processors. Does that make sense?

I have added a "self-healing" feature to CiviSEPA that is executed when batching (attached). Feel free to test, but please make a backup or use a test environment. It would also make sense to clean up open groups and delete old, orphaned pending CiviSEPA contributions. Here's the file: org.project60.sepa-1.6.0+f543fdf6bef7.zip

Can you confirm that this would solve your problem? .

Detsieber commented 2 years ago

Björn, as you assumed, slightly incorrect mandates might in fact be the reason for that: We are encountering this issue for mandates that were originally created with the old sfe-fork of CiviSEPA. I could easily imagine somethings "slightly wrong" with those (though everything worked fine until now).

However, your new version has other issues: As I tested I saw for many recurring contributions, that another contribution for April 1 was created, although these were already existing with status "in progress" (and have been sent to the bank already). Can not go in production this way!

bjendres commented 2 years ago

@Detsieber thanks for the feedback. Have you tested the "self-healing" version mentioned above? Could you give some feedback on that?

Detsieber commented 2 years ago

@bjendres yes, I was testing with the "self healing" version you provided!

bjendres commented 2 years ago

Sounds like we'll have to add another algorithm to the "self healing" process.

bjendres commented 2 years ago

yes, I was testing with the "self healing" version you provided!

@Detsieber The "self-healing" is currently only triggered when batching. So the idea would be to delete all open groups along with the contributions and then run the batching. Have you done that? If your problem still remains, could provide some data sample or access to your DB to see what exactly is wrong?

bjendres commented 2 years ago

I've added another self-healing processor with the attached version. If that doesn't fix your issue, I would have to have a closer look at your system.

org.project60.sepa-1.6.0+3391594c10.tar.gz .

bjendres commented 2 years ago

released with 1.6.1