/** * run - initial shortcode module setup called during "wp_loaded" hook * this method is primarily used for loading resources that will be required by the shortcode when it is actually processed * * @access public * @param WP $WP * @return void */ public function run(WP $WP) { if (EE_Registry::instance()->REQ->is_set('e_reg_url_link') && EE_Registry::instance()->REQ->is_set('ee_gateway')) { $this->_current_txn = EE_Registry::instance()->load_model('Transaction')->get_transaction_from_reg_url_link(); EEM_Gateways::instance()->set_selected_gateway(EE_Registry::instance()->REQ->get('ee_gateway')); EEM_Gateways::instance()->handle_ipn_for_transaction($this->_current_txn); } }
/** * assuming we have an up-to-date database schema, this will populate it * with default and initial data. This should be called * upon activation of a new plugin, reactivation, and at the end * of running migration scripts */ public static function initialize_db_content() { // echo"init reg content"; EEH_Activation::initialize_system_questions(); // EEH_Activation::insert_default_prices(); // EEH_Activation::insert_defaulinsert_default_pricest_price_types(); // EEH_Activation::insert_default_tickets(); EEH_Activation::insert_default_status_codes(); // default countries and states actually takes place during data migration scripts // because converting state and coutnry names to foreign keys must occur for venues, attendees, etc // EEH_Activation::insert_default_countries(); // EEH_Activation::insert_default_states(); EEH_Activation::generate_default_message_templates(); EEH_Activation::create_no_ticket_prices_array(); //also initialize payment settings, which is a side-effect of calling //EEM_Gateway::load_all_gateways() EEM_Gateways::instance(true)->load_all_gateways(); //also, check for CAF default db content do_action('AHEE__EEH_Activation__initialize_db_content'); //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages //which users really won't care about on initial activation EE_Error::overwrite_success(); }
/** * Saves the cleaned billing info to the trasnaction's primary registration's attendee. * @param array $billing_info where keys are keys in the espresso_reg_page_billing_inputs()'s array, values are their * cleaned values. * @param EE_Transaction $transaction * @return boolean */ protected function _save_billing_info_to_attendee($billing_info, $transaction) { if (!$transaction || !$transaction instanceof EE_Transaction) { EE_Error::add_error(__("Cannot save billing info because no transaction was specified", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); return false; } $primary_reg = $transaction->primary_registration(); if (!$primary_reg) { EE_Error::add_error(__("Cannot save billing info because the transaction has no primary registration", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); return false; } $attendee_id = $primary_reg->attendee_ID(); if (!$attendee_id) { EE_Error::add_error(__("Cannot save billing info because the transaction's primary registration has no attendee!", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); return false; } $billing_input_field_settings = $this->espresso_reg_page_billing_inputs(); $billing_info_ready_for_saving = array(); foreach ($billing_input_field_settings as $field_name => $settings) { $cleaned_value = isset($billing_info[$field_name]) && isset($billing_info[$field_name]['value']) ? $billing_info[$field_name]['value'] : null; if ($settings['sanitize'] == 'ccv') { //dont save ccv data continue; } elseif ($settings['sanitize'] == 'ccard') { $billing_info_ready_for_saving[$field_name] = EEM_Gateways::instance()->MaskCreditCard($cleaned_value); } else { //all others save normally $billing_info_ready_for_saving[$field_name] = $cleaned_value; } } $success = update_post_meta($attendee_id, 'billing_info_' . $this->_gateway_name, $billing_info_ready_for_saving); return $success; }
/** * Update lead status of the specified payment * * @param Pronamic_Pay_Payment $payment * @param bool $can_redirect */ public function update_status_unknown_to_success(Pronamic_Pay_Payment $payment, $can_redirect = false) { if (!(version_compare(EVENT_ESPRESSO_VERSION, '4', '>=') && version_compare(EVENT_ESPRESSO_VERSION, '4.6', '<'))) { return; } // Eevent Espresso 4.0 to 4.6 $gateway = EEM_Gateways::instance()->get_gateway('pronamic_pay_ideal'); if ($gateway) { $transaction_id = $payment->get_source_id(); // @see https://github.com/eventespresso/event-espresso-core/blob/4.2.2.reg/admin_pages/transactions/Transactions_Admin_Page.core.php#L332-L337 $transaction_model = EEM_Transaction::instance(); $transaction = $transaction_model->get_one_by_ID($transaction_id); global $pronamic_payment, $pronamic_url; $pronamic_payment = $payment; $gateway->handle_ipn_for_transaction($transaction); unset($pronamic_payment); // Redirect URL if ($can_redirect) { wp_redirect($pronamic_url, 303); exit; } } }
/** * Gets the payment overview content from the gateway used on this payment. * @return string */ public function gateway_payment_overview_content() { $gateway_name = $this->gateway(); $EEM_Gateways = EEM_Gateways::instance(); //call its render payment results, feeding it the current payment return $EEM_Gateways->get_payment_overview_content($gateway_name, $this); }
/** * get_payment_details * * @access public * @param array $payments * @return string */ public function get_payment_details($payments = array()) { //prepare variables for displaying $template_args = array(); $template_args['transaction'] = $this->_current_txn; $template_args['reg_url_link'] = $this->_reg_url_link; $template_args['payments'] = array(); foreach ($payments as $payment) { $template_args['payments'][] = $this->get_payment_row_html($payment); } //create a hacky payment object, but dont save it $gateway_name = $this->_current_txn->selected_gateway(); $payment = EE_Payment::new_instance(array('TXN_ID' => $this->_current_txn->ID(), 'STS_ID' => EEM_Payment::status_id_pending, 'PAY_timestamp' => current_time('timestamp'), 'PAY_amount' => $this->_current_txn->total(), 'PAY_gateway' => $gateway_name)); $template_args['gateway_content'] = EEM_Gateways::instance()->get_payment_overview_content($gateway_name, $payment); // link to SPCO payment_options $template_args['show_try_pay_again_link'] = $this->_show_try_pay_again_link; $template_args['SPCO_payment_options_url'] = $this->_SPCO_payment_options_url; // verify template arguments EEH_Template_Validator::verify_instanceof($template_args['transaction'], '$transaction', 'EE_Transaction'); EEH_Template_Validator::verify_isnt_null($template_args['payments'], '$payments'); EEH_Template_Validator::verify_isnt_null($template_args['show_try_pay_again_link'], '$show_try_pay_again_link'); EEH_Template_Validator::verify_isnt_null($template_args['gateway_content'], '$gateway_content'); EEH_Template_Validator::verify_isnt_null($template_args['SPCO_payment_options_url'], '$SPCO_payment_options_url'); return EEH_Template::locate_template(THANK_YOU_TEMPLATES_PATH . 'thank-you-page-payment-details.template.php', $template_args, TRUE, TRUE); }
protected function _gateway_settings() { require_once EE_MODELS . 'EEM_Gateways.model.php'; $EEM_Gateways = EEM_Gateways::instance(); EE_Registry::instance()->load_helper('Tabbed_Content'); $gateway_instances = $EEM_Gateways->get_gateway_instances(); $payment_settings = EE_Registry::instance()->CFG->gateway->payment_settings; //get_user_meta($current_user->ID, 'payment_settings', true); //lets add all the metaboxes foreach ($gateway_instances as $gate_obj) { $gate_obj->add_settings_page_meta_box(); } //printr( $gateway_data, '$gateway_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); $selected_gateway_name = null; $gateways = array(); //let's assemble the array for the _tab_text_links helper foreach ($payment_settings as $gateway => $settings) { if (isset($this->_req_data['activate_' . $gateway]) || isset($this->_req_data['deactivate_' . $gateway]) || isset($this->_req_data['update_' . $gateway])) { $selected_gateway_name = $gateway; } // now add or remove gateways from list if (isset($this->_req_data['activate_' . $gateway])) { //bandaid to fix bug where gateways wouldn't appear active on firsrt pag eload after activating them $EEM_Gateways->set_active($gateway); } if (isset($this->_req_data['deactivate_' . $gateway])) { //bandaid to fix bug where gateways wouldn't appear active on firsrt pag eload after activating them $EEM_Gateways->unset_active($gateway); } $gateways[$gateway] = array('label' => isset($settings['display_name']) ? $settings['display_name'] : ucwords(str_replace('_', ' ', $gateway)), 'class' => isset(EE_Registry::instance()->CFG->gateway->active_gateways[$gateway]) ? 'gateway-active' : '', 'href' => 'espresso_' . str_replace(' ', '_', $gateway) . '_payment_settings', 'title' => __('Modify this Gateway', 'event_espresso'), 'slug' => $gateway); } if (!$selected_gateway_name) { // $default = !empty( $gateway_data['active_gateways'] ) ? key($gateway_data['active_gateways']) : 'Paypal_Standard'; $selected_gateway_name = !empty($gateways) ? key($gateways) : 'Paypal_Standard'; } //$gateways = isset( $gateways ) ? $gateways : array(); //printr( $gateways, '$gateways <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' ); $this->_template_args['admin_page_header'] = EEH_Tabbed_Content::tab_text_links($gateways, 'gateway_links', '|', $selected_gateway_name); $this->display_admin_page_with_sidebar(); }