From b940d7e3688b86d6078bb77f9ee4d296bd572963 Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Sun, 4 Jun 2023 10:15:54 -0600 Subject: [PATCH] Fix payment validation for payment on confirm --- CRM/Event/Form/Registration/Confirm.php | 9 +++++++++ CRM/Event/Form/Registration/Register.php | 15 +++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/CRM/Event/Form/Registration/Confirm.php b/CRM/Event/Form/Registration/Confirm.php index 303f406bce..ecd6fc3b35 100644 --- a/CRM/Event/Form/Registration/Confirm.php +++ b/CRM/Event/Form/Registration/Confirm.php @@ -398,6 +398,15 @@ class CRM_Event_Form_Registration_Confirm extends CRM_Event_Form_Registration { $errors['payment_processor_id'] = ts('Please select a Payment Method'); } + if ($form->showPaymentOnConfirm) { + CRM_Core_Payment_Form::validatePaymentInstrument( + $fields['payment_processor_id'], + $fields, + $errors, + (!$form->_isBillingAddressRequiredForPayLater ? NULL : 'billing') + ); + } + return empty($errors) ? TRUE : $errors; } diff --git a/CRM/Event/Form/Registration/Register.php b/CRM/Event/Form/Registration/Register.php index 3b35e681c0..201d82c655 100644 --- a/CRM/Event/Form/Registration/Register.php +++ b/CRM/Event/Form/Registration/Register.php @@ -922,12 +922,15 @@ class CRM_Event_Form_Registration_Register extends CRM_Event_Form_Registration { ) { return empty($errors) ? TRUE : $errors; } - CRM_Core_Payment_Form::validatePaymentInstrument( - $fields['payment_processor_id'], - $fields, - $errors, - (!$form->_isBillingAddressRequiredForPayLater ? NULL : 'billing') - ); + + if (!$form->showPaymentOnConfirm) { + CRM_Core_Payment_Form::validatePaymentInstrument( + $fields['payment_processor_id'], + $fields, + $errors, + (!$form->_isBillingAddressRequiredForPayLater ? NULL : 'billing') + ); + } } return empty($errors) ? TRUE : $errors; -- 2.25.1