From dc70c2658a7faf0c766f61928bb81498a7756d62 Mon Sep 17 00:00:00 2001
From: drastik <jwjoshuawalker@gmail.com>
Date: Sun, 5 Aug 2012 21:30:42 -0700
Subject: [PATCH] Remove old customer entry when handling mis-match

---
 CRM/Core/Payment/Stripe.php | 1 +
 1 file changed, 1 insertion(+)

diff --git a/CRM/Core/Payment/Stripe.php b/CRM/Core/Payment/Stripe.php
index f876ee66..0dac7e20 100644
--- a/CRM/Core/Payment/Stripe.php
+++ b/CRM/Core/Payment/Stripe.php
@@ -149,6 +149,7 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
         //Store the relationship between CiviCRM's email address for the Contact & Stripe's Customer ID
         if(isset($stripe_customer)) {
           $stripe_customer_id = $stripe_customer->id;
+          $new_customer_insert = "DELETE FROM civicrm_stripe_customers WHERE email = '$email'";
           $new_customer_insert = "INSERT INTO civicrm_stripe_customers (email, id) VALUES ('$email', '$stripe_customer_id')";
           CRM_Core_DAO::executeQuery($new_customer_insert);
         } else {
-- 
GitLab