// return if this is express mode
$config = CRM_Core_Config::singleton();
- if ($self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON) {
+ if ($self->_paymentProcessor &&
+ $self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON
+ ) {
if (CRM_Utils_Array::value($self->_expressButtonName . '_x', $fields) ||
CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) ||
CRM_Utils_Array::value($self->_expressButtonName, $fields)
// if the user has chosen a free membership or the amount is less than zero
// i.e. we skip calling the payment processor and hence dont need credit card
// info
- if ((float ) $amount <= 0.0) {
+ if ((float) $amount <= 0.0) {
return $errors;
}
// default mode is direct
$this->set('contributeMode', 'direct');
- if ($this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON) {
+ if ($this->_paymentProcessor &&
+ $this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON
+ ) {
//get the button name
$buttonName = $this->controller->getButtonName();
if (in_array($buttonName,
CRM_Utils_System::redirect($paymentURL);
}
}
- elseif ($this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_NOTIFY) {
+ elseif ($this->_paymentProcessor &&
+ $this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_NOTIFY
+ ) {
$this->set('contributeMode', 'notify');
}
}
$paymentProcessors = $form->get('paymentProcessors');
$form->_ppType = NULL;
if ($paymentProcessors) {
- // Fetch type during form post
- if (CRM_Utils_Array::value('hidden_processor', $_POST)) {
- $form->_ppType = CRM_Utils_Array::value('payment_processor', $_POST);
- $form->set('type', $form->_ppType);
- $form->set('mode', $form->_mode);
- $form->set('paymentProcessor', $form->_paymentProcessor);
+ // Fetch type during ajax request
+ if (isset($_GET['type']) && $form->_snippet) {
+ $form->_ppType = $_GET['type'];
}
- // When user presses the back button
+ // Remember type during form post
elseif (!empty($form->_submitValues)) {
$form->_ppType = CRM_Utils_Array::value('payment_processor', $form->_submitValues);
- }
- // Fetch type during ajax request
- elseif (isset($_GET['type']) && $form->_snippet) {
- $form->_ppType = $_GET['type'];
+ $form->_paymentProcessor = CRM_Utils_Array::value($form->_ppType, $paymentProcessors);
+ $form->set('type', $form->_ppType);
+ $form->set('mode', $form->_mode);
+ $form->set('paymentProcessor', $form->_paymentProcessor);
}
// Set default payment processor
else {
foreach ($paymentProcessors as $values) {
if (!empty($values['is_default']) || count($paymentProcessors) == 1) {
$form->_ppType = $values['id'];
+ break;
}
}
}
$config = CRM_Core_Config::singleton();
if (isset($this->_values['is_recur']) &&
- $this->_paymentProcessor['is_recur']
+ CRM_Utils_Array::value('is_recur', $this->_paymentProcessor)
) {
$this->assign('is_recur_enabled', 1);
$vars = array_merge($vars, array(
}
if ($this->_contributeMode == 'direct' && $assignCCInfo) {
- if ($this->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT) {
+ if ($this->_paymentProcessor &&
+ $this->_paymentProcessor['payment_type'] & CRM_Core_Payment::PAYMENT_TYPE_DIRECT_DEBIT
+ ) {
$this->assign('payment_type', $this->_paymentProcessor['payment_type']);
$this->assign('account_holder', $this->_params['account_holder']);
$this->assign('bank_identification_number', $this->_params['bank_identification_number']);
}
// return if this is express mode
$config = CRM_Core_Config::singleton();
- if ($self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON) {
+ if ($self->_paymentProcessor &&
+ $self->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON
+ ) {
if (CRM_Utils_Array::value($self->_expressButtonName . '_x', $fields) ||
CRM_Utils_Array::value($self->_expressButtonName . '_y', $fields) ||
CRM_Utils_Array::value($self->_expressButtonName, $fields)
$this->_params[] = $params;
$this->set('params', $this->_params);
- if ($this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON) {
+ if ($this->_paymentProcessor &&
+ $this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_BUTTON
+ ) {
//get the button name
$buttonName = $this->controller->getButtonName();
if (in_array($buttonName,
CRM_Utils_System::redirect($paymentURL);
}
}
- elseif ($this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_NOTIFY) {
+ elseif ($this->_paymentProcessor &&
+ $this->_paymentProcessor['billing_mode'] & CRM_Core_Payment::BILLING_MODE_NOTIFY
+ ) {
$this->set('contributeMode', 'notify');
}
}