Commit 58776193 authored by Jamie McClelland's avatar Jamie McClelland Committed by mattwire

Always try to update a credit card

Otherwise we may ignore a credit card provided by a user
and instead charge the one associated with their account.

https://lab.civicrm.org/extensions/stripe/issues/4
parent 4df2ca40
......@@ -486,13 +486,6 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
}
}
// Avoid the 'use same token twice' issue while still using latest card.
if (!empty($params['is_secondary_financial_transaction'])) {
// This is a Contribution page with "Separate Membership Payment".
// Charge is coming through for the 2nd time.
// Don't update customer again or we will get "token_already_used" error from Stripe.
}
else {
$stripeCustomer->card = $card_token;
$updatedStripeCustomer = $this->stripeCatchErrors('save', $stripeCustomer, $params);
if ($this->isErrorReturn($updatedStripeCustomer)) {
......@@ -505,7 +498,6 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
}
}
}
}
else {
// Customer was found in civicrm_stripe database, but not in Stripe.
// Delete existing customer record from CiviCRM and create a new customer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment