Skip to content

fix: Fix needless email-address pruning from CiviCRM form data payload

stephen requested to merge fix-email-pruning into main

During the run-up to site launch, the donation form data submission flow was refactored in order to make sure the data handed off to CiviCRM was complete, clear, and reliably-handled. (See 9138ebbb for details.)

One of the ways this was achieved was by implementing tordonate.civicrm.repository.handle_donation_form_data(). The donation form itself contains a lot of information useful during the donation process, but meaningless to CiviCRM, and its resultant form data object contains a lot of duplicated data - different payment processors require different naming or formatting conventions for the same critical data. To this end, handle_donation_form_data() was implemented to handle incoming donation form data, normalize it so CiviCRM would have a reliable dataset to pull out, and prune needless data which CiviCRM would just throw away.

This refactor seems to have introduced a bug into the donation form handling flow which went unnoticed until now - it appears to be possible, based on an event involving the Paypal donation flow, for form data to reach handle_donation_form_data() with the email address attached in a previously-thought-prunable format.

Sending a tidy data object down the pipeline is a nice goal, but providing redundant data in case of unforeseen issues is even nicer. Therefore, this MR seeks to address this bug, and any such future bugs, in two ways:

  1. handle_donation_form_data() no longer prunes any information which CiviCRM might find useful, even if it would be redundant to include. This change is intended to help triage future bugs which might arise due to future events or findings.
  2. Form data handled by Paypal now explicitly handles the email address in the same manner Stripe does, ensuring (mostly-)redundant upstream normalization.

Testing has been adjusted to ensure that critical data passes through handle_donation_form_data() unpruned.

Merge request reports

Loading