Reset event participant to 'Pending from pay later' for SDD payments - #53
Open
peetCreative wants to merge 2 commits into
Open
Reset event participant to 'Pending from pay later' for SDD payments#53peetCreative wants to merge 2 commits into
peetCreative wants to merge 2 commits into
Conversation
When registering for a paid event via the SDDNG direct debit payment processor, CiviCRM core treats the payment as completed and creates the participant with status 'Registered'. The post-processor already resets the contribution back to 'Pending' (resetContribution), but the linked participant was left at 'Registered' even though no money has been collected yet. Add resetParticipants(), called from the OOFF branch of createPendingMandate(), which downgrades any participant currently in 'Registered' (linked via civicrm_participant_payment) to 'Pending from pay later'. Cancelled/waitlisted statuses are left untouched. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
testEventParticipantResetNG creates a contribution, an event and a 'Registered' participant linked via ParticipantPayment, then runs createPendingMandate() and asserts the participant is downgraded to 'Pending from pay later'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Collaborator
|
Thank you @peetCreative ! Look like a useful addition. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When registering for a paid event via the
Payment_SDDNGdirect debit payment processor, the SEPA mandate and a pending contribution are created correctly, but the event participant is left in status Registered instead of Pending from pay later.Why
SDDNGis a direct payment processor, so CiviCRM core treats the registration like a completed payment: it creates the contribution as Completed and the participant as Registered. The extension's post-processor (SDDNGPostProcessor::createPendingMandate()) then resets the contribution back to Pending viaresetContribution()— but nothing ever resets the participant, which stays at Registered even though no money has been collected yet (the mandate still has to be submitted to the bank).Fix
Add
resetParticipants(), called from the OOFF branch ofcreatePendingMandate()right afterresetContribution(). It finds the participant(s) linked to the contribution viacivicrm_participant_paymentand, only if currently inRegistered, downgrades them toPending from pay later. Cancelled/waitlisted/etc. statuses are left untouched. Mirrors the existingresetContribution()style (API first, SQL fallback).Test
Adds
testEventParticipantResetNG, which creates a contribution, an event and aRegisteredparticipant linked viaParticipantPayment, runscreatePendingMandate(), and asserts the participant ends upPending from pay later.🤖 Generated with Claude Code