// check for is_monetary status
$isMonetary = CRM_Utils_Array::value('is_monetary', $this->_values['event']);
$isPayLater = CRM_Core_DAO::getFieldValue('CRM_Event_DAO_Event', $this->_eventId, 'is_pay_later');
- //check for variour combination for paylater, payment
+ //check for various combinations for paylater, payment
//process with paid event.
if ($isMonetary && (!$isPayLater || !empty($this->_values['event']['payment_processor']))) {
- $ppID = CRM_Utils_Array::value('payment_processor',
+ $this->_paymentProcessorIDs = explode(CRM_Core_DAO::VALUE_SEPARATOR, CRM_Utils_Array::value('payment_processor',
$this->_values['event']
- );
- if (!$ppID) {
- CRM_Core_Error::statusBounce(ts('A payment processor must be selected for this event registration page, or the event must be configured to give users the option to pay later (contact the site administrator for assistance).'), $infoUrl);
- }
- $ppIds = explode(CRM_Core_DAO::VALUE_SEPARATOR, $ppID);
- $this->_paymentProcessors = CRM_Financial_BAO_PaymentProcessor::getPayments($ppIds,
- $this->_mode
- );
- $this->set('paymentProcessors', $this->_paymentProcessors);
-
- //set default payment processor
- if (!empty($this->_paymentProcessors) && empty($this->_paymentProcessor)) {
- foreach ($this->_paymentProcessors as $ppId => $values) {
- if ($values['is_default'] == 1 || (count($this->_paymentProcessors) == 1)) {
- $defaultProcessorId = $ppId;
- break;
- }
- }
- }
+ ));
+ $this->assignPaymentProcessor();
- if (isset($defaultProcessorId)) {
- $this->_paymentProcessor = CRM_Financial_BAO_PaymentProcessor::getPayment($defaultProcessorId, $this->_mode);
- }
- // make sure we have a valid payment class, else abort
- if ($this->_values['event']['is_monetary']) {
- if (!CRM_Utils_System::isNull($this->_paymentProcessors)) {
- foreach ($this->_paymentProcessors as $eachPaymentProcessor) {
- // check selected payment processor is active
- if (!$eachPaymentProcessor) {
- CRM_Core_Error::fatal(ts('The site administrator must set a Payment Processor for this event in order to use online registration.'));
- }
- // ensure that processor has a valid config
- $payment = CRM_Core_Payment::singleton($this->_mode, $eachPaymentProcessor, $this);
- $error = $payment->checkConfig();
- if (!empty($error)) {
- CRM_Core_Error::fatal($error);
- }
- }
- }
- }
}
//init event fee.
self::initEventFee($this, $this->_eventId);
/**
* Get the payment processor details.
*
+ * @deprecated Use Civi\Payment\System::singleton->getByID();
+ *
* @param int $paymentProcessorID
* Payment processor id.
* @param string $mode
));
}
- /**
- * User getPaymentProcessors.
- *
- * @deprecated
- *
- * @param $paymentProcessorIDs
- * @param $mode
- *
- * @return array
- * @throws Exception
- */
- public static function getPayments($paymentProcessorIDs, $mode) {
- if (!$paymentProcessorIDs) {
- CRM_Core_Error::fatal(ts('Invalid value passed to getPayment function'));
- }
-
- $payments = array();
- foreach ($paymentProcessorIDs as $paymentProcessorID) {
- $payment = self::getPayment($paymentProcessorID, $mode);
- $payments[$payment['id']] = $payment;
- }
-
- uasort($payments, 'self::defaultComparison');
- return $payments;
- }
-
/**
* Compare 2 payment processors to see which should go first based on is_default
* (sort function for sortDefaultFirst)
/**
* Build payment processor details.
*
+ * @deprecated
+ *
* @param object $dao
* Payment processor object.
* @param string $mode
* @return array
* associated array with payment processor related fields
*/
- public static function buildPayment($dao, $mode) {
+ protected static function buildPayment($dao, $mode) {
$fields = array(
'id',
'name',
<div id="billing-payment-block">
{* If we have a payment processor, load it - otherwise it happens via ajax *}
{if $paymentProcessorID or $isBillingAddressRequiredForPayLater}
- {include file="CRM/Event/Form/Registration/Register.tpl" snippet=4}
+ {include file="CRM/Financial/Form/Payment.tpl" snippet=4}
{/if}
</div>
{include file="CRM/common/paymentBlock.tpl"}
{/literal}
</script>
-{/if}
+
{literal}
<script type="text/javascript">
{/literal}{if $pcp && $is_honor_roll }pcpAnonymous();
{/literal}{/if}{literal}
}
- {/literal}{if $pcp && $is_honor_roll }{literal}
+ {/literal}
+ {if $pcp && $is_honor_roll }{literal}
function pcpAnonymous() {
// clear nickname field if anonymous is true
if (document.getElementsByName("pcp_is_anonymous")[1].checked) {
}
}
}
- {/literal}{literal}
+ {/literal}
+ {/if}
+ {literal}
</script>
{/literal}