Page MenuHomePhabricator

When PayPal recurring donor changes their PP profile contact, update the email address in CRM
Open, MediumPublic2 Estimated Story Points

Description

PayPal will send us the new email, somewhere... Find it and import into Civi as their new primary email.

Event Timeline

ggellerman set the point value for this task to 2.
ggellerman moved this task from Triage to Q1 FY2022-23 on the Fundraising-Backlog board.
awight renamed this task from Should import new email address when PayPal recurring donor changes their PP profile contact to When PayPal recurring donor changes their PP profile contact, update the email address in CRM.Sep 27 2016, 9:14 PM

Could do this with the subscr_id, or we could start storing processor-side persistent payer ids with the contact record

Can you describe the process here? ie. is this a case of someone logging into their paypal account & changing the address & paypal sends us a notification of some sort?

I think PayPal will just include the updated donor details in the next subscr_payment message

I think the code maybe does that. It was probably creating a duplicate address rather than updating but the test for T15247 suggests that is happening? Ah no, it only happens if there is a contribution_tracking record for the contribution. So, we could probably remove that IF & it would happen every transaction

Note that the relevant code is the IF clause here - without this if wrapper clause the address would update

		 */
		if ( $msg[ 'contribution_tracking_update' ] ) {
			// TODO: this scenario should be handled by the wmf_civicrm_contribution_message_import function.

			// Map the tracking record to the CiviCRM contribution
			wmf_civicrm_message_update_contribution_tracking( $msg, $contribution );

			// update the contact
			$contact = wmf_civicrm_message_contact_update( $msg, $recur_record->contact_id );

			// Insert the location record
			wmf_civicrm_message_location_update( $msg, $contact );

			// Tag contact for review
			wmf_civicrm_tag_contact_for_review( $contact );
		}

The instruction to not update (fail the above if) comes from

	if ( $msg[ 'txn_type' ] == 'subscr_payment' ) {
			// default to not update contribution tracking data
			$msg_normalized[ 'contribution_tracking_update' ] = false;

			// get the database connection to the tracking table
			$dbs = wmf_civicrm_get_dbs();
			$dbs->push( 'donations' );
			$query = "SELECT * FROM {contribution_tracking} WHERE id = :id";
			$tracking_data = db_query( $query, array( ':id' => $msg[ 'custom' ] ) )->fetchAssoc();
			if ( $tracking_data ) {

So the question for this ticket is 'why would we not remove the contribution_tracking_update logic and always update the address based on the paypal notification. (& if the answer is still dunno after some more thought then some code can be removed :-)