本文整理汇总了PHP中EE_Transaction::registrations方法的典型用法代码示例。如果您正苦于以下问题:PHP EE_Transaction::registrations方法的具体用法?PHP EE_Transaction::registrations怎么用?PHP EE_Transaction::registrations使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EE_Transaction
的用法示例。
在下文中一共展示了EE_Transaction::registrations方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_registration_payment_data_array
/**
* test_registration_payment_data_array
* @since 4.8
* @group 8620
*/
public function test_registration_payment_data_array()
{
$this->_admin_page = new Transactions_Admin_Page_Mock();
$this->_setup_standard_transaction_and_payment(40.0, 4, 25.0);
$registrations = $this->_transaction->registrations();
$this->_apply_payment_to_registrations($registrations);
$registration_payment_data_array = $this->_admin_page->registration_payment_data_array(array_keys($registrations));
// format the payment values
EE_Registry::instance()->load_helper('Template');
$ten_dollars = EEH_Template::format_currency(10.0);
$five_dollars = EEH_Template::format_currency(5.0);
$no_dollars = EEH_Template::format_currency(0.0);
// reg # 1 paid $10, owes 0
$registration_payment_data = reset($registration_payment_data_array);
$this->assertEquals($ten_dollars, $registration_payment_data['paid']);
$this->assertEquals($no_dollars, $registration_payment_data['owing']);
// reg # 2 paid $10, owes 0
$registration_payment_data = next($registration_payment_data_array);
$this->assertEquals($ten_dollars, $registration_payment_data['paid']);
$this->assertEquals($no_dollars, $registration_payment_data['owing']);
// reg # 3 paid $5, owes $5
$registration_payment_data = next($registration_payment_data_array);
$this->assertEquals($five_dollars, $registration_payment_data['paid']);
$this->assertEquals($five_dollars, $registration_payment_data['owing']);
// reg # 4 paid $0, owes $10
$registration_payment_data = next($registration_payment_data_array);
$this->assertEquals($no_dollars, $registration_payment_data['paid']);
$this->assertEquals($ten_dollars, $registration_payment_data['owing']);
}
示例2: _process_payment_options
/**
* process_payment_options
*
* @access private
* @return void
*/
private function _process_payment_options()
{
do_action('AHEE_log', __FILE__, __FUNCTION__, '');
if ($this->_continue_reg) {
$success = TRUE;
if ($this->_transaction instanceof EE_Transaction) {
// grab the saved registrations from the transaction
foreach ($this->_transaction->registrations(array(), TRUE) as $registration) {
// verify object
if ($registration instanceof EE_Registration) {
// if event is sold out but this is NOT a revisit
if (!($this->_revisit || !$this->_revisit && !($registration->event()->is_sold_out() || $registration->event()->is_sold_out(TRUE)))) {
$success = FALSE;
}
} else {
$success = FALSE;
}
}
} else {
$success = FALSE;
}
if ($success) {
if (EE_Registry::instance()->REQ->is_set('selected_gateway') && EE_Registry::instance()->REQ->get('selected_gateway') == 'payments_closed') {
// requires pre-approval
$success_msg = __('no payment required at this time.', 'event_espresso');
EE_Error::add_success($success_msg, __FILE__, __FUNCTION__, __LINE__);
} else {
if ($this->_transaction->total() > 0) {
// PAID EVENT !!! BOO : (
EE_Registry::instance()->load_model('Gateways')->process_gateway_selection();
} else {
if (!$this->_reg_url_link) {
// FREE EVENT !!! YEAH : )
$success_msg = __('no payment required.', 'event_espresso');
EE_Error::add_success($success_msg, __FILE__, __FUNCTION__, __LINE__);
}
}
}
} else {
EE_Error::add_error(apply_filters('FHEE__Single_Page_Checkout___process_payment_options__sold_out_events_msg', __('It appears that the event you are attempting to register for has just sold out. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso')), __FILE__, __FUNCTION__, __LINE__);
}
}
$this->go_to_next_step(__FUNCTION__);
}
示例3: transaction_list_table_events_column_content
/**
* Callback for transaction list table column action for new events column.
*
* @param EE_Transaction $transaction
* @return string
*/
public function transaction_list_table_events_column_content($transaction)
{
if (!$transaction instanceof EE_Transaction) {
return;
}
//get event ids
$registrations = $transaction->registrations();
$event_IDs = array();
foreach ($registrations as $registration) {
if ($registration instanceof EE_Registration) {
if ($registration->event_ID() && !in_array($registration->event_ID(), $event_IDs)) {
$event_IDs[] = $registration->event_ID();
}
}
}
if (!empty($event_IDs)) {
$count = count($event_IDs);
$event_IDs = implode(',', $event_IDs);
$url = add_query_arg(array('EVT_IDs' => $event_IDs, 'TXN_ID' => $transaction->ID(), 'page' => 'espresso_events', 'action' => 'default'), admin_url('admin.php'));
echo '<a href="' . $url . '">' . sprintf(_n('1 Event', '%d Events', $count, 'event_espresso'), $count) . '</a>';
}
}
示例4: get_ajax_content
/**
* get_ajax_content
*
* @access public
* @return void
*/
public function get_ajax_content()
{
if (!$this->get_txn()) {
return;
}
// first determine which event(s) require pre-approval or not
$events = array();
$events_requiring_pre_approval = array();
foreach ($this->_current_txn->registrations() as $registration) {
if ($registration instanceof EE_Registration) {
$event = $registration->event();
if ($event instanceof EE_Event) {
if ($registration->is_not_approved() && $registration->event() instanceof EE_Event) {
$events_requiring_pre_approval[$event->ID()] = $event;
} else {
$events[$event->ID()] = $event;
}
}
}
}
$this->display_details_for_events_requiring_pre_approval($events_requiring_pre_approval);
$this->display_details_for_events($events);
}
示例5: log
/**
* debug
*
* @param string $class
* @param string $func
* @param string $line
* @param array $info
* @param bool $display_request
*/
function log($class = '', $func = '', $line = '', $info = array(), $display_request = false)
{
if (WP_DEBUG && false) {
$debug_data = get_option('EE_DEBUG_SPCO_' . EE_Session::instance()->id(), array());
$default_data = array($class => $func . '() : ' . $line, 'request->step' => $this->step, 'request->action' => $this->action, 'current_step->slug' => $this->current_step instanceof EE_SPCO_Reg_Step ? $this->current_step->slug() : '', 'current_step->completed' => $this->current_step instanceof EE_SPCO_Reg_Step ? $this->current_step->completed() : '', 'txn_status_updated' => $this->txn_status_updated, 'reg_status_updated' => $this->reg_status_updated, 'reg_url_link' => $this->reg_url_link, 'REQ' => $display_request ? $_REQUEST : '');
if ($this->transaction instanceof EE_Transaction) {
$default_data['TXN_status'] = $this->transaction->status_ID();
$default_data['TXN_reg_steps'] = $this->transaction->reg_steps();
foreach ($this->transaction->registrations($this->reg_cache_where_params) as $REG_ID => $registration) {
$default_data['registrations'][$REG_ID] = $registration->status_ID();
}
if ($this->transaction->ID()) {
$TXN_ID = 'EE_Transaction: ' . $this->transaction->ID();
// don't serialize objects
$info = $this->_strip_objects($info);
if (!isset($debug_data[$TXN_ID])) {
$debug_data[$TXN_ID] = array();
}
$debug_data[$TXN_ID][microtime()] = array_merge($default_data, $info);
update_option('EE_DEBUG_SPCO_' . EE_Session::instance()->id(), $debug_data);
}
}
}
}
示例6: process_registration_payments
/**
* update registrations REG_paid field after successful payment and link registrations with payment
*
* @param EE_Transaction $transaction
* @param EE_Payment $payment
* @param EE_Registration[] $registrations
* @throws \EE_Error
*/
public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array())
{
// only process if payment was successful
if ($payment->status() !== EEM_Payment::status_id_approved) {
return;
}
//EEM_Registration::instance()->show_next_x_db_queries();
if (empty($registrations)) {
// find registrations with monies owing that can receive a payment
$registrations = $transaction->registrations(array(array('STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), 'REG_final_price' => array('!=', 0), 'REG_final_price*' => array('!=', 'REG_paid', true))));
}
// still nothing ??!??
if (empty($registrations)) {
return;
}
// todo: break out the following logic into a separate strategy class
// todo: named something like "Sequential_Reg_Payment_Strategy"
// todo: which would apply payments using the capitalist "first come first paid" approach
// todo: then have another strategy class like "Distributed_Reg_Payment_Strategy"
// todo: which would be the socialist "everybody gets a piece of pie" approach,
// todo: which would be better for deposits, where you want a bit of the payment applied to each registration
$refund = $payment->is_a_refund();
// how much is available to apply to registrations?
$available_payment_amount = abs($payment->amount());
foreach ($registrations as $registration) {
if ($registration instanceof EE_Registration) {
// nothing left?
if ($available_payment_amount <= 0) {
break;
}
if ($refund) {
$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
} else {
$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
}
}
}
if ($available_payment_amount > 0 && apply_filters('FHEE__EE_Payment_Processor__process_registration_payments__display_notifications', false)) {
EE_Error::add_attention(sprintf(__('A remainder of %1$s exists after applying this payment to Registration(s) %2$s.%3$sPlease verify that the original payment amount of %4$s is correct. If so, you should edit this payment and select at least one additional registration in the "Registrations to Apply Payment to" section, so that the remainder of this payment can be applied to the additional registration(s).', 'event_espresso'), EEH_Template::format_currency($available_payment_amount), implode(', ', array_keys($registrations)), '<br/>', EEH_Template::format_currency($payment->amount())), __FILE__, __FUNCTION__, __LINE__);
}
}
示例7: _get_registrations
/**
* _get_registrations
*
* @access private
* @param EE_Transaction $transaction
* @return EE_Cart
*/
private function _get_registrations(EE_Transaction $transaction)
{
// first step: grab the registrants { : o
$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, true);
// verify registrations have been set
if (empty($registrations)) {
// if no cached registrations, then check the db
$registrations = $transaction->registrations($this->checkout->reg_cache_where_params, false);
// still nothing ? well as long as this isn't a revisit
if (empty($registrations) && !$this->checkout->revisit) {
// generate new registrations from scratch
$registrations = $this->_initialize_registrations($transaction);
}
}
// sort by their original registration order
usort($registrations, array('EED_Single_Page_Checkout', 'sort_registrations_by_REG_count'));
// then loop thru the array
foreach ($registrations as $registration) {
// verify each registration
if ($registration instanceof EE_Registration) {
// we display all attendee info for the primary registrant
if ($this->checkout->reg_url_link == $registration->reg_url_link() && $registration->is_primary_registrant()) {
$this->checkout->primary_revisit = TRUE;
break;
} else {
if ($this->checkout->revisit && $this->checkout->reg_url_link != $registration->reg_url_link()) {
// but hide info if it doesn't belong to you
$transaction->clear_cache('Registration', $registration->ID());
}
}
$this->checkout->set_reg_status_updated($registration->ID(), false);
}
}
}
示例8: _process_updated_registration_payments
/**
* _process_updated_registration_payments
*
* this applies the payments to the selected registrations
* but only if they have not already been paid for
*
* @param EE_Transaction $transaction
* @param \EE_Payment $payment
* @param array $registration_query_where_params
* @return bool
*/
protected function _process_updated_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registration_query_where_params = array())
{
// we can pass our own custom set of registrations to EE_Payment_Processor::process_registration_payments()
// so let's do that using our set of REG_IDs from the form, but add in some conditions regarding payment
// so that we don't apply payments to registrations that are free or have already been paid for
// but ONLY if the payment is NOT a refund ( ie: the payment amount is not negative )
if (!$payment->is_a_refund()) {
$registration_query_where_params = array_merge($registration_query_where_params, array('REG_final_price' => array('!=', 0), 'REG_final_price*' => array('!=', 'REG_paid', true)));
}
$registrations = $transaction->registrations(array($registration_query_where_params));
//EEH_Debug_Tools::printr( $registrations, '$registrations', __FILE__, __LINE__ );
if (!empty($registrations)) {
/** @type EE_Payment_Processor $payment_processor */
$payment_processor = EE_Registry::instance()->load_core('Payment_Processor');
$payment_processor->process_registration_payments($transaction, $payment, $registrations);
}
}
示例9: update_registration_final_prices
/**
* Updates the registration' final prices based on the current line item tree (taking into account
* discounts, taxes, and other line items unrelated to tickets.)
* @param EE_Transaction $transaction
* @param boolean $save_regs whether to immediately save registrations in this function or not
* @return void
*/
public function update_registration_final_prices($transaction, $save_regs = true)
{
$reg_final_price_per_ticket_line_item = EEH_Line_Item::calculate_reg_final_prices_per_line_item($transaction->total_line_item());
foreach ($transaction->registrations() as $registration) {
$line_item = EEM_Line_Item::instance()->get_line_item_for_registration($registration);
if (isset($reg_final_price_per_ticket_line_item[$line_item->ID()])) {
$registration->set_final_price($reg_final_price_per_ticket_line_item[$line_item->ID()]);
if ($save_regs) {
$registration->save();
}
}
}
//and make sure there's no rounding problem
$this->fix_reg_final_price_rounding_issue($transaction);
}
示例10: reset_registration_details
/**
* reset_registration_reg_counts
*
* @access protected
* @param EE_Transaction $transaction
* @param int $total_ticket_count
* @return void
*/
protected static function reset_registration_details(EE_Transaction $transaction, $total_ticket_count = 0)
{
$att_nmbr = 0;
/** @type EE_Registration_Processor $registration_processor */
$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
$registrations = $transaction->registrations();
uasort($registrations, array('EED_Multi_Event_Registration', 'sort_registrations_by_reg_count_callback'));
foreach ($registrations as $registration) {
if ($registration instanceof EE_Registration) {
$att_nmbr++;
$registration->set_count($att_nmbr);
$registration->set_group_size($total_ticket_count);
$reg_url_bits = explode('-', $registration->reg_url_link());
$reg_url_link = $att_nmbr . '-' . end($reg_url_bits);
$registration->set_reg_url_link($reg_url_link);
$registration->set('REG_code', $registration_processor->generate_reg_code($registration));
$registration->save();
$transaction->_add_relation_to($registration, 'Registration');
}
}
}
示例11: _call_method_on_registrations_via_Registration_Processor
/**
* _call_method_on_registrations_via_Registration_Processor
* cycles thru related registrations and calls the requested method on each
*
* @access private
* @param string $method_name
* @param EE_Transaction $transaction
* @param array $registration_query_params - array of query WHERE params to use when retrieving cached registrations from a transaction
* @param string $additional_param
* @throws \EE_Error
* @return boolean
*/
private function _call_method_on_registrations_via_Registration_Processor($method_name, EE_Transaction $transaction, $registration_query_params = array(), $additional_param = NULL)
{
$response = FALSE;
/** @type EE_Registration_Processor $registration_processor */
$registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
// check that method exists
if (!method_exists($registration_processor, $method_name)) {
throw new EE_Error(__('Method does not exist.', 'event_espresso'));
}
// make sure some query params are set for retrieving registrations
$this->_set_registration_query_params($registration_query_params);
// loop through cached registrations
foreach ($transaction->registrations($this->_registration_query_params) as $registration) {
if ($registration instanceof EE_Registration) {
if ($additional_param) {
$response = $registration_processor->{$method_name}($registration, $additional_param) ? TRUE : $response;
} else {
$response = $registration_processor->{$method_name}($registration) ? TRUE : $response;
}
}
}
return $response;
}
示例12: process_registration_payments
/**
* update registrations REG_paid field after successful payment and link registrations with payment
*
* @param EE_Transaction $transaction
* @param EE_Payment $payment
* @param EE_Registration[] $registrations
* @throws \EE_Error
*/
public function process_registration_payments(EE_Transaction $transaction, EE_Payment $payment, $registrations = array())
{
// only process if payment was successful
if ($payment->status() !== EEM_Payment::status_id_approved) {
return;
}
//EEM_Registration::instance()->show_next_x_db_queries();
if (empty($registrations)) {
// find registrations with monies owing that can receive a payment
$registrations = $transaction->registrations(array(array('STS_ID' => array('IN', EEM_Registration::reg_statuses_that_allow_payment()), 'REG_final_price' => array('!=', 0), 'REG_final_price*' => array('!=', 'REG_paid', true))));
}
// still nothing ??!??
if (empty($registrations)) {
return;
}
// todo: break out the following logic into a separate strategy class
// todo: named something like "Sequential_Reg_Payment_Strategy"
// todo: which would apply payments using the capitalist "first come first paid" approach
// todo: then have another strategy class like "Distributed_Reg_Payment_Strategy"
// todo: which would be the socialist "everybody gets a piece of pie" approach,
// todo: which would be better for deposits, where you want a bit of the payment applied to each registration
$refund = $payment->is_a_refund();
// how much is available to apply to registrations?
$available_payment_amount = abs($payment->amount());
//EEH_Debug_Tools::printr( $available_payment_amount, '$available_payment_amount', __FILE__, __LINE__ );
foreach ($registrations as $registration) {
if ($registration instanceof EE_Registration) {
// nothing left?
if ($available_payment_amount <= 0) {
break;
}
if ($refund) {
$available_payment_amount = $this->process_registration_refund($registration, $payment, $available_payment_amount);
} else {
$available_payment_amount = $this->process_registration_payment($registration, $payment, $available_payment_amount);
}
}
}
}