/** * init * * @access public * @return void */ public function init() { //get the transaction. yes, we may have just loaded it, but it may have been updated, or this may be via an ajax request $this->_current_txn = EE_Registry::instance()->load_model('Transaction')->get_transaction_from_reg_url_link($this->_reg_url_link); // verify TXN if (!$this->_current_txn instanceof EE_Transaction) { EE_Error::add_error(__('No transaction information could be retrieved or the transaction data is not of the correct type.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); return; } // if we've made it to the Thank You page, then let's toggle any "Failed" transactions to "Incomplete" if ($this->_current_txn->status_ID() == EEM_Transaction::failed_status_code) { $this->_current_txn->set_status(EEM_Transaction::incomplete_status_code); $this->_current_txn->save(); } $this->_primary_registrant = $this->_current_txn->primary_registration() instanceof EE_Registration ? $this->_current_txn->primary_registration() : NULL; $this->_is_primary = $this->_primary_registrant->reg_url_link() == $this->_reg_url_link ? TRUE : FALSE; // txn status ? if ($this->_current_txn->is_completed()) { $this->_show_try_pay_again_link = FALSE; } else { if ($this->_current_txn->is_incomplete() && ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment())) { $this->_show_try_pay_again_link = TRUE; } else { if ($this->_primary_registrant->is_approved() || $this->_primary_registrant->is_pending_payment()) { // its pending $this->_show_try_pay_again_link = isset(EE_Registry::instance()->CFG->registration->show_pending_payment_options) && EE_Registry::instance()->CFG->registration->show_pending_payment_options ? TRUE : FALSE; } else { $this->_show_try_pay_again_link = FALSE; } } } $this->_is_offline_payment_method = in_array($this->_current_txn->selected_gateway(TRUE), array('Bank', 'Check', 'Invoice')); if ($this->_current_txn->last_payment() instanceof EE_Payment && $this->_current_txn->last_payment()->gateway() != NULL) { $this->_is_offline_payment_method = in_array($this->_current_txn->last_payment()->gateway(), array('Bank', 'Check', 'Invoice')); } // link to SPCO $revisit_spco_url = add_query_arg(array('ee' => '_register', 'revisit' => TRUE, 'e_reg_url_link' => $this->_reg_url_link), EE_Registry::instance()->CFG->core->reg_page_url()); // link to SPCO payment_options $this->_SPCO_payment_options_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->payment_overview_url() : add_query_arg(array('step' => 'payment_options'), $revisit_spco_url); // link to SPCO attendee_information $this->_SPCO_attendee_information_url = $this->_primary_registrant instanceof EE_Registration ? $this->_primary_registrant->edit_attendee_information_url() : FALSE; EE_Registry::instance()->load_helper('Template'); EE_Registry::instance()->load_helper('Template_Validator'); do_action('AHEE__EES_Espresso_Thank_You__init_end', $this->_current_txn); }
/** * Logic to be accomplished when the payment attempt is complete. * Most payment methods don't need to do anything at this point; but some, like Mijireh, do. * (Mijireh is an offsite gateway which doesn't send an IPN. So when the user returns to EE from * mijireh, this method needs to be called so the Mijireh PM can ping Mijireh to know the status * of the payment). Fed a transaction because it's always assumed to be the last payment that * we're dealing with. Returns that last payment (if there is one) * * @param EE_Transaction $transaction * @return EE_Payment */ public function finalize_payment_for($transaction) { return $transaction->last_payment(); }
/** * refresh_entity_map * simply loops through the current transaction and updates each * model's entity map using EEM_Base::refresh_entity_map_from_db() * * @access public * @return bool */ protected function refresh_from_db() { // verify the transaction if ($this->transaction instanceof EE_Transaction && $this->transaction->ID()) { // pull fresh TXN data from the db $this->transaction = $this->transaction->get_model()->refresh_entity_map_from_db($this->transaction->ID()); // update EE_Checkout's cached primary_attendee object $this->primary_attendee_obj = $this->_refresh_primary_attendee_obj_from_db($this->transaction); // update EE_Checkout's cached payment object $payment = $this->transaction->last_payment(); $this->payment = $payment instanceof EE_Payment ? $payment : $this->payment; // update EE_Checkout's cached payment_method object $payment_method = $this->payment instanceof EE_Payment ? $this->payment->payment_method() : null; $this->payment_method = $payment_method instanceof EE_Payment_Method ? $payment_method : $this->payment_method; //now refresh the cart, based on the TXN $this->cart = EE_Cart::get_cart_from_txn($this->transaction); // verify cart if (!$this->cart instanceof EE_Cart) { $this->cart = EE_Registry::instance()->load_core('Cart'); } } else { EE_Error::add_error(__('A valid Transaction was not found when attempting to update the model entity mapper.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); return FALSE; } return TRUE; }