本文整理汇总了PHP中EE_Transaction::paid方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Transaction::paid方法的具体用法?PHP EE_Transaction::paid怎么用?PHP EE_Transaction::paid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::paid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send_invoice
public function send_invoice($download = FALSE)
{
$template_args = array();
$EE = EE_Registry::instance();
//allow the request to override the default theme defined in the invoice settings
$theme_requested = isset($_REQUEST['theme']) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8 ? absint($_REQUEST['theme']) : null;
$themes = array(1 => "simple.css", 2 => "bauhaus.css", 3 => "ejs.css", 4 => "horizon.css", 5 => "lola.css", 6 => "tranquility.css", 7 => "union.css");
//Get the CSS file
if (isset($themes[$theme_requested])) {
$template_args['invoice_css'] = $themes[$theme_requested];
} else {
$template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta('legacy_invoice_css', TRUE, 'simple.css');
}
if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) {
$template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/';
} else {
$template_args['base_url'] = EE_GATEWAYS . '/Invoice/lib/templates/';
}
$primary_attendee = $this->transaction->primary_registration()->attendee();
$template_args['organization'] = $EE->CFG->organization->get_pretty('name');
$template_args['street'] = empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1') . '<br>' . $EE->CFG->organization->get_pretty('address_2');
$template_args['city'] = $EE->CFG->organization->get_pretty('city');
$template_args['state'] = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID);
$template_args['country'] = EE_Registry::instance()->load_model('Country')->get_one_by_ID($EE->CFG->organization->CNT_ISO);
$template_args['zip'] = $EE->CFG->organization->get_pretty('zip');
$template_args['email'] = $EE->CFG->organization->get_pretty('email');
$template_args['registration_code'] = $this->registration->reg_code();
$template_args['registration_date'] = $this->registration->date();
$template_args['name'] = $primary_attendee->full_name();
$template_args['attendee_address'] = $primary_attendee->address();
$template_args['attendee_address2'] = $primary_attendee->address2();
$template_args['attendee_city'] = $primary_attendee->city();
$attendee_state = $primary_attendee->state_obj();
if ($attendee_state) {
$attendee_state_name = $attendee_state->name();
} else {
$attendee_state_name = '';
}
$template_args['attendee_state'] = $attendee_state_name;
$template_args['attendee_zip'] = $primary_attendee->zip();
$template_args['ship_name'] = $template_args['name'];
$template_args['ship_address'] = $template_args['attendee_address'];
$template_args['ship_city'] = $template_args['attendee_city'];
$template_args['ship_state'] = $template_args['attendee_state'];
$template_args['ship_zip'] = $template_args['attendee_zip'];
$template_args['total_cost'] = number_format($this->transaction->total(), 2, '.', '');
$template_args['transaction'] = $this->transaction;
$template_args['amount_pd'] = $this->transaction->paid();
$template_args['amount_owed'] = $this->transaction->total() - $this->transaction->paid();
$template_args['payments'] = $this->transaction->approved_payments();
$template_args['net_total'] = '';
$template_args['edit_reg_info_url'] = $this->registration->edit_attendee_information_url();
$template_args['retry_payment_url'] = $this->registration->payment_overview_url();
$template_args['show_line_item_description'] = $this->check_if_any_line_items_have_a_description($this->transaction->total_line_item());
if ($template_args['amount_pd'] != $template_args['total_cost']) {
//$template_args['net_total'] = $this->espressoInvoiceTotals( __('SubTotal', 'event_espresso'), $this->transaction->total());//$this->session_data['cart']['REG']['sub_total']);
$tax_items = $this->transaction->tax_items();
if (!empty($tax_items)) {
foreach ($tax_items as $tax) {
$template_args['net_total'] .= $this->espressoInvoiceTotals($tax->name(), $tax->total());
}
}
$difference = $template_args['amount_pd'] - $template_args['total_cost'];
if ($difference < 0) {
$text = __('Discount', 'event_espresso');
} else {
$text = __('Extra', 'event_espresso');
}
$template_args['discount'] = $this->espressoInvoiceTotals($text, $difference);
}
$template_args['currency_symbol'] = $EE->CFG->currency->sign;
$template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE), ENT_QUOTES)));
$template_args['shameless_plug'] = apply_filters('FHEE_Invoice__send_invoice__shameless_plug', true);
if (isset($_GET['receipt'])) {
//receipt-specific stuff
$events_for_txn = EEM_Event::instance()->get_all(array(array('Registration.TXN_ID' => $this->transaction->ID())));
$ticket_line_items_per_event = array();
$registrations_per_line_item = array();
$venues_for_events = array();
foreach ($events_for_txn as $event_id => $event) {
$line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID' => $event_id, 'TXN_ID' => $this->transaction->ID())));
$ticket_line_items_per_event[$event_id] = $line_items_for_this_event;
foreach ($line_items_for_this_event as $line_item_id => $line_item) {
$ticket = $line_item->ticket();
$registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID' => $ticket->ID(), 'TXN_ID' => $this->transaction->ID())));
$registrations_per_line_item[$line_item_id] = $registrations_for_this_ticket;
}
$venues_for_events = array_merge($venues_for_events, $event->venues());
}
$tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID' => $this->transaction->ID(), 'LIN_type' => EEM_Line_Item::type_tax_sub_total)));
$questions_to_skip = array(EEM_Attendee::system_question_fname, EEM_Attendee::system_question_lname, EEM_Attendee::system_question_email);
$template_args['events_for_txn'] = $events_for_txn;
$template_args['ticket_line_items_per_event'] = $ticket_line_items_per_event;
$template_args['registrations_per_line_item'] = $registrations_per_line_item;
$template_args['venues_for_events'] = $venues_for_events;
$template_args['tax_total_line_item'] = $tax_total_line_item;
$template_args['questions_to_skip'] = $questions_to_skip;
// d($template_args);
$template_args['download_link'] = $this->registration->receipt_url('download');
} else {
//.........这里部分代码省略.........
示例2: 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;
}
示例3: registration_checkout
//.........这里部分代码省略.........
}
$template_args['sub_total'] = $cart_total_before_tax;
$template_args['taxes'] = $this->_cart->get_taxes_line_item()->children();
// what's left to pay?
$amount_owing = $grand_total - $total_payments;
$template_args['amount_owing'] = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__amount_owing', $amount_owing);
//$template_args['grand_total'] = $template_args['amount_owing'] !== FALSE ? $amount_owing : $grand_total;
$template_args['total_items'] = $event_queue['total_items'] = $total_items;
// d( $event_queue );
$template_args['event_queue'] = $event_queue;
$template_args['images_dir_url'] = EE_GLOBAL_ASSETS_URL . 'images/';
$template_args['reg_url_link'] = $this->_reg_url_link;
$template_args['return_url'] = add_query_arg(array('ee' => 'event_queue'), $this->_reg_page_base_url);
$template_args['update_url'] = add_query_arg(array('ee' => 'update_event_queue'), $this->_reg_page_base_url);
$template_args['register_url'] = add_query_arg(array('ee' => '_register'), $this->_reg_page_base_url);
$template_args['event_queue_url'] = add_query_arg(array('ee' => 'event_queue'), $this->_reg_page_base_url);
$template_args['confirmation_data'] = $this->_current_step == 'registration_confirmation' ? $this->_registration_confirmation() : '';
$step_or_revisit = __('Step ', 'event_espresso');
if ($this->_revisit && $this->_current_step == 'attendee_information') {
// Update Registration Details
$confirmation_btn_text = sprintf(__('Update%1$sRegistration%1$sDetails', 'event_espresso'), ' ');
$confirmation_btn_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__update_registration_details', $confirmation_btn_text);
$step_or_revisit = __('Edit', 'event_espresso');
} else {
if ($this->_revisit && $this->_current_step == 'payment_options') {
// Process Payment
$confirmation_btn_text = sprintf(__('Process%1$sPayment', 'event_espresso'), ' ');
$confirmation_btn_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__process_payment', $confirmation_btn_text);
$step_or_revisit = '';
} else {
// Finalize Registration
$confirmation_btn_text = sprintf(__('Finalize%1$sRegistration', 'event_espresso'), ' ');
$confirmation_btn_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__finalize_registration', $confirmation_btn_text);
}
}
// grand total less than paid but greater than zero ?
if ($grand_total < $this->_transaction->paid() && $grand_total > 0 && $this->_next_step == 'payment_options') {
// owing money
$proceed_to_payment_btn_text = sprintf(__('%1$s%2$s%1$sProceed%1$sto%1$sPayment', 'event_espresso'), ' ', '&');
$confirmation_btn_text .= apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__and_proceed_to_payment', $proceed_to_payment_btn_text);
}
add_action('AHEE__SPCO_after_reg_step_form', array($this, 'add_extra_finalize_registration_inputs'), 10, 2);
$template_args['from_admin'] = $from_admin;
//if in admin we exit at this point and display the questions template
if ($from_admin) {
//some custom template args
$template_args['step_dv_class'] = '';
$template_args['revisit'] = $this->_revisit;
return EEH_Template::display_template($this->_templates['registration_page_attendee_information'], $template_args, TRUE);
}
$proceed_to_btn_text = sprintf(__('Proceed%1$sto%1$s', 'event_espresso'), ' ');
$proceed_to_btn_text = apply_filters('FHEE__EED_Single_Page_Checkout__registration_checkout__button_text__proceed_to', $proceed_to_btn_text);
$registration_steps = '';
$step_nmbr = 1;
// set pointer to first step
reset(self::$_reg_steps);
// loop through steps
while ($reg_step_details = current(self::$_reg_steps)) {
$reg_step = key(self::$_reg_steps);
// echo '<br/><h4>$reg_step : ' . $reg_step . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
// echo '<h4>$this->_current_step : ' . $this->_current_step . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h4>';
$edit_lnk_class = $this->_current_step == $reg_step ? ' hidden' : '';
$edit_lnk_url = add_query_arg(array('ee' => '_register', 'step' => $reg_step_details['display_func']), $this->_reg_page_base_url);
$step_dv_class = $this->_current_step == $reg_step ? '' : ' hidden';
$reg_step_form_url = add_query_arg(array('ee' => '_register', 'step' => $reg_step_details['process_func']), $this->_reg_page_base_url);
$next = $this->_get_next_reg_step();
//d( $next );
$next_step = $next ? $next['display_func'] : 'finalize_registration';
$next_step_text = $next ? $proceed_to_btn_text . $next['name'] : $confirmation_btn_text;
$step_args = array_merge($template_args, array('step' => $reg_step, 'step_nmbr' => $this->_revisit !== FALSE ? $step_or_revisit : $step_or_revisit . $step_nmbr . ' - ', 'edit_lnk_class' => $edit_lnk_class, 'edit_lnk_url' => $edit_lnk_url, 'step_dv_class' => $step_dv_class, 'reg_step_form_url' => $reg_step_form_url, 'reg_step_ajax_action' => $reg_step_details['process_func'], 'next_step' => $next_step, 'next_step_text' => $next_step_text, 'revisit' => $this->_revisit));
if ($reg_step == 'payment_options') {
EE_Registry::instance()->load_model('Gateways');
// has gateway been set by no-js user?
if (EE_Registry::instance()->REQ->is_set('payment')) {
if ($payment = sanitize_text_field(EE_Registry::instance()->REQ->get('payment'))) {
// d( $payment );
if (EE_Registry::instance()->LIB->EEM_Gateways->selected_gateway() != $payment) {
EE_Registry::instance()->LIB->EEM_Gateways->set_selected_gateway($payment);
} else {
EE_Registry::instance()->LIB->EEM_Gateways->unset_selected_gateway($payment);
}
}
}
$step_args['selected_gateway'] = EE_Registry::instance()->LIB->EEM_Gateways->selected_gateway();
} else {
$step_args['selected_gateway'] = '';
}
// printr( $step_args, '$step_args <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span>', 'auto' );
// d( $step_args );
$registration_steps .= EEH_Template::locate_template($this->_templates[$reg_step_details['template']], $step_args, TRUE, TRUE);
// pass step info to js
EE_Registry::$i18n_js_strings['reg_steps'][] = $reg_step_details['display_func'];
next(self::$_reg_steps);
$step_nmbr++;
}
EE_Registry::$i18n_js_strings['reg_steps'][] = 'finalize_registration';
$wrapper_args = array('step' => $this->_current_step, 'empty_cart' => $total_items < 1 ? TRUE : FALSE, 'reg_steps' => self::$_reg_steps, 'registration_steps' => $registration_steps, 'revisit' => $this->_revisit, 'empty_msg' => apply_filters('FHEE__Single_Page_Checkout__registration_checkout__empty_msg', __('You need to select at least one event before you can proceed with the registration process.', 'event_espresso')));
// d( $wrapper_args );
EE_Registry::instance()->REQ->add_output(EEH_Template::locate_template($this->_templates['registration_page_wrapper'], $wrapper_args, TRUE, TRUE));
}