Skip to content
Snippets Groups Projects
Commit 2590ea75 authored by mattwire's avatar mattwire
Browse files

Fix issues with stripe js on thankyou pages

parent ab47b733
No related branches found
No related tags found
1 merge request!1096.4
......@@ -11,7 +11,7 @@ CRM.$(function($) {
switch (CRM.vars.stripe.paymentIntentStatus) {
case 'succeeded':
case 'cancelled':
debugging('paymentIntent: ' . CRM.vars.stripe.paymentIntentStatus);
debugging('paymentIntent: ' + CRM.vars.stripe.paymentIntentStatus);
return;
}
......
......@@ -187,18 +187,16 @@ function stripe_civicrm_buildForm($formName, &$form) {
$paymentProcessor->setAPIParams();
try {
$intent = \Stripe\PaymentIntent::retrieve($paymentIntent['paymentintent_id']);
if (!in_array($intent->status, ['succeeded', 'cancelled'])) {
// We need the confirmation_method to decide whether to use handleCardAction (manual) or handleCardPayment (automatic) on the js side
$jsVars = [
'id' => $form->_paymentProcessor['id'],
'paymentIntentID' => $paymentIntent['paymentintent_id'],
'paymentIntentStatus' => $intent->status,
'paymentIntentMethod' => $intent->confirmation_method,
'publishableKey' => CRM_Core_Payment_Stripe::getPublicKeyById($form->_paymentProcessor['id']),
'jsDebug' => (boolean) \Civi::settings()->get('stripe_jsdebug'),
];
\Civi::resources()->addVars(E::SHORT_NAME, $jsVars);
}
// We need the confirmation_method to decide whether to use handleCardAction (manual) or handleCardPayment (automatic) on the js side
$jsVars = [
'id' => $form->_paymentProcessor['id'],
'paymentIntentID' => $paymentIntent['paymentintent_id'],
'paymentIntentStatus' => $intent->status,
'paymentIntentMethod' => $intent->confirmation_method,
'publishableKey' => CRM_Core_Payment_Stripe::getPublicKeyById($form->_paymentProcessor['id']),
'jsDebug' => (boolean) \Civi::settings()->get('stripe_jsdebug'),
];
\Civi::resources()->addVars(E::SHORT_NAME, $jsVars);
}
catch (Exception $e) {
// Do nothing, we won't attempt further stripe processing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment