Skip to content

Reset event participant to 'Pending from pay later' for SDD payments - #53

Open
peetCreative wants to merge 2 commits into
Project60:masterfrom
peetCreative:fix_event_participation_status
Open

Reset event participant to 'Pending from pay later' for SDD payments#53
peetCreative wants to merge 2 commits into
Project60:masterfrom
peetCreative:fix_event_participation_status

Conversation

@peetCreative

Copy link
Copy Markdown

Problem

When registering for a paid event via the Payment_SDDNG direct 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

SDDNG is 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 via resetContribution() — 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 of createPendingMandate() right after resetContribution(). It finds the participant(s) linked to the contribution via civicrm_participant_payment and, only if currently in Registered, downgrades them to Pending from pay later. Cancelled/waitlisted/etc. statuses are left untouched. Mirrors the existing resetContribution() style (API first, SQL fallback).

Test

Adds testEventParticipantResetNG, which creates a contribution, an event and a Registered participant linked via ParticipantPayment, runs createPendingMandate(), and asserts the participant ends up Pending from pay later.

🤖 Generated with Claude Code

Peter Klausing and others added 2 commits June 17, 2026 17:46
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>
@vurt2

vurt2 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Thank you @peetCreative ! Look like a useful addition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants