Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • Stripe Stripe
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 63
    • Issues 63
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Extensions
  • StripeStripe
  • Issues
  • #255
Closed
Open
Created Sep 16, 2020 by BobS@BobS

Duplicate contacts created due to billing name/address fields unavailable to dedupe function

Debugging hook_civicrm_dupeQuery reveals that upon submission of a Stripe contribution, only fields in the profile(s) specified for the contribution page are available for deduping. Fields in the Stripe billing block, e.g. first_name, city, etc. are not available, and duplicate contacts may therefore be created when the dedupe depend on these fields.

Example:

  • Assume the dedupe rule is First Name:7, Phone:4, Email:4, with Threshold:11, and that the contribution page specifies a profile with phone and email fields.
  • A contact submitting a Stripe contribution will create a new contact record, even after previously making a contribution with identical parameters, because First Name is not available to the dedupe function, and the sum of the Phone and Email weights is less than the Threshold.

Temporary workaround: For the specific dedupe rule used in the above example, and for the specific payment processor ID's in my installation, normal dedupe function was restored by adding the following hook:

function mymodule_civicrm_dupeQuery($obj, $type, &$query) { 
  if ($type=="table" && $_GET["q"]=="civicrm/contribute/transact" && ($_POST["payment_processor_id"] == 3 || $_POST["payment_processor_id"] == 4)) {
    $obj->params["civicrm_contact"]["first_name"] = $_POST['billing_first_name'];
    $query["civicrm_contact.first_name.7"] = "SELECT t1.id id1, 7 weight FROM civicrm_contact t1 WHERE t1.contact_type = 'Individual' AND t1.first_name = \"$_POST[billing_first_name]\"";
  }
} 

Config:

  • CiviCRM 5.28.2
  • stripe 6.4.2
  • mjwshared 0.8.1
  • PHP 7.3
Assignee
Assign to
Time tracking