Skip to content
Snippets Groups Projects
Commit 7c63f757 authored by mattwire's avatar mattwire
Browse files

Support Confirm->Thankyou workflow on contribution pages/events

parent 456fc7ca
Branches
Tags
No related merge requests found
......@@ -340,8 +340,8 @@ class CRM_Core_Payment_Stripe extends CRM_Core_Payment {
$params = $this->beginDoPayment($params);
// Get the passed in paymentIntent
if(!empty(CRM_Utils_Array::value('paymentIntentID', $_POST, NULL))) {
$paymentIntentID = CRM_Utils_Array::value('paymentIntentID', $_POST, NULL);
if(!empty(CRM_Utils_Array::value('paymentIntentID', $params))) {
$paymentIntentID = CRM_Utils_Array::value('paymentIntentID', $params);
}
else {
CRM_Core_Error::statusBounce(E::ts('Unable to complete payment! Missing paymentIntent ID.'));
......
......@@ -171,6 +171,30 @@ function stripe_civicrm_buildForm($formName, &$form) {
}
}
/**
* Implements hook_civicrm_postProcess().
*
* @param string $formName
* @param \CRM_Core_Form $form
*/
function stripe_civicrm_postProcess($formName, &$form) {
// We're only interested in forms that have a paymentprocessor
if (empty($form->get('paymentProcessor')) || ($form->get('paymentProcessor')['class_name'] !== 'Payment_Stripe')) {
return;
}
// Retrieve the paymentIntentID that was posted along with the form and add it to the form params
// This allows multi-page checkout to work (eg. register->confirm->thankyou)
$params = $form->get('params');
if (isset($params[0])) {
$paymentIntentID = CRM_Utils_Request::retrieveValue('paymentIntentID', 'String');
if ($paymentIntentID) {
$params[0]['paymentIntentID'] = $paymentIntentID;
$form->set('params', $params);
}
}
}
/**
* Implements hook_civicrm_check().
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment