/** * switch_payment_method * * @access public * @return string */ public function switch_payment_method() { if (!$this->_verify_payment_method_is_set()) { return FALSE; } if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { EE_Error::add_success(apply_filters('FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()))); } // generate billing form for selected method of payment if it hasn't been done already if ($this->checkout->payment_method->type_obj()->has_billing_form()) { $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); } // fill form with attendee info if applicable if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { $this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); } // and debug content if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form); } // get html and validation rules for form if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { $this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html())); // localize validation rules for main form $this->checkout->billing_form->localize_validation_rules(TRUE); $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); } else { $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); } //prevents advancement to next step $this->checkout->continue_reg = FALSE; return TRUE; }
/** * @return string */ public function display_reg_form() { $html = ''; if ($this->reg_form instanceof EE_Form_Section_Proper) { $html .= !$this->checkout->admin_request ? $this->reg_form->form_open($this->reg_step_url()) : ''; if (EE_Registry::instance()->REQ->ajax) { $this->reg_form->localize_validation_rules(); $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); $html .= $this->reg_form->get_html(); } else { $html .= $this->reg_form->get_html_and_js(); } $html .= !$this->checkout->admin_request ? $this->reg_step_submit_button() : ''; $html .= !$this->checkout->admin_request ? $this->reg_form->form_close() : ''; } return $html; }
/** * get_billing_form_html_for_payment_method * * @access public * @return string */ public function get_billing_form_html_for_payment_method() { // how have they chosen to pay? $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); if (!$this->checkout->payment_method instanceof EE_Payment_Method) { return FALSE; } if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { EE_Error::add_success(apply_filters('FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()))); } // now generate billing form for selected method of payment $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method, FALSE); // fill form with attendee info if applicable if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { $payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); } // and debug content if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form); } $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : ''; $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); // localize validation rules for main form $this->checkout->current_step->reg_form->localize_validation_rules(); $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); return TRUE; }