Skip to content

HOLD: Capture known profile data as form answers on registration & bulk payment submissions#1683

Open
maebeale wants to merge 2 commits into
mainfrom
maebeale/bulk-payment-payer-info
Open

HOLD: Capture known profile data as form answers on registration & bulk payment submissions#1683
maebeale wants to merge 2 commits into
mainfrom
maebeale/bulk-payment-payer-info

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

What is the goal of this PR and why is this important?

  • When a logged-in user submits an event registration or bulk payment form, the profile fields they already have on file are hidden (logged_out_only) and never re-asked.
  • As a result, those answers were missing from the form submission — the submission didn't record who paid or registered.
  • This makes each submission self-describing: it captures everything known about the registrant/payer at the time it was submitted, not just the handful of fields shown on screen.

How did you approach the change?

  • Bulk payment (bulk_payment.rb): when a signed-in person is present, backfill the hidden payer fields (payer_first_name, payer_last_name, payer_email, payer_phone, payer_organization) from their profile before saving form answers.
  • Public registration (public_registration.rb): added backfill_profile_fields, mirroring the controller's person_known_identifiers mapping, to fill hidden identity/contact fields (name, nickname, emails + types, pronouns, mailing address, phone + type) from the person's record.
  • Both backfills:
    • Only run for logged-in users.
    • Only fill fields the registrant left blank (never overwrite a submitted value).
    • Do not mutate the person's own records (addresses, contact methods) — they only populate form answers.
    • Reverse the legal-name/nickname split correctly and normalize radio-option casing (e.g. personalPersonal).

Anything else to add?

  • TDD: failing specs written first, then implementation.
  • New coverage in the bulk payment and public registration service specs, plus an end-to-end request spec for a signed-in payer. Full service + request suites green; RuboCop clean.

🤖 Generated with Claude Code

maebeale and others added 2 commits June 15, 2026 15:00
Logged-in payers never see the payer information fields (they're
logged_out_only), so those answers were missing from the submission even
though we already know them. Capture them from the signed-in person so
the submission records who paid, without disturbing their contact records.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Hidden profile fields a logged-in registrant already has on file were
never saved to the form submission. Pull that data from the person's
record at submission time so each submission captures everything known
then, leaving the registrant's own records untouched.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

assign_tags(person, organization)

backfill_profile_fields(person) if @person

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: Placed after the create_*/assign_tags block on purpose: those guards read the original @form_params, so backfilling here records the data as answers without re-running address/contact creation on the person's own profile data.

"last_name" => person.last_name,
"primary_email" => person.email,
"primary_email_type" => person.email_type&.capitalize,
"nickname" => (person.first_name if person.legal_first_name.present?),

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: Reverses resolve_names: when a legal name is on file the person goes by a nickname, so first_name field gets the legal name and nickname gets the preferred first_name. Skipped (blank) otherwise.

person = find_or_create_person
create_phone_contact(person) if field_value("payer_phone").present?
if @person
backfill_payer_fields(@person)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 From Claude: Logged-in branch backfills the hidden payer fields and intentionally skips create_phone_contact, so the signed-in person's existing contact methods are left untouched.

@maebeale maebeale marked this pull request as ready for review June 16, 2026 19:22
@maebeale maebeale requested a review from jmilljr24 June 16, 2026 19:24

@jmilljr24 jmilljr24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bulk payment works as expected. Maybe the temp submitted by I added could be removed if redundant?

Viewing a registration submission did not display Person data for the normal contact info.

@jmilljr24

Copy link
Copy Markdown
Collaborator
screenshot-2026-06-16_15-33-56 screenshot-2026-06-16_15-35-13

@maebeale maebeale changed the title Capture known profile data as form answers on registration & bulk payment submissions HOLD: Capture known profile data as form answers on registration & bulk payment submissions Jun 16, 2026
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