Fix: real supporters were rejected on a wrong campaign_id + add diagnostics
Robin is an active supporter but /paid/callback said "Nog geen supporter",
so he never reached the passkey step (that page only shows after a verified
patron). Root cause: pickCampaignMembership matched STRICTLY on the owner's
configured campaign_id, and a wrong/typo'd id in the admin locked out real
patrons.
Memberships returned via a creator's OWN OAuth client are already scoped to
that creator's campaign(s), so:
- prefer an exact campaign_id match (unchanged for the common case),
- but fall back to the sole membership when the configured id doesn't match,
- refuse only when it's genuinely ambiguous (multiple memberships, none
matching) so we never silently grant the wrong one.
Also log a one-line diagnostic in verifyPatron when a patron is NOT accepted:
the campaign_id configured vs the memberships Patreon actually returned
(campaign:status:cents). Stores nothing; it's a server log so the owner can
see whether their campaign_id is wrong or the pledge isn't active.
Changed files:
src/services/PaidPatreonService.js
- pickCampaignMembership: exact match, else sole-membership fallback,
else null; verifyPatron logs why a patron was rejected
test/paid-patron.test.js
- exact match, sole-membership fallback, ambiguous→null, empty→null
-robo
Co-Authored-By: Claude Opus 4.8 <noreply@…>