本文整理汇总了PHP中EE_Transaction::save方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Transaction::save方法的具体用法?PHP EE_Transaction::save怎么用?PHP EE_Transaction::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::save方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
/**
* init
*
* @access public
* @return void
*/
public function init()
{
$this->_get_reg_url_link();
if (!$this->get_txn()) {
EE_Registry::instance()->load_helper('HTML');
echo EEH_HTML::div(EEH_HTML::h4(__('We\'re sorry...', 'event_espresso'), '', '') . sprintf(__('This is a system page for displaying transaction information after a purchase.%1$sYou are most likely seeing this notice because you have navigated to this page%1$sthrough some means other than completing a transaction.%1$sSorry for the disappointment, but you will most likely find nothing of interest here.%1$s%1$s', 'event_espresso'), '<br/>'), '', 'ee-attention');
return NULL;
}
// 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;
$show_try_pay_again_link_default = apply_filters('AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE);
// txn status ?
if ($this->_current_txn->is_completed()) {
$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
} 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 : $show_try_pay_again_link_default;
} else {
$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
}
}
}
$this->_payments_closed = !$this->_current_txn->payment_method() instanceof EE_Payment_Method ? TRUE : FALSE;
if (!$this->_current_txn->payment_method() instanceof EE_Payment_Method || $this->_current_txn->payment_method() instanceof EE_Payment_Method && $this->_current_txn->payment_method()->is_off_line()) {
$this->_is_offline_payment_method = true;
} else {
$this->_is_offline_payment_method = false;
}
// 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);
// set no cache headers and constants
EE_System::do_not_cache();
}
示例2: init
/**
* init
*
* @access public
* @return void
*/
public function init()
{
$this->_get_reg_url_link();
if (!$this->get_txn()) {
return NULL;
}
// 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;
$show_try_pay_again_link_default = apply_filters('AFEE__EES_Espresso_Thank_You__init__show_try_pay_again_link_default', TRUE);
// txn status ?
if ($this->_current_txn->is_completed()) {
$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
} 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 : $show_try_pay_again_link_default;
} else {
$this->_show_try_pay_again_link = $show_try_pay_again_link_default;
}
}
}
$this->_payments_closed = !$this->_current_txn->payment_method() instanceof EE_Payment_Method ? TRUE : FALSE;
if (!$this->_current_txn->payment_method() instanceof EE_Payment_Method || $this->_current_txn->payment_method() instanceof EE_Payment_Method && $this->_current_txn->payment_method()->is_off_line()) {
$this->_is_offline_payment_method = true;
} else {
$this->_is_offline_payment_method = false;
}
// 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);
// set no cache headers and constants
EE_System::do_not_cache();
}
示例3: init
/**
* 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);
}
示例4: _process_finalize_registration
/**
* _process_finalize_registration
*
* @access private
* @return void
*/
private function _process_finalize_registration()
{
do_action('AHEE_log', __FILE__, __FUNCTION__, '');
// save everything
if ($this->_continue_reg && $this->_save_all_registration_information()) {
// echo '<h2 style="color:#E76700;">_process_finalize_registration<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>';
// save TXN data to the cart
$this->_cart->get_grand_total()->save_this_and_descendants_to_txn($this->_transaction->ID());
do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->_transaction);
// if Default REG Status is set to REQUIRES APPROVAL... then payments are NOT allowed
if (EE_Registry::instance()->REQ->is_set('selected_gateway') && EE_Registry::instance()->REQ->get('selected_gateway') == 'payments_closed') {
// echo '<h2 style="color:#E76700;">payments_closed<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>';
// set TXN Status to Open
$this->_transaction->set_status(EEM_Transaction::incomplete_status_code);
$this->_transaction->save();
$this->_transaction->finalize();
$notices = EE_Error::get_notices(FALSE);
$response = array('msg' => array('success' => isset($notices['success']) ? $notices['success'] : '', 'errors' => isset($notices['errors']) ? $notices['errors'] : ''));
$this->_thank_you_page_url = add_query_arg(array('e_reg_url_link' => $this->_transaction->primary_registration()->reg_url_link()), get_permalink(EE_Registry::instance()->CFG->core->thank_you_page_id));
// Default REG Status is set to PENDING PAYMENT OR APPROVED, and payments are allowed
} else {
// attempt to perform transaction via payment gateway
$response = EE_Registry::instance()->load_model('Gateways')->process_payment_start($this->_cart->get_grand_total(), $this->_transaction);
$this->_thank_you_page_url = $response['forward_url'];
}
if (isset($response['msg']['success'])) {
$response_data = array('success' => $response['msg']['success'], 'return_data' => array('redirect-to-thank-you-page' => $this->_thank_you_page_url));
$response_data = apply_filters('FHEE__EE_Single_Page_Checkout__JSON_response', $response_data);
// printr( $response_data, '$response_data <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
// echo '<h4>thank_you_page_url : ' . $this->_thank_you_page_url . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
if (EE_Registry::instance()->REQ->front_ajax) {
echo json_encode($response_data);
die;
} else {
wp_safe_redirect($this->_thank_you_page_url);
exit;
}
} else {
EE_Error::add_error($response['msg']['error'], __FILE__, __FUNCTION__, __LINE__);
}
// printr( $response, '$response <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
}
$this->go_to_next_step(__FUNCTION__);
}
示例5: save_all_data
/**
* save_all_data
* simply loops through the current transaction and saves all data for each registration
*
* @access public
* @param bool $show_errors
* @return bool
*/
public function save_all_data($show_errors = TRUE)
{
// verify the transaction
if ($this->transaction instanceof EE_Transaction) {
// save to ensure that TXN has ID
$this->transaction->save();
// grab the saved registrations from the transaction
foreach ($this->transaction->registrations($this->reg_cache_where_params) as $registration) {
$this->_save_registration($registration, $show_errors);
}
} else {
if ($show_errors) {
EE_Error::add_error(__('A valid Transaction was not found when attempting to save your registration information.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
}
return FALSE;
}
return TRUE;
}
示例6: update_transaction_status_based_on_total_paid
/**
* possibly toggles TXN status
*
* @param EE_Transaction $transaction
* @param boolean $update_txn whether to save the TXN
* @return boolean whether the TXN was saved
* @throws \EE_Error
*/
public function update_transaction_status_based_on_total_paid(EE_Transaction $transaction, $update_txn = TRUE)
{
// verify transaction
if (!$transaction instanceof EE_Transaction) {
EE_Error::add_error(__('Please provide a valid EE_Transaction object.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return FALSE;
}
// set incoming TXN_Status
$this->set_old_txn_status($transaction->status_ID());
// set transaction status based on comparison of TXN_paid vs TXN_total
if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '>')) {
$new_txn_status = EEM_Transaction::overpaid_status_code;
} else {
if (EEH_Money::compare_floats($transaction->paid(), $transaction->total())) {
$new_txn_status = EEM_Transaction::complete_status_code;
} else {
if (EEH_Money::compare_floats($transaction->paid(), $transaction->total(), '<')) {
$new_txn_status = EEM_Transaction::incomplete_status_code;
} else {
EE_Error::add_error(__('The total paid calculation for this transaction is inaccurate.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__);
return FALSE;
}
}
}
if ($new_txn_status !== $transaction->status_ID()) {
// set incoming TXN_Status
$this->set_new_txn_status($new_txn_status);
$transaction->set_status($new_txn_status);
if ($update_txn) {
return $transaction->save() ? TRUE : FALSE;
}
}
return FALSE;
}
示例7: thank_you_page_logic
/**
* Logic general to all gateways on the thank you page. Mostly just updates the transaction
* @param EE_Transaction $transaction
* @return boolean
*/
public function thank_you_page_logic(EE_Transaction $transaction)
{
// save the transaction to the db in case anything changed
$transaction->save();
return true;
}
示例8: _set_reg_step_completed_status
/**
* set_reg_step_completed
* given a valid reg step slug, this sets the TXN_reg_step completed status which is either:
*
*
* @access private
* @param \EE_Transaction $transaction
* @param string $reg_step_slug
* @param boolean | int $status
* @return boolean
*/
private function _set_reg_step_completed_status(EE_Transaction $transaction, $reg_step_slug, $status)
{
// validate status
$status = is_bool($status) || is_numeric($status) ? $status : false;
// get reg steps array
$txn_reg_steps = $transaction->reg_steps();
// if reg step does NOT exist
if (!isset($txn_reg_steps[$reg_step_slug])) {
return false;
}
// if we're trying to complete a step that is already completed
if ($txn_reg_steps[$reg_step_slug] === true) {
return true;
}
// if we're trying to complete a step that hasn't even started
if ($status === true && $txn_reg_steps[$reg_step_slug] === false) {
return false;
}
// if current status value matches the incoming value (no change)
if ($txn_reg_steps[$reg_step_slug] === $status) {
// this will happen in cases where multiple AJAX requests occur during the same step
return true;
}
// if we're trying to set a start time
if (is_numeric($status) && is_numeric($txn_reg_steps[$reg_step_slug])) {
// skip the update below, but don't return FALSE so that errors won't be displayed
return true;
}
// update completed status
$txn_reg_steps[$reg_step_slug] = $status;
$transaction->set_reg_steps($txn_reg_steps);
$transaction->save();
// DEBUG LOG
//$this->log(
// __CLASS__, __FUNCTION__, __LINE__,
// $transaction,
// array(
// 'reg_step_slug' => $reg_step_slug,
// 'status' => $status,
// )
//);
return true;
}
示例9: _clean_billing_info_in_session
/**
* Cleans the session so that it doesn't store the credit card or CVV to the DB
* @param EE_Transaction $transaction to also update
* @return void
*/
protected function _clean_billing_info_in_session($transaction)
{
$session_data = EE_Registry::instance()->SSN->get_session_data();
if (isset($session_data['billing_info']) && is_array($session_data['billing_info'])) {
foreach ($session_data['billing_info'] as $name => $billing_input_array) {
if ($billing_input_array['sanitize'] == 'ccard') {
$session_data['billing_info'][$name]['value'] = $this->MaskCreditCard($billing_input_array['value']);
} elseif ($billing_input_array['sanitize'] == 'ccv') {
$session_data['billing_info'][$name]['value'] = '';
}
}
}
$success = EE_Registry::instance()->SSN->update($session_data);
unset($session_data['transaction']);
$transaction->set_txn_session_data($session_data);
$transaction->save();
}
示例10: _maybe_chained
/**
* This handles connecting a transaction to related items when the chained flag is true.
*
* @since 4.3.0
*
* @param EE_Transaction $transaction
* @param array $args incoming arguments from caller for specifying overrides.
*
* @return EE_Transaction
*/
private function _maybe_chained(EE_Transaction $transaction, $args)
{
if ($this->_chained) {
if (empty($this->_status)) {
$this->_set_repeated_relation($args, $transaction->ID());
}
//YES we DO want to set brand new relation objects because multiple transactions do not share the same related objects (for the purpose of tests at least)
$this->_set_new_relations($args, $transaction->ID());
//note relation to registration should already be set via the factory->registration_chained->create() method.
//add relation to status
$transaction->_add_relation_to($this->_status, 'Status');
$transaction->save();
return $transaction;
}
return $transaction;
}
开发者ID:DavidSteinbauer,项目名称:event-espresso-core,代码行数:26,代码来源:EE_UnitTest_Factory_For_Transaction.class.php
示例11: toggle_failed_transaction_status
/**
* toggle_failed_transaction_status
* upgrades a TXNs status from failed to abandoned,
* meaning that contact information has been captured for at least one registrant
*
* @access public
* @param EE_Transaction $transaction
* @return boolean
* @throws \EE_Error
*/
public function toggle_failed_transaction_status(EE_Transaction $transaction)
{
$existing_txn_status = $transaction->status_ID();
// set incoming TXN_Status
$this->set_old_txn_status($existing_txn_status);
// if TXN status is still set as "failed"...
if ($existing_txn_status === EEM_Transaction::failed_status_code) {
// set incoming TXN_Status
$this->set_new_txn_status(EEM_Transaction::abandoned_status_code);
$transaction->set_status(EEM_Transaction::abandoned_status_code);
$transaction->save();
return TRUE;
}
return FALSE;
}