@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @return void |
29 | 29 | */ |
30 | 30 | public static function set_hooks() { |
31 | - add_filter( 'FHEE__SPCO__EE_Line_Item_Filter_Collection', array( 'EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters' ) ); |
|
32 | - add_action( 'wp_ajax_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
33 | - add_action( 'wp_ajax_nopriv_switch_spco_billing_form', array( 'EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form' )); |
|
34 | - add_action( 'wp_ajax_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
35 | - add_action( 'wp_ajax_nopriv_save_payer_details', array( 'EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details' )); |
|
36 | - add_action( 'wp_ajax_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) ); |
|
37 | - add_action( 'wp_ajax_nopriv_get_transaction_details_for_gateways', array( 'EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details' ) |
|
31 | + add_filter('FHEE__SPCO__EE_Line_Item_Filter_Collection', array('EE_SPCO_Reg_Step_Payment_Options', 'add_spco_line_item_filters')); |
|
32 | + add_action('wp_ajax_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
33 | + add_action('wp_ajax_nopriv_switch_spco_billing_form', array('EE_SPCO_Reg_Step_Payment_Options', 'switch_spco_billing_form')); |
|
34 | + add_action('wp_ajax_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
35 | + add_action('wp_ajax_nopriv_save_payer_details', array('EE_SPCO_Reg_Step_Payment_Options', 'save_payer_details')); |
|
36 | + add_action('wp_ajax_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details')); |
|
37 | + add_action('wp_ajax_nopriv_get_transaction_details_for_gateways', array('EE_SPCO_Reg_Step_Payment_Options', 'get_transaction_details') |
|
38 | 38 | ); |
39 | - add_filter( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array( 'EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method' ), 10, 1 ); |
|
39 | + add_filter('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array('EE_SPCO_Reg_Step_Payment_Options', 'bypass_recaptcha_for_load_payment_method'), 10, 1); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * ajax switch_spco_billing_form |
46 | 46 | */ |
47 | 47 | public static function switch_spco_billing_form() { |
48 | - EED_Single_Page_Checkout::process_ajax_request( 'switch_payment_method' ); |
|
48 | + EED_Single_Page_Checkout::process_ajax_request('switch_payment_method'); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * ajax save_payer_details |
55 | 55 | */ |
56 | 56 | public static function save_payer_details() { |
57 | - EED_Single_Page_Checkout::process_ajax_request( 'save_payer_details_via_ajax' ); |
|
57 | + EED_Single_Page_Checkout::process_ajax_request('save_payer_details_via_ajax'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * ajax get_transaction_details |
64 | 64 | */ |
65 | 65 | public static function get_transaction_details() { |
66 | - EED_Single_Page_Checkout::process_ajax_request( 'get_transaction_details_for_gateways' ); |
|
66 | + EED_Single_Page_Checkout::process_ajax_request('get_transaction_details_for_gateways'); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -91,13 +91,13 @@ discard block |
||
91 | 91 | * @param EE_Checkout $checkout |
92 | 92 | * @return \EE_SPCO_Reg_Step_Payment_Options |
93 | 93 | */ |
94 | - public function __construct( EE_Checkout $checkout ) { |
|
94 | + public function __construct(EE_Checkout $checkout) { |
|
95 | 95 | $this->_slug = 'payment_options'; |
96 | 96 | $this->_name = __('Payment Options', 'event_espresso'); |
97 | - $this->_template = SPCO_REG_STEPS_PATH . $this->_slug . DS . 'payment_options_main.template.php'; |
|
97 | + $this->_template = SPCO_REG_STEPS_PATH.$this->_slug.DS.'payment_options_main.template.php'; |
|
98 | 98 | $this->checkout = $checkout; |
99 | 99 | $this->_reset_success_message(); |
100 | - $this->set_instructions( __('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
100 | + $this->set_instructions(__('Please select a method of payment and provide any necessary billing information before proceeding.', 'event_espresso')); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | /** |
115 | 115 | * @param null $line_item_display |
116 | 116 | */ |
117 | - public function set_line_item_display( $line_item_display ) { |
|
117 | + public function set_line_item_display($line_item_display) { |
|
118 | 118 | $this->line_item_display = $line_item_display; |
119 | 119 | } |
120 | 120 | |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | * @return void |
126 | 126 | */ |
127 | 127 | public function translate_js_strings() { |
128 | - EE_Registry::$i18n_js_strings['no_payment_method'] = __( 'Please select a method of payment in order to continue.', 'event_espresso' ); |
|
129 | - EE_Registry::$i18n_js_strings['invalid_payment_method'] = __( 'A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso' ); |
|
130 | - EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __( 'Forwarding to Secure Payment Provider.', 'event_espresso' ); |
|
128 | + EE_Registry::$i18n_js_strings['no_payment_method'] = __('Please select a method of payment in order to continue.', 'event_espresso'); |
|
129 | + EE_Registry::$i18n_js_strings['invalid_payment_method'] = __('A valid method of payment could not be determined. Please refresh the page and try again.', 'event_espresso'); |
|
130 | + EE_Registry::$i18n_js_strings['forwarding_to_offsite'] = __('Forwarding to Secure Payment Provider.', 'event_espresso'); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -156,20 +156,20 @@ discard block |
||
156 | 156 | // $ 0.00 transactions (no payment required) |
157 | 157 | ! $this->checkout->payment_required() |
158 | 158 | // but do NOT remove if current action being called belongs to this reg step |
159 | - && ! is_callable( array( $this, $this->checkout->action ) ) |
|
159 | + && ! is_callable(array($this, $this->checkout->action)) |
|
160 | 160 | && ! $this->completed() |
161 | 161 | ) { |
162 | 162 | // and if so, then we no longer need the Payment Options step |
163 | - if ( $this->is_current_step() ) { |
|
163 | + if ($this->is_current_step()) { |
|
164 | 164 | $this->checkout->generate_reg_form = false; |
165 | 165 | } |
166 | - $this->checkout->remove_reg_step( $this->_slug ); |
|
166 | + $this->checkout->remove_reg_step($this->_slug); |
|
167 | 167 | // DEBUG LOG |
168 | 168 | //$this->checkout->log( __CLASS__, __FUNCTION__, __LINE__ ); |
169 | 169 | return false; |
170 | 170 | } |
171 | 171 | // load EEM_Payment_Method |
172 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
172 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
173 | 173 | // get all active payment methods |
174 | 174 | $this->checkout->available_payment_methods = EEM_Payment_Method::instance()->get_all_for_transaction( |
175 | 175 | $this->checkout->transaction, EEM_Payment_Method::scope_cart |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return bool |
184 | 184 | */ |
185 | 185 | public function generate_reg_form() { |
186 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
186 | + EE_Registry::instance()->load_helper('HTML'); |
|
187 | 187 | // reset in case someone changes their mind |
188 | 188 | $this->_reset_selected_method_of_payment(); |
189 | 189 | // set some defaults |
@@ -195,14 +195,14 @@ discard block |
||
195 | 195 | $reg_count = 0; |
196 | 196 | $no_payment_required = true; |
197 | 197 | // loop thru registrations to gather info |
198 | - $registrations = $this->checkout->transaction->registrations( $this->checkout->reg_cache_where_params ); |
|
199 | - foreach ( $registrations as $registration ) { |
|
198 | + $registrations = $this->checkout->transaction->registrations($this->checkout->reg_cache_where_params); |
|
199 | + foreach ($registrations as $registration) { |
|
200 | 200 | /** @var $registration EE_Registration */ |
201 | 201 | $reg_count++; |
202 | 202 | // registrant is NOT Approved |
203 | - if ( $registration->status_ID() === EEM_Registration::status_id_not_approved ) { |
|
203 | + if ($registration->status_ID() === EEM_Registration::status_id_not_approved) { |
|
204 | 204 | // add event to list of events with pre-approval reg status |
205 | - $registrations_requiring_pre_approval[ $registration->ID() ] = $registration; |
|
205 | + $registrations_requiring_pre_approval[$registration->ID()] = $registration; |
|
206 | 206 | do_action( |
207 | 207 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_pre_approval', |
208 | 208 | $registration->event(), |
@@ -216,10 +216,10 @@ discard block |
||
216 | 216 | // anything other than Approved |
217 | 217 | && $registration->status_ID() !== EEM_Registration::status_id_approved |
218 | 218 | // event hasn't sold out since initial visit |
219 | - && $registration->event()->is_sold_out( true ) |
|
219 | + && $registration->event()->is_sold_out(true) |
|
220 | 220 | ) { |
221 | 221 | // add event to list of events that are sold out |
222 | - $sold_out_events[ $registration->event()->ID() ] = $registration->event(); |
|
222 | + $sold_out_events[$registration->event()->ID()] = $registration->event(); |
|
223 | 223 | do_action( |
224 | 224 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__sold_out_event', |
225 | 225 | $registration->event(), |
@@ -228,29 +228,29 @@ discard block |
||
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | // are they allowed to pay now and is there monies owing? |
231 | - if ( $registration->owes_monies_and_can_pay() ) { |
|
232 | - $registrations_requiring_payment[ $registration->ID() ] = $registration; |
|
231 | + if ($registration->owes_monies_and_can_pay()) { |
|
232 | + $registrations_requiring_payment[$registration->ID()] = $registration; |
|
233 | 233 | do_action( |
234 | 234 | 'AHEE__EE_SPCO_Reg_Step_Payment_Options__generate_reg_form__event_requires_payment', |
235 | 235 | $registration->event(), |
236 | 236 | $this |
237 | 237 | ); |
238 | - } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free() ) { |
|
239 | - $registrations_for_free_events[ $registration->event()->ID() ] = $registration; |
|
238 | + } else if ( ! $this->checkout->revisit && $registration->status_ID() != EEM_Registration::status_id_not_approved && $registration->ticket()->is_free()) { |
|
239 | + $registrations_for_free_events[$registration->event()->ID()] = $registration; |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | $subsections = array(); |
243 | 243 | // now decide which template to load |
244 | - if ( ! empty( $sold_out_events )) { |
|
245 | - $subsections['sold_out_events'] = $this->_sold_out_events( $sold_out_events ); |
|
244 | + if ( ! empty($sold_out_events)) { |
|
245 | + $subsections['sold_out_events'] = $this->_sold_out_events($sold_out_events); |
|
246 | 246 | } |
247 | - if ( ! empty( $registrations_requiring_pre_approval )) { |
|
248 | - $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval( $registrations_requiring_pre_approval ); |
|
247 | + if ( ! empty($registrations_requiring_pre_approval)) { |
|
248 | + $subsections['registrations_requiring_pre_approval'] = $this->_registrations_requiring_pre_approval($registrations_requiring_pre_approval); |
|
249 | 249 | } |
250 | - if ( ! empty( $registrations_for_free_events ) ) { |
|
251 | - $subsections[ 'no_payment_required' ] = $this->_no_payment_required( $registrations_for_free_events ); |
|
250 | + if ( ! empty($registrations_for_free_events)) { |
|
251 | + $subsections['no_payment_required'] = $this->_no_payment_required($registrations_for_free_events); |
|
252 | 252 | } |
253 | - if ( ! empty( $registrations_requiring_payment ) ) { |
|
253 | + if ( ! empty($registrations_requiring_payment)) { |
|
254 | 254 | // autoload Line_Item_Display classes |
255 | 255 | EEH_Autoloader::register_line_item_filter_autoloaders(); |
256 | 256 | $line_item_filter_processor = new EE_Line_Item_Filter_Processor( |
@@ -261,17 +261,17 @@ discard block |
||
261 | 261 | $this->checkout->cart->get_grand_total() |
262 | 262 | ); |
263 | 263 | $filtered_line_item_tree = $line_item_filter_processor->process(); |
264 | - if ( $this->checkout->amount_owing > 0 ) { |
|
264 | + if ($this->checkout->amount_owing > 0) { |
|
265 | 265 | EEH_Autoloader::register_line_item_display_autoloaders(); |
266 | - $this->set_line_item_display( new EE_Line_Item_Display( 'spco' ) ); |
|
267 | - $subsections[ 'payment_options' ] = $this->_display_payment_options( |
|
266 | + $this->set_line_item_display(new EE_Line_Item_Display('spco')); |
|
267 | + $subsections['payment_options'] = $this->_display_payment_options( |
|
268 | 268 | $this->line_item_display->display_line_item( |
269 | 269 | $filtered_line_item_tree, |
270 | - array( 'registrations' => $registrations ) |
|
270 | + array('registrations' => $registrations) |
|
271 | 271 | ) |
272 | 272 | ); |
273 | 273 | $this->checkout->amount_owing = $filtered_line_item_tree->total(); |
274 | - $this->_apply_registration_payments_to_amount_owing( $registrations ); |
|
274 | + $this->_apply_registration_payments_to_amount_owing($registrations); |
|
275 | 275 | } |
276 | 276 | $no_payment_required = false; |
277 | 277 | } else { |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | $this->_save_selected_method_of_payment(); |
281 | 281 | |
282 | 282 | $subsections['default_hidden_inputs'] = $this->reg_step_hidden_inputs(); |
283 | - $subsections['extra_hidden_inputs' ] = $this->_extra_hidden_inputs( $no_payment_required ); |
|
283 | + $subsections['extra_hidden_inputs'] = $this->_extra_hidden_inputs($no_payment_required); |
|
284 | 284 | |
285 | 285 | return new EE_Form_Section_Proper( |
286 | 286 | array( |
@@ -308,21 +308,21 @@ discard block |
||
308 | 308 | * @param \EE_Line_Item_Filter_Collection $line_item_filter_collection |
309 | 309 | * @return \EE_Line_Item_Filter_Collection |
310 | 310 | */ |
311 | - public static function add_spco_line_item_filters( EE_Line_Item_Filter_Collection $line_item_filter_collection ) { |
|
312 | - if ( ! EE_Registry::instance()->SSN instanceof EE_Session ) { |
|
311 | + public static function add_spco_line_item_filters(EE_Line_Item_Filter_Collection $line_item_filter_collection) { |
|
312 | + if ( ! EE_Registry::instance()->SSN instanceof EE_Session) { |
|
313 | 313 | return $line_item_filter_collection; |
314 | 314 | } |
315 | - if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout ) { |
|
315 | + if ( ! EE_Registry::instance()->SSN->checkout() instanceof EE_Checkout) { |
|
316 | 316 | return $line_item_filter_collection; |
317 | 317 | } |
318 | - if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction ) { |
|
318 | + if ( ! EE_Registry::instance()->SSN->checkout()->transaction instanceof EE_Transaction) { |
|
319 | 319 | return $line_item_filter_collection; |
320 | 320 | } |
321 | 321 | $registrations = EE_Registry::instance()->SSN->checkout()->transaction->registrations( |
322 | 322 | EE_Registry::instance()->SSN->checkout()->reg_cache_where_params |
323 | 323 | ); |
324 | - $line_item_filter_collection->add( new EE_Billable_Line_Item_Filter( $registrations ) ); |
|
325 | - $line_item_filter_collection->add( new EE_Non_Zero_Line_Item_Filter() ); |
|
324 | + $line_item_filter_collection->add(new EE_Billable_Line_Item_Filter($registrations)); |
|
325 | + $line_item_filter_collection->add(new EE_Non_Zero_Line_Item_Filter()); |
|
326 | 326 | return $line_item_filter_collection; |
327 | 327 | } |
328 | 328 | |
@@ -336,8 +336,8 @@ discard block |
||
336 | 336 | * @return void |
337 | 337 | */ |
338 | 338 | protected function _hide_reg_step_submit_button_if_revisit() { |
339 | - if ( $this->checkout->revisit ) { |
|
340 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string' ); |
|
339 | + if ($this->checkout->revisit) { |
|
340 | + add_filter('FHEE__EE_SPCO_Reg_Step__reg_step_submit_button__sbmt_btn_html', '__return_empty_string'); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | |
@@ -348,18 +348,18 @@ discard block |
||
348 | 348 | * @param \EE_Event[] $sold_out_events_array |
349 | 349 | * @return \EE_Form_Section_Proper |
350 | 350 | */ |
351 | - private function _sold_out_events( $sold_out_events_array = array() ) { |
|
351 | + private function _sold_out_events($sold_out_events_array = array()) { |
|
352 | 352 | // set some defaults |
353 | 353 | $this->checkout->selected_method_of_payment = 'events_sold_out'; |
354 | 354 | $sold_out_events = ''; |
355 | - foreach ( $sold_out_events_array as $sold_out_event ) { |
|
356 | - $sold_out_events .= EEH_HTML::li( EEH_HTML::span( $sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text' )); |
|
355 | + foreach ($sold_out_events_array as $sold_out_event) { |
|
356 | + $sold_out_events .= EEH_HTML::li(EEH_HTML::span($sold_out_event->name(), '', 'dashicons dashicons-marker ee-icon-size-16 pink-text')); |
|
357 | 357 | } |
358 | 358 | return new EE_Form_Section_Proper( |
359 | 359 | array( |
360 | 360 | 'layout_strategy' => new EE_Template_Layout( |
361 | 361 | array( |
362 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'sold_out_events.template.php', // layout_template |
|
362 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'sold_out_events.template.php', // layout_template |
|
363 | 363 | 'template_args' => apply_filters( |
364 | 364 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
365 | 365 | array( |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | 'sold_out_events_msg' => apply_filters( |
368 | 368 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__sold_out_events_msg', |
369 | 369 | sprintf( |
370 | - __( 'It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso' ), |
|
370 | + __('It appears that the event you were about to make a payment for has sold out since you first registered. If you have already made a partial payment towards this event, please contact the event administrator for a refund.%3$s%3$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.%2$s', 'event_espresso'), |
|
371 | 371 | '<strong>', |
372 | 372 | '</strong>', |
373 | 373 | '<br />' |
@@ -388,14 +388,14 @@ discard block |
||
388 | 388 | * @param array $registrations_requiring_pre_approval |
389 | 389 | * @return \EE_Form_Section_Proper |
390 | 390 | */ |
391 | - private function _registrations_requiring_pre_approval( $registrations_requiring_pre_approval = array()) { |
|
391 | + private function _registrations_requiring_pre_approval($registrations_requiring_pre_approval = array()) { |
|
392 | 392 | $events_requiring_pre_approval = ''; |
393 | - foreach ( $registrations_requiring_pre_approval as $registration ) { |
|
394 | - if ( $registration instanceof EE_Registration && $registration->event() instanceof EE_Event ) { |
|
395 | - $events_requiring_pre_approval[ $registration->event()->ID() ] = EEH_HTML::li( |
|
396 | - EEH_HTML::span( '', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
393 | + foreach ($registrations_requiring_pre_approval as $registration) { |
|
394 | + if ($registration instanceof EE_Registration && $registration->event() instanceof EE_Event) { |
|
395 | + $events_requiring_pre_approval[$registration->event()->ID()] = EEH_HTML::li( |
|
396 | + EEH_HTML::span('', '', 'dashicons dashicons-marker ee-icon-size-16 orange-text' |
|
397 | 397 | ) |
398 | - . EEH_HTML::span( $registration->event()->name(), '', 'orange-text' ) |
|
398 | + . EEH_HTML::span($registration->event()->name(), '', 'orange-text') |
|
399 | 399 | ); |
400 | 400 | } |
401 | 401 | } |
@@ -403,14 +403,14 @@ discard block |
||
403 | 403 | array( |
404 | 404 | 'layout_strategy' => new EE_Template_Layout( |
405 | 405 | array( |
406 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'events_requiring_pre_approval.template.php', // layout_template |
|
406 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'events_requiring_pre_approval.template.php', // layout_template |
|
407 | 407 | 'template_args' => apply_filters( |
408 | 408 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___sold_out_events__template_args', |
409 | 409 | array( |
410 | - 'events_requiring_pre_approval' => implode( '', $events_requiring_pre_approval ), |
|
410 | + 'events_requiring_pre_approval' => implode('', $events_requiring_pre_approval), |
|
411 | 411 | 'events_requiring_pre_approval_msg' => apply_filters( |
412 | 412 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___events_requiring_pre_approval__events_requiring_pre_approval_msg', |
413 | - __( 'The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso' ) |
|
413 | + __('The following events do not require payment at this time and will not be billed during this transaction. Billing will only occur after the attendee has been approved by the event organizer. You will be notified when your registration has been processed. If this is a free event, then no billing will occur.', 'event_espresso') |
|
414 | 414 | ) |
415 | 415 | ) |
416 | 416 | ), |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | * @param \EE_Event[] $registrations_for_free_events |
429 | 429 | * @return \EE_Form_Section_Proper |
430 | 430 | */ |
431 | - private function _no_payment_required( $registrations_for_free_events = array() ) { |
|
431 | + private function _no_payment_required($registrations_for_free_events = array()) { |
|
432 | 432 | // set some defaults |
433 | 433 | $this->checkout->selected_method_of_payment = 'no_payment_required'; |
434 | 434 | // generate no_payment_required form |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | array( |
437 | 437 | 'layout_strategy' => new EE_Template_Layout( |
438 | 438 | array( |
439 | - 'layout_template_file' => SPCO_REG_STEPS_PATH . $this->_slug . DS . 'no_payment_required.template.php', // layout_template |
|
439 | + 'layout_template_file' => SPCO_REG_STEPS_PATH.$this->_slug.DS.'no_payment_required.template.php', // layout_template |
|
440 | 440 | 'template_args' => apply_filters( |
441 | 441 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___no_payment_required__template_args', |
442 | 442 | array( |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | 'registrations' => array(), |
445 | 445 | 'ticket_count' => array(), |
446 | 446 | 'registrations_for_free_events' => $registrations_for_free_events, |
447 | - 'no_payment_required_msg' => EEH_HTML::p( __( 'This is a free event, so no billing will occur.', 'event_espresso' )) |
|
447 | + 'no_payment_required_msg' => EEH_HTML::p(__('This is a free event, so no billing will occur.', 'event_espresso')) |
|
448 | 448 | ) |
449 | 449 | ), |
450 | 450 | ) |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | * @param string $transaction_details |
462 | 462 | * @return \EE_Form_Section_Proper |
463 | 463 | */ |
464 | - private function _display_payment_options( $transaction_details = '' ) { |
|
464 | + private function _display_payment_options($transaction_details = '') { |
|
465 | 465 | // has method_of_payment been set by no-js user? |
466 | 466 | $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(); |
467 | 467 | // build payment options form |
@@ -473,18 +473,18 @@ discard block |
||
473 | 473 | 'before_payment_options' => apply_filters( |
474 | 474 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__before_payment_options', |
475 | 475 | new EE_Form_Section_Proper( |
476 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
476 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
477 | 477 | ) |
478 | 478 | ), |
479 | 479 | 'payment_options' => $this->_setup_payment_options(), |
480 | 480 | 'after_payment_options' => apply_filters( |
481 | 481 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__after_payment_options', |
482 | 482 | new EE_Form_Section_Proper( |
483 | - array( 'layout_strategy' => new EE_Div_Per_Section_Layout() ) |
|
483 | + array('layout_strategy' => new EE_Div_Per_Section_Layout()) |
|
484 | 484 | ) |
485 | 485 | ), |
486 | 486 | ), |
487 | - 'layout_strategy' => new EE_Template_Layout( array( |
|
487 | + 'layout_strategy' => new EE_Template_Layout(array( |
|
488 | 488 | 'layout_template_file' => $this->_template, |
489 | 489 | 'template_args' => apply_filters( |
490 | 490 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___display_payment_options__template_args', |
@@ -508,11 +508,11 @@ discard block |
||
508 | 508 | * @param bool $no_payment_required |
509 | 509 | * @return \EE_Form_Section_Proper |
510 | 510 | */ |
511 | - private function _extra_hidden_inputs( $no_payment_required = TRUE ) { |
|
511 | + private function _extra_hidden_inputs($no_payment_required = TRUE) { |
|
512 | 512 | |
513 | 513 | return new EE_Form_Section_Proper( |
514 | 514 | array( |
515 | - 'html_id' => 'ee-' . $this->slug() . '-extra-hidden-inputs', |
|
515 | + 'html_id' => 'ee-'.$this->slug().'-extra-hidden-inputs', |
|
516 | 516 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
517 | 517 | 'subsections' => array( |
518 | 518 | 'spco_no_payment_required' => new EE_Hidden_Input( |
@@ -545,16 +545,16 @@ discard block |
||
545 | 545 | * @access protected |
546 | 546 | * @return void |
547 | 547 | */ |
548 | - protected function _apply_registration_payments_to_amount_owing( $registrations ) { |
|
548 | + protected function _apply_registration_payments_to_amount_owing($registrations) { |
|
549 | 549 | $payments = array(); |
550 | - foreach ( $registrations as $registration ) { |
|
551 | - if ( $registration instanceof EE_Registration && $registration->owes_monies_and_can_pay() ) { |
|
550 | + foreach ($registrations as $registration) { |
|
551 | + if ($registration instanceof EE_Registration && $registration->owes_monies_and_can_pay()) { |
|
552 | 552 | $payments = $payments + $registration->registration_payments(); |
553 | 553 | } |
554 | 554 | } |
555 | - if ( ! empty( $payments ) ) { |
|
556 | - foreach ( $payments as $payment ) { |
|
557 | - if ( $payment instanceof EE_Registration_Payment ) { |
|
555 | + if ( ! empty($payments)) { |
|
556 | + foreach ($payments as $payment) { |
|
557 | + if ($payment instanceof EE_Registration_Payment) { |
|
558 | 558 | $this->checkout->amount_owing -= $payment->amount(); |
559 | 559 | } |
560 | 560 | } |
@@ -569,9 +569,9 @@ discard block |
||
569 | 569 | * @param bool $force_reset |
570 | 570 | * @return void |
571 | 571 | */ |
572 | - private function _reset_selected_method_of_payment( $force_reset = FALSE ) { |
|
573 | - $reset_payment_method = $force_reset ? TRUE : sanitize_text_field( EE_Registry::instance()->REQ->get( 'reset_payment_method', FALSE )); |
|
574 | - if ( $reset_payment_method ) { |
|
572 | + private function _reset_selected_method_of_payment($force_reset = FALSE) { |
|
573 | + $reset_payment_method = $force_reset ? TRUE : sanitize_text_field(EE_Registry::instance()->REQ->get('reset_payment_method', FALSE)); |
|
574 | + if ($reset_payment_method) { |
|
575 | 575 | $this->checkout->selected_method_of_payment = NULL; |
576 | 576 | $this->checkout->payment_method = NULL; |
577 | 577 | $this->checkout->billing_form = NULL; |
@@ -590,9 +590,9 @@ discard block |
||
590 | 590 | * @param string $selected_method_of_payment |
591 | 591 | * @return EE_Billing_Info_Form |
592 | 592 | */ |
593 | - private function _save_selected_method_of_payment( $selected_method_of_payment = '' ) { |
|
594 | - $selected_method_of_payment = ! empty( $selected_method_of_payment ) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
595 | - EE_Registry::instance()->SSN->set_session_data( array( 'selected_method_of_payment' => $selected_method_of_payment )); |
|
593 | + private function _save_selected_method_of_payment($selected_method_of_payment = '') { |
|
594 | + $selected_method_of_payment = ! empty($selected_method_of_payment) ? $selected_method_of_payment : $this->checkout->selected_method_of_payment; |
|
595 | + EE_Registry::instance()->SSN->set_session_data(array('selected_method_of_payment' => $selected_method_of_payment)); |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | |
@@ -605,40 +605,40 @@ discard block |
||
605 | 605 | // load payment method classes |
606 | 606 | $this->checkout->available_payment_methods = $this->_get_available_payment_methods(); |
607 | 607 | // switch up header depending on number of available payment methods |
608 | - $payment_method_header = count( $this->checkout->available_payment_methods ) > 1 |
|
609 | - ? apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Please Select Your Method of Payment', 'event_espresso' )) |
|
610 | - : apply_filters( 'FHEE__registration_page_payment_options__method_of_payment_hdr', __( 'Method of Payment', 'event_espresso' )); |
|
608 | + $payment_method_header = count($this->checkout->available_payment_methods) > 1 |
|
609 | + ? apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Please Select Your Method of Payment', 'event_espresso')) |
|
610 | + : apply_filters('FHEE__registration_page_payment_options__method_of_payment_hdr', __('Method of Payment', 'event_espresso')); |
|
611 | 611 | $available_payment_methods = array( |
612 | 612 | // display the "Payment Method" header |
613 | 613 | 'payment_method_header' => new EE_Form_Section_HTML( |
614 | - EEH_HTML::h4 ( $payment_method_header, 'method-of-payment-hdr' ) |
|
614 | + EEH_HTML::h4($payment_method_header, 'method-of-payment-hdr') |
|
615 | 615 | ) |
616 | 616 | ); |
617 | 617 | // the list of actual payment methods ( invoice, paypal, etc ) in a ( slug => HTML ) format |
618 | 618 | $available_payment_method_options = array(); |
619 | 619 | $default_payment_method_option = array(); |
620 | 620 | // additional instructions to be displayed and hidden below payment methods (adding a clearing div to start) |
621 | - $payment_methods_billing_info = array( new EE_Form_Section_HTML( EEH_HTML::div ( '<br />', '', '', 'clear:both;' ))); |
|
621 | + $payment_methods_billing_info = array(new EE_Form_Section_HTML(EEH_HTML::div('<br />', '', '', 'clear:both;'))); |
|
622 | 622 | // loop through payment methods |
623 | - foreach( $this->checkout->available_payment_methods as $payment_method ) { |
|
624 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
625 | - $payment_method_button = EEH_HTML::img( $payment_method->button_url(), $payment_method->name(), 'spco-payment-method-' . $payment_method->slug() . '-btn-img', 'spco-payment-method-btn-img' ); |
|
623 | + foreach ($this->checkout->available_payment_methods as $payment_method) { |
|
624 | + if ($payment_method instanceof EE_Payment_Method) { |
|
625 | + $payment_method_button = EEH_HTML::img($payment_method->button_url(), $payment_method->name(), 'spco-payment-method-'.$payment_method->slug().'-btn-img', 'spco-payment-method-btn-img'); |
|
626 | 626 | // check if any payment methods are set as default |
627 | 627 | // if payment method is already selected OR nothing is selected and this payment method should be open_by_default |
628 | - if (( $this->checkout->selected_method_of_payment == $payment_method->slug() ) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default() )) { |
|
628 | + if (($this->checkout->selected_method_of_payment == $payment_method->slug()) || ( ! $this->checkout->selected_method_of_payment && $payment_method->open_by_default())) { |
|
629 | 629 | $this->checkout->selected_method_of_payment = $payment_method->slug(); |
630 | 630 | $this->_save_selected_method_of_payment(); |
631 | - $default_payment_method_option[ $payment_method->slug() ] = $payment_method_button; |
|
631 | + $default_payment_method_option[$payment_method->slug()] = $payment_method_button; |
|
632 | 632 | } else { |
633 | - $available_payment_method_options[ $payment_method->slug() ] = $payment_method_button; |
|
633 | + $available_payment_method_options[$payment_method->slug()] = $payment_method_button; |
|
634 | 634 | } |
635 | - $payment_methods_billing_info[ $payment_method->slug() . '-info' ] = $this->_payment_method_billing_info( $payment_method ); |
|
635 | + $payment_methods_billing_info[$payment_method->slug().'-info'] = $this->_payment_method_billing_info($payment_method); |
|
636 | 636 | } |
637 | 637 | } |
638 | 638 | // prepend available_payment_method_options with default_payment_method_option so that it appears first in list of PMs |
639 | 639 | $available_payment_method_options = $default_payment_method_option + $available_payment_method_options; |
640 | 640 | // now generate the actual form inputs |
641 | - $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs( $available_payment_method_options ); |
|
641 | + $available_payment_methods['available_payment_methods'] = $this->_available_payment_method_inputs($available_payment_method_options); |
|
642 | 642 | $available_payment_methods = $available_payment_methods + $payment_methods_billing_info; |
643 | 643 | |
644 | 644 | // build the available payment methods form |
@@ -658,19 +658,19 @@ discard block |
||
658 | 658 | * @return EE_Payment_Method[] |
659 | 659 | */ |
660 | 660 | protected function _get_available_payment_methods() { |
661 | - if ( ! empty( $this->checkout->available_payment_methods )) { |
|
661 | + if ( ! empty($this->checkout->available_payment_methods)) { |
|
662 | 662 | return $this->checkout->available_payment_methods; |
663 | 663 | } |
664 | 664 | $available_payment_methods = array(); |
665 | 665 | // load EEM_Payment_Method |
666 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
666 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
667 | 667 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
668 | 668 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
669 | 669 | // get all active payment methods |
670 | - $payment_methods = $EEM_Payment_Method->get_all_for_transaction( $this->checkout->transaction, EEM_Payment_Method::scope_cart ); |
|
671 | - foreach ( $payment_methods as $payment_method ) { |
|
672 | - if ( $payment_method instanceof EE_Payment_Method ) { |
|
673 | - $available_payment_methods[ $payment_method->slug() ] = $payment_method; |
|
670 | + $payment_methods = $EEM_Payment_Method->get_all_for_transaction($this->checkout->transaction, EEM_Payment_Method::scope_cart); |
|
671 | + foreach ($payment_methods as $payment_method) { |
|
672 | + if ($payment_method instanceof EE_Payment_Method) { |
|
673 | + $available_payment_methods[$payment_method->slug()] = $payment_method; |
|
674 | 674 | } |
675 | 675 | } |
676 | 676 | return $available_payment_methods; |
@@ -686,14 +686,14 @@ discard block |
||
686 | 686 | * @param array $available_payment_method_options |
687 | 687 | * @return \EE_Form_Section_Proper |
688 | 688 | */ |
689 | - private function _available_payment_method_inputs( $available_payment_method_options = array() ) { |
|
689 | + private function _available_payment_method_inputs($available_payment_method_options = array()) { |
|
690 | 690 | // generate inputs |
691 | 691 | return new EE_Form_Section_Proper( |
692 | 692 | array( |
693 | 693 | 'html_id' => 'ee-available-payment-method-inputs', |
694 | 694 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
695 | 695 | 'subsections' => array( |
696 | - '' => new EE_Radio_Button_Input ( |
|
696 | + '' => new EE_Radio_Button_Input( |
|
697 | 697 | $available_payment_method_options, |
698 | 698 | array( |
699 | 699 | 'html_name' => 'selected_method_of_payment', |
@@ -717,36 +717,36 @@ discard block |
||
717 | 717 | * @param EE_Payment_Method $payment_method |
718 | 718 | * @return \EE_Form_Section_Proper |
719 | 719 | */ |
720 | - private function _payment_method_billing_info( EE_Payment_Method $payment_method ) { |
|
720 | + private function _payment_method_billing_info(EE_Payment_Method $payment_method) { |
|
721 | 721 | $currently_selected = $this->checkout->selected_method_of_payment == $payment_method->slug() ? TRUE : FALSE; |
722 | 722 | // generate the billing form for payment method |
723 | - $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method( $payment_method ) : new EE_Form_Section_HTML(); |
|
723 | + $billing_form = $currently_selected ? $this->_get_billing_form_for_payment_method($payment_method) : new EE_Form_Section_HTML(); |
|
724 | 724 | $this->checkout->billing_form = $currently_selected ? $billing_form : $this->checkout->billing_form; |
725 | 725 | // it's all in the details |
726 | - $info_html = EEH_HTML::h3 ( __( 'Important information regarding your payment', 'event_espresso' ), '', 'spco-payment-method-hdr' ); |
|
726 | + $info_html = EEH_HTML::h3(__('Important information regarding your payment', 'event_espresso'), '', 'spco-payment-method-hdr'); |
|
727 | 727 | // add some info regarding the step, either from what's saved in the admin, or a default string depending on whether the PM has a billing form or not |
728 | - if ( $payment_method->description() ) { |
|
728 | + if ($payment_method->description()) { |
|
729 | 729 | $payment_method_info = $payment_method->description(); |
730 | - } elseif ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
731 | - $payment_method_info = sprintf( __( 'Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
730 | + } elseif ($billing_form instanceof EE_Billing_Info_Form) { |
|
731 | + $payment_method_info = sprintf(__('Please provide the following billing information, then click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
732 | 732 | } else { |
733 | - $payment_method_info = sprintf( __( 'Please click the "%1$s" button below in order to proceed.', 'event_espresso' ), $this->submit_button_text() ); |
|
733 | + $payment_method_info = sprintf(__('Please click the "%1$s" button below in order to proceed.', 'event_espresso'), $this->submit_button_text()); |
|
734 | 734 | } |
735 | - $info_html .= EEH_HTML::p ( |
|
736 | - apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info ), |
|
735 | + $info_html .= EEH_HTML::p( |
|
736 | + apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options___payment_method_billing_info__payment_method_info', $payment_method_info), |
|
737 | 737 | '', |
738 | 738 | 'spco-payment-method-desc ee-attention' |
739 | 739 | ); |
740 | 740 | |
741 | 741 | return new EE_Form_Section_Proper( |
742 | 742 | array( |
743 | - 'html_id' => 'spco-payment-method-info-' . $payment_method->slug(), |
|
743 | + 'html_id' => 'spco-payment-method-info-'.$payment_method->slug(), |
|
744 | 744 | 'html_class' => 'spco-payment-method-info-dv', |
745 | 745 | // only display the selected or default PM |
746 | 746 | 'html_style' => $currently_selected ? '' : 'display:none;', |
747 | 747 | 'layout_strategy' => new EE_Div_Per_Section_Layout(), |
748 | 748 | 'subsections' => array( |
749 | - 'info' => new EE_Form_Section_HTML( $info_html ), |
|
749 | + 'info' => new EE_Form_Section_HTML($info_html), |
|
750 | 750 | 'billing_form' => $currently_selected ? $billing_form : new EE_Form_Section_HTML() |
751 | 751 | ) |
752 | 752 | ) |
@@ -764,12 +764,12 @@ discard block |
||
764 | 764 | */ |
765 | 765 | public function get_billing_form_html_for_payment_method() { |
766 | 766 | // how have they chosen to pay? |
767 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
767 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
768 | 768 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
769 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
769 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
770 | 770 | return FALSE; |
771 | 771 | } |
772 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
772 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
773 | 773 | EE_Error::add_success( |
774 | 774 | apply_filters( |
775 | 775 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
@@ -778,20 +778,20 @@ discard block |
||
778 | 778 | ); |
779 | 779 | } |
780 | 780 | // now generate billing form for selected method of payment |
781 | - $payment_method_billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
781 | + $payment_method_billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
782 | 782 | // fill form with attendee info if applicable |
783 | - if ( $payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
784 | - $payment_method_billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
783 | + if ($payment_method_billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
784 | + $payment_method_billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
785 | 785 | } |
786 | 786 | // and debug content |
787 | - if ( $payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
788 | - $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $payment_method_billing_form ); |
|
787 | + if ($payment_method_billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
788 | + $payment_method_billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($payment_method_billing_form); |
|
789 | 789 | } |
790 | 790 | $billing_info = $payment_method_billing_form instanceof EE_Form_Section_Proper ? $payment_method_billing_form->get_html() : ''; |
791 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $billing_info )); |
|
791 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $billing_info)); |
|
792 | 792 | // localize validation rules for main form |
793 | 793 | $this->checkout->current_step->reg_form->localize_validation_rules(); |
794 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
794 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
795 | 795 | return TRUE; |
796 | 796 | } |
797 | 797 | |
@@ -804,15 +804,15 @@ discard block |
||
804 | 804 | * @param EE_Payment_Method $payment_method |
805 | 805 | * @return \EE_Billing_Info_Form |
806 | 806 | */ |
807 | - private function _get_billing_form_for_payment_method( EE_Payment_Method $payment_method ) { |
|
808 | - $billing_form = $payment_method->type_obj()->billing_form( $this->checkout->transaction, array( 'amount_owing' => $this->checkout->amount_owing ) ); |
|
809 | - if ( $billing_form instanceof EE_Billing_Info_Form ) { |
|
810 | - if ( EE_Registry::instance()->REQ->is_set( 'payment_method' )) { |
|
811 | - if ( apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false )) { |
|
807 | + private function _get_billing_form_for_payment_method(EE_Payment_Method $payment_method) { |
|
808 | + $billing_form = $payment_method->type_obj()->billing_form($this->checkout->transaction, array('amount_owing' => $this->checkout->amount_owing)); |
|
809 | + if ($billing_form instanceof EE_Billing_Info_Form) { |
|
810 | + if (EE_Registry::instance()->REQ->is_set('payment_method')) { |
|
811 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
812 | 812 | EE_Error::add_success( |
813 | 813 | apply_filters( |
814 | 814 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
815 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $payment_method->name() ) |
|
815 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $payment_method->name()) |
|
816 | 816 | ) |
817 | 817 | ); |
818 | 818 | } |
@@ -837,27 +837,27 @@ discard block |
||
837 | 837 | * @param string $request_param |
838 | 838 | * @return NULL|string |
839 | 839 | */ |
840 | - private function _get_selected_method_of_payment( $required = FALSE, $request_param = 'selected_method_of_payment' ) { |
|
840 | + private function _get_selected_method_of_payment($required = FALSE, $request_param = 'selected_method_of_payment') { |
|
841 | 841 | // is selected_method_of_payment set in the request ? |
842 | - $selected_method_of_payment = EE_Registry::instance()->REQ->get( $request_param, FALSE ); |
|
843 | - if ( $selected_method_of_payment ) { |
|
842 | + $selected_method_of_payment = EE_Registry::instance()->REQ->get($request_param, FALSE); |
|
843 | + if ($selected_method_of_payment) { |
|
844 | 844 | // sanitize it |
845 | - $selected_method_of_payment = is_array( $selected_method_of_payment ) ? array_shift( $selected_method_of_payment ) : $selected_method_of_payment; |
|
846 | - $selected_method_of_payment = sanitize_text_field( $selected_method_of_payment ); |
|
845 | + $selected_method_of_payment = is_array($selected_method_of_payment) ? array_shift($selected_method_of_payment) : $selected_method_of_payment; |
|
846 | + $selected_method_of_payment = sanitize_text_field($selected_method_of_payment); |
|
847 | 847 | // store it in the session so that it's available for all subsequent requests including AJAX |
848 | - $this->_save_selected_method_of_payment( $selected_method_of_payment ); |
|
848 | + $this->_save_selected_method_of_payment($selected_method_of_payment); |
|
849 | 849 | } else { |
850 | 850 | // or is is set in the session ? |
851 | - $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data( 'selected_method_of_payment' ); |
|
851 | + $selected_method_of_payment = EE_Registry::instance()->SSN->get_session_data('selected_method_of_payment'); |
|
852 | 852 | } |
853 | 853 | // do ya really really gotta have it? |
854 | - if ( empty( $selected_method_of_payment ) && $required ) { |
|
854 | + if (empty($selected_method_of_payment) && $required) { |
|
855 | 855 | EE_Error::add_error( |
856 | 856 | sprintf( |
857 | - __( 'The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso' ), |
|
857 | + __('The selected method of payment could not be determined.%sPlease ensure that you have selected one before proceeding.%sIf you continue to experience difficulties, then refresh your browser and try again, or contact %s for assistance.', 'event_espresso'), |
|
858 | 858 | '<br/>', |
859 | 859 | '<br/>', |
860 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
860 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
861 | 861 | ), |
862 | 862 | __FILE__, __FUNCTION__, __LINE__ |
863 | 863 | ); |
@@ -883,37 +883,37 @@ discard block |
||
883 | 883 | * @return string |
884 | 884 | */ |
885 | 885 | public function switch_payment_method() { |
886 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
886 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
887 | 887 | return false; |
888 | 888 | } |
889 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false ) ) { |
|
889 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__registration_checkout__selected_payment_method__display_success', false)) { |
|
890 | 890 | EE_Error::add_success( |
891 | 891 | apply_filters( |
892 | 892 | 'FHEE__Single_Page_Checkout__registration_checkout__selected_payment_method', |
893 | - sprintf( __( 'You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso' ), $this->checkout->payment_method->name() ) |
|
893 | + sprintf(__('You have selected "%s" as your method of payment. Please note the important payment information below.', 'event_espresso'), $this->checkout->payment_method->name()) |
|
894 | 894 | ) |
895 | 895 | ); |
896 | 896 | } |
897 | 897 | // generate billing form for selected method of payment if it hasn't been done already |
898 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
899 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
898 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
899 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
900 | 900 | } |
901 | 901 | // fill form with attendee info if applicable |
902 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant() ) { |
|
903 | - $this->checkout->billing_form->populate_from_attendee( $this->checkout->transaction->primary_registration()->attendee() ); |
|
902 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && $this->checkout->transaction_has_primary_registrant()) { |
|
903 | + $this->checkout->billing_form->populate_from_attendee($this->checkout->transaction->primary_registration()->attendee()); |
|
904 | 904 | } |
905 | 905 | // and debug content |
906 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
907 | - $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings( $this->checkout->billing_form ); |
|
906 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form && $this->checkout->payment_method->type_obj() instanceof EE_PMT_Base) { |
|
907 | + $this->checkout->billing_form = $this->checkout->payment_method->type_obj()->apply_billing_form_debug_settings($this->checkout->billing_form); |
|
908 | 908 | } |
909 | 909 | // get html and validation rules for form |
910 | - if ( $this->checkout->billing_form instanceof EE_Form_Section_Proper ) { |
|
911 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => $this->checkout->billing_form->get_html() )); |
|
910 | + if ($this->checkout->billing_form instanceof EE_Form_Section_Proper) { |
|
911 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => $this->checkout->billing_form->get_html())); |
|
912 | 912 | // localize validation rules for main form |
913 | - $this->checkout->billing_form->localize_validation_rules( TRUE ); |
|
914 | - $this->checkout->json_response->add_validation_rules( EE_Form_Section_Proper::js_localization() ); |
|
913 | + $this->checkout->billing_form->localize_validation_rules(TRUE); |
|
914 | + $this->checkout->json_response->add_validation_rules(EE_Form_Section_Proper::js_localization()); |
|
915 | 915 | } else { |
916 | - $this->checkout->json_response->set_return_data( array( 'payment_method_info' => '' )); |
|
916 | + $this->checkout->json_response->set_return_data(array('payment_method_info' => '')); |
|
917 | 917 | } |
918 | 918 | //prevents advancement to next step |
919 | 919 | $this->checkout->continue_reg = FALSE; |
@@ -928,18 +928,18 @@ discard block |
||
928 | 928 | */ |
929 | 929 | protected function _verify_payment_method_is_set() { |
930 | 930 | // generate billing form for selected method of payment if it hasn't been done already |
931 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
931 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
932 | 932 | // how have they chosen to pay? |
933 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( TRUE ); |
|
933 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(TRUE); |
|
934 | 934 | } else { |
935 | 935 | // choose your own adventure based on method_of_payment |
936 | - switch ( $this->checkout->selected_method_of_payment ) { |
|
936 | + switch ($this->checkout->selected_method_of_payment) { |
|
937 | 937 | case 'events_sold_out' : |
938 | 938 | EE_Error::add_attention( |
939 | 939 | apply_filters( |
940 | 940 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__sold_out_events_msg', |
941 | - __( 'It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.', |
|
942 | - 'event_espresso' ) |
|
941 | + __('It appears that the event you were about to make a payment for has sold out since this form first loaded. Please contact the event administrator if you believe this is an error.', |
|
942 | + 'event_espresso') |
|
943 | 943 | ), |
944 | 944 | __FILE__, __FUNCTION__, __LINE__ |
945 | 945 | ); |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | EE_Error::add_attention( |
950 | 950 | apply_filters( |
951 | 951 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__payments_closed_msg', |
952 | - __( 'It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso' ) |
|
952 | + __('It appears that the event you were about to make a payment for is not accepting payments at this time. Please contact the event administrator if you believe this is an error.', 'event_espresso') |
|
953 | 953 | ), |
954 | 954 | __FILE__, __FUNCTION__, __LINE__ |
955 | 955 | ); |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | EE_Error::add_attention( |
960 | 960 | apply_filters( |
961 | 961 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___verify_payment_method_is_set__no_payment_required_msg', |
962 | - __( 'It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso' ) |
|
962 | + __('It appears that the event you were about to make a payment for does not require payment. Please contact the event administrator if you believe this is an error.', 'event_espresso') |
|
963 | 963 | ), |
964 | 964 | __FILE__, __FUNCTION__, __LINE__ |
965 | 965 | ); |
@@ -969,7 +969,7 @@ discard block |
||
969 | 969 | } |
970 | 970 | } |
971 | 971 | // verify payment method |
972 | - if ( ! $this->checkout->payment_method instanceof EE_Payment_Method ) { |
|
972 | + if ( ! $this->checkout->payment_method instanceof EE_Payment_Method) { |
|
973 | 973 | // get payment method for selected method of payment |
974 | 974 | $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment(); |
975 | 975 | } |
@@ -989,23 +989,23 @@ discard block |
||
989 | 989 | * @return void |
990 | 990 | */ |
991 | 991 | public function save_payer_details_via_ajax() { |
992 | - if ( ! $this->_verify_payment_method_is_set() ) { |
|
992 | + if ( ! $this->_verify_payment_method_is_set()) { |
|
993 | 993 | return; |
994 | 994 | } |
995 | 995 | // generate billing form for selected method of payment if it hasn't been done already |
996 | - if ( $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
997 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
996 | + if ($this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
997 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
998 | 998 | } |
999 | 999 | // generate primary attendee from payer info if applicable |
1000 | 1000 | if ( ! $this->checkout->transaction_has_primary_registrant()) { |
1001 | 1001 | $attendee = $this->_create_attendee_from_request_data(); |
1002 | - if ( $attendee instanceof EE_Attendee ) { |
|
1003 | - foreach ( $this->checkout->transaction->registrations() as $registration ) { |
|
1004 | - if ( $registration->is_primary_registrant() ) { |
|
1002 | + if ($attendee instanceof EE_Attendee) { |
|
1003 | + foreach ($this->checkout->transaction->registrations() as $registration) { |
|
1004 | + if ($registration->is_primary_registrant()) { |
|
1005 | 1005 | $this->checkout->primary_attendee_obj = $attendee; |
1006 | - $registration->_add_relation_to( $attendee, 'Attendee' ); |
|
1007 | - $registration->set_attendee_id( $attendee->ID() ); |
|
1008 | - $registration->update_cache_after_object_save( 'Attendee', $attendee ); |
|
1006 | + $registration->_add_relation_to($attendee, 'Attendee'); |
|
1007 | + $registration->set_attendee_id($attendee->ID()); |
|
1008 | + $registration->update_cache_after_object_save('Attendee', $attendee); |
|
1009 | 1009 | } |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1018,56 +1018,56 @@ discard block |
||
1018 | 1018 | * uses info from alternate GET or POST data (such as AJAX) to create a new attendee |
1019 | 1019 | * @return \EE_Attendee |
1020 | 1020 | */ |
1021 | - protected function _create_attendee_from_request_data(){ |
|
1021 | + protected function _create_attendee_from_request_data() { |
|
1022 | 1022 | // get State ID |
1023 | - $STA_ID = ! empty( $_REQUEST['state'] ) ? sanitize_text_field( $_REQUEST['state'] ) : ''; |
|
1024 | - if ( ! empty( $STA_ID )) { |
|
1023 | + $STA_ID = ! empty($_REQUEST['state']) ? sanitize_text_field($_REQUEST['state']) : ''; |
|
1024 | + if ( ! empty($STA_ID)) { |
|
1025 | 1025 | // can we get state object from name ? |
1026 | - EE_Registry::instance()->load_model( 'State' ); |
|
1027 | - $state = EEM_State::instance()->get_col( array( array( 'STA_name' => $STA_ID ), 'limit' => 1), 'STA_ID' ); |
|
1028 | - $STA_ID = is_array( $state ) && ! empty( $state ) ? reset( $state ) : $STA_ID; |
|
1026 | + EE_Registry::instance()->load_model('State'); |
|
1027 | + $state = EEM_State::instance()->get_col(array(array('STA_name' => $STA_ID), 'limit' => 1), 'STA_ID'); |
|
1028 | + $STA_ID = is_array($state) && ! empty($state) ? reset($state) : $STA_ID; |
|
1029 | 1029 | } |
1030 | 1030 | // get Country ISO |
1031 | - $CNT_ISO = ! empty( $_REQUEST['country'] ) ? sanitize_text_field( $_REQUEST['country'] ) : ''; |
|
1032 | - if ( ! empty( $CNT_ISO )) { |
|
1031 | + $CNT_ISO = ! empty($_REQUEST['country']) ? sanitize_text_field($_REQUEST['country']) : ''; |
|
1032 | + if ( ! empty($CNT_ISO)) { |
|
1033 | 1033 | // can we get country object from name ? |
1034 | - EE_Registry::instance()->load_model( 'Country' ); |
|
1035 | - $country = EEM_Country::instance()->get_col( array( array( 'CNT_name' => $CNT_ISO ), 'limit' => 1), 'CNT_ISO' ); |
|
1036 | - $CNT_ISO = is_array( $country ) && ! empty( $country ) ? reset( $country ) : $CNT_ISO; |
|
1034 | + EE_Registry::instance()->load_model('Country'); |
|
1035 | + $country = EEM_Country::instance()->get_col(array(array('CNT_name' => $CNT_ISO), 'limit' => 1), 'CNT_ISO'); |
|
1036 | + $CNT_ISO = is_array($country) && ! empty($country) ? reset($country) : $CNT_ISO; |
|
1037 | 1037 | } |
1038 | 1038 | // grab attendee data |
1039 | 1039 | $attendee_data = array( |
1040 | - 'ATT_fname' => ! empty( $_REQUEST['first_name'] ) ? sanitize_text_field( $_REQUEST['first_name'] ) : '', |
|
1041 | - 'ATT_lname' => ! empty( $_REQUEST['last_name'] ) ? sanitize_text_field( $_REQUEST['last_name'] ) : '', |
|
1042 | - 'ATT_email' => ! empty( $_REQUEST['email'] ) ? sanitize_email( $_REQUEST['email'] ) : '', |
|
1043 | - 'ATT_address' => ! empty( $_REQUEST['address'] ) ? sanitize_text_field( $_REQUEST['address'] ) : '', |
|
1044 | - 'ATT_address2' => ! empty( $_REQUEST['address2'] ) ? sanitize_text_field( $_REQUEST['address2'] ) : '', |
|
1045 | - 'ATT_city' => ! empty( $_REQUEST['city'] ) ? sanitize_text_field( $_REQUEST['city'] ) : '', |
|
1040 | + 'ATT_fname' => ! empty($_REQUEST['first_name']) ? sanitize_text_field($_REQUEST['first_name']) : '', |
|
1041 | + 'ATT_lname' => ! empty($_REQUEST['last_name']) ? sanitize_text_field($_REQUEST['last_name']) : '', |
|
1042 | + 'ATT_email' => ! empty($_REQUEST['email']) ? sanitize_email($_REQUEST['email']) : '', |
|
1043 | + 'ATT_address' => ! empty($_REQUEST['address']) ? sanitize_text_field($_REQUEST['address']) : '', |
|
1044 | + 'ATT_address2' => ! empty($_REQUEST['address2']) ? sanitize_text_field($_REQUEST['address2']) : '', |
|
1045 | + 'ATT_city' => ! empty($_REQUEST['city']) ? sanitize_text_field($_REQUEST['city']) : '', |
|
1046 | 1046 | 'STA_ID' => $STA_ID, |
1047 | 1047 | 'CNT_ISO' => $CNT_ISO, |
1048 | - 'ATT_zip' => ! empty( $_REQUEST['zip'] ) ? sanitize_text_field( $_REQUEST['zip'] ) : '', |
|
1049 | - 'ATT_phone' => ! empty( $_REQUEST['phone'] ) ? sanitize_text_field( $_REQUEST['phone'] ) : '', |
|
1048 | + 'ATT_zip' => ! empty($_REQUEST['zip']) ? sanitize_text_field($_REQUEST['zip']) : '', |
|
1049 | + 'ATT_phone' => ! empty($_REQUEST['phone']) ? sanitize_text_field($_REQUEST['phone']) : '', |
|
1050 | 1050 | ); |
1051 | 1051 | // validate the email address since it is the most important piece of info |
1052 | - if ( empty( $attendee_data['ATT_email'] ) || $attendee_data['ATT_email'] != $_REQUEST['email'] ) { |
|
1053 | - EE_Error::add_error( __( 'An invalid email address was submitted.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1052 | + if (empty($attendee_data['ATT_email']) || $attendee_data['ATT_email'] != $_REQUEST['email']) { |
|
1053 | + EE_Error::add_error(__('An invalid email address was submitted.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1054 | 1054 | } |
1055 | 1055 | // does this attendee already exist in the db ? we're searching using a combination of first name, last name, AND email address |
1056 | - if ( ! empty( $attendee_data['ATT_fname'] ) && ! empty( $attendee_data['ATT_lname'] ) && ! empty( $attendee_data['ATT_email'] ) ) { |
|
1057 | - $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee( array( |
|
1056 | + if ( ! empty($attendee_data['ATT_fname']) && ! empty($attendee_data['ATT_lname']) && ! empty($attendee_data['ATT_email'])) { |
|
1057 | + $existing_attendee = EE_Registry::instance()->LIB->EEM_Attendee->find_existing_attendee(array( |
|
1058 | 1058 | 'ATT_fname' => $attendee_data['ATT_fname'], |
1059 | 1059 | 'ATT_lname' => $attendee_data['ATT_lname'], |
1060 | 1060 | 'ATT_email' => $attendee_data['ATT_email'] |
1061 | 1061 | )); |
1062 | - if ( $existing_attendee instanceof EE_Attendee ) { |
|
1062 | + if ($existing_attendee instanceof EE_Attendee) { |
|
1063 | 1063 | return $existing_attendee; |
1064 | 1064 | } |
1065 | 1065 | } |
1066 | 1066 | // no existing attendee? kk let's create a new one |
1067 | 1067 | // kinda lame, but we need a first and last name to create an attendee, so use the email address if those don't exist |
1068 | - $attendee_data['ATT_fname'] = ! empty( $attendee_data['ATT_fname'] ) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1069 | - $attendee_data['ATT_lname'] = ! empty( $attendee_data['ATT_lname'] ) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1070 | - return EE_Attendee::new_instance( $attendee_data ); |
|
1068 | + $attendee_data['ATT_fname'] = ! empty($attendee_data['ATT_fname']) ? $attendee_data['ATT_fname'] : $attendee_data['ATT_email']; |
|
1069 | + $attendee_data['ATT_lname'] = ! empty($attendee_data['ATT_lname']) ? $attendee_data['ATT_lname'] : $attendee_data['ATT_email']; |
|
1070 | + return EE_Attendee::new_instance($attendee_data); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | |
@@ -1087,22 +1087,22 @@ discard block |
||
1087 | 1087 | */ |
1088 | 1088 | public function process_reg_step() { |
1089 | 1089 | // how have they chosen to pay? |
1090 | - $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment( TRUE ); |
|
1090 | + $this->checkout->selected_method_of_payment = $this->checkout->transaction->is_free() ? 'no_payment_required' : $this->_get_selected_method_of_payment(TRUE); |
|
1091 | 1091 | // choose your own adventure based on method_of_payment |
1092 | - switch( $this->checkout->selected_method_of_payment ) { |
|
1092 | + switch ($this->checkout->selected_method_of_payment) { |
|
1093 | 1093 | |
1094 | 1094 | case 'events_sold_out' : |
1095 | 1095 | $this->checkout->redirect = TRUE; |
1096 | 1096 | $this->checkout->redirect_url = $this->checkout->cancel_page_url; |
1097 | - $this->checkout->json_response->set_redirect_url( $this->checkout->redirect_url ); |
|
1097 | + $this->checkout->json_response->set_redirect_url($this->checkout->redirect_url); |
|
1098 | 1098 | // mark this reg step as completed |
1099 | 1099 | $this->set_completed(); |
1100 | 1100 | return FALSE; |
1101 | 1101 | break; |
1102 | 1102 | |
1103 | 1103 | case 'payments_closed' : |
1104 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false ) ) { |
|
1105 | - EE_Error::add_success( __( 'no payment required at this time.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1104 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__payments_closed__display_success', false)) { |
|
1105 | + EE_Error::add_success(__('no payment required at this time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1106 | 1106 | } |
1107 | 1107 | // mark this reg step as completed |
1108 | 1108 | $this->set_completed(); |
@@ -1110,8 +1110,8 @@ discard block |
||
1110 | 1110 | break; |
1111 | 1111 | |
1112 | 1112 | case 'no_payment_required' : |
1113 | - if ( apply_filters( 'FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false ) ) { |
|
1114 | - EE_Error::add_success( __( 'no payment required.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1113 | + if (apply_filters('FHEE__EE_SPCO_Reg_Step_Payment_Options__process_reg_step__no_payment_required__display_success', false)) { |
|
1114 | + EE_Error::add_success(__('no payment required.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1115 | 1115 | } |
1116 | 1116 | // mark this reg step as completed |
1117 | 1117 | $this->set_completed(); |
@@ -1120,9 +1120,9 @@ discard block |
||
1120 | 1120 | |
1121 | 1121 | default: |
1122 | 1122 | $payment_successful = $this->_process_payment(); |
1123 | - if ( $payment_successful ) { |
|
1123 | + if ($payment_successful) { |
|
1124 | 1124 | $this->checkout->continue_reg = true; |
1125 | - $this->_maybe_set_completed( $this->checkout->payment_method ); |
|
1125 | + $this->_maybe_set_completed($this->checkout->payment_method); |
|
1126 | 1126 | } else { |
1127 | 1127 | $this->checkout->continue_reg = false; |
1128 | 1128 | } |
@@ -1140,8 +1140,8 @@ discard block |
||
1140 | 1140 | * @param \EE_Payment_Method $payment_method |
1141 | 1141 | * @return void |
1142 | 1142 | */ |
1143 | - protected function _maybe_set_completed( EE_Payment_Method $payment_method ) { |
|
1144 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1143 | + protected function _maybe_set_completed(EE_Payment_Method $payment_method) { |
|
1144 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1145 | 1145 | case EE_PMT_Base::offsite : |
1146 | 1146 | break; |
1147 | 1147 | case EE_PMT_Base::onsite : |
@@ -1164,15 +1164,15 @@ discard block |
||
1164 | 1164 | public function update_reg_step() { |
1165 | 1165 | $success = TRUE; |
1166 | 1166 | // if payment required |
1167 | - if ( $this->checkout->transaction->total() > 0 ) { |
|
1168 | - do_action ('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction ); |
|
1167 | + if ($this->checkout->transaction->total() > 0) { |
|
1168 | + do_action('AHEE__EE_Single_Page_Checkout__process_finalize_registration__before_gateway', $this->checkout->transaction); |
|
1169 | 1169 | // attempt payment via payment method |
1170 | 1170 | $success = $this->process_reg_step(); |
1171 | 1171 | } |
1172 | - if ( $success && ! $this->checkout->redirect ) { |
|
1173 | - $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn( $this->checkout->transaction->ID() ); |
|
1172 | + if ($success && ! $this->checkout->redirect) { |
|
1173 | + $this->checkout->cart->get_grand_total()->save_this_and_descendants_to_txn($this->checkout->transaction->ID()); |
|
1174 | 1174 | // set return URL |
1175 | - $this->checkout->redirect_url = add_query_arg( array( 'e_reg_url_link' => $this->checkout->reg_url_link ), $this->checkout->thank_you_page_url ); |
|
1175 | + $this->checkout->redirect_url = add_query_arg(array('e_reg_url_link' => $this->checkout->reg_url_link), $this->checkout->thank_you_page_url); |
|
1176 | 1176 | } |
1177 | 1177 | return $success; |
1178 | 1178 | } |
@@ -1190,32 +1190,32 @@ discard block |
||
1190 | 1190 | */ |
1191 | 1191 | private function _process_payment() { |
1192 | 1192 | // basically confirm that the event hasn't sold out since they hit the page |
1193 | - if ( ! $this->_last_second_ticket_verifications() ) { |
|
1193 | + if ( ! $this->_last_second_ticket_verifications()) { |
|
1194 | 1194 | return false; |
1195 | 1195 | } |
1196 | 1196 | // ya gotta make a choice man |
1197 | - if ( empty( $this->checkout->selected_method_of_payment )) { |
|
1198 | - $this->checkout->json_response->set_plz_select_method_of_payment( __( 'Please select a method of payment before proceeding.', 'event_espresso' )); |
|
1197 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
1198 | + $this->checkout->json_response->set_plz_select_method_of_payment(__('Please select a method of payment before proceeding.', 'event_espresso')); |
|
1199 | 1199 | return FALSE; |
1200 | 1200 | } |
1201 | 1201 | // get EE_Payment_Method object |
1202 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1202 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1203 | 1203 | return FALSE; |
1204 | 1204 | } |
1205 | 1205 | // setup billing form |
1206 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1207 | - $this->checkout->billing_form = $this->_get_billing_form_for_payment_method( $this->checkout->payment_method ); |
|
1206 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1207 | + $this->checkout->billing_form = $this->_get_billing_form_for_payment_method($this->checkout->payment_method); |
|
1208 | 1208 | // bad billing form ? |
1209 | - if ( ! $this->_billing_form_is_valid() ) { |
|
1209 | + if ( ! $this->_billing_form_is_valid()) { |
|
1210 | 1210 | return FALSE; |
1211 | 1211 | } |
1212 | 1212 | } |
1213 | 1213 | // ensure primary registrant has been fully processed |
1214 | - if ( ! $this->_setup_primary_registrant_prior_to_payment() ) { |
|
1214 | + if ( ! $this->_setup_primary_registrant_prior_to_payment()) { |
|
1215 | 1215 | return FALSE; |
1216 | 1216 | } |
1217 | 1217 | // if session is close to expiring (under 10 minutes by default) |
1218 | - if ( ( time() - EE_Registry::instance()->SSN->expiration() ) < EE_Registry::instance()->SSN->extension() ) { |
|
1218 | + if ((time() - EE_Registry::instance()->SSN->expiration()) < EE_Registry::instance()->SSN->extension()) { |
|
1219 | 1219 | // add some time to session expiration so that payment can be completed |
1220 | 1220 | EE_Registry::instance()->SSN->extend_expiration(); |
1221 | 1221 | } |
@@ -1224,24 +1224,24 @@ discard block |
||
1224 | 1224 | // in case a registrant leaves to an Off-Site Gateway and never returns, we want to approve any registrations for events with a default reg status of Approved |
1225 | 1225 | //$transaction_processor->toggle_registration_statuses_for_default_approved_events( $this->checkout->transaction, $this->checkout->reg_cache_where_params ); |
1226 | 1226 | // attempt payment |
1227 | - $payment = $this->_attempt_payment( $this->checkout->payment_method ); |
|
1227 | + $payment = $this->_attempt_payment($this->checkout->payment_method); |
|
1228 | 1228 | // process results |
1229 | - $payment = $this->_validate_payment( $payment ); |
|
1230 | - $payment = $this->_post_payment_processing( $payment ); |
|
1229 | + $payment = $this->_validate_payment($payment); |
|
1230 | + $payment = $this->_post_payment_processing($payment); |
|
1231 | 1231 | // verify payment |
1232 | - if ( $payment instanceof EE_Payment ) { |
|
1232 | + if ($payment instanceof EE_Payment) { |
|
1233 | 1233 | // store that for later |
1234 | 1234 | $this->checkout->payment = $payment; |
1235 | 1235 | /** @type EE_Transaction_Processor $transaction_processor */ |
1236 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1236 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1237 | 1237 | // we can also consider the TXN to not have been failed, so temporarily upgrade it's status to abandoned |
1238 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1239 | - if ( $payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending ) { |
|
1238 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1239 | + if ($payment->status() == EEM_Payment::status_id_approved || $payment->status() == EEM_Payment::status_id_pending) { |
|
1240 | 1240 | return true; |
1241 | 1241 | } else { |
1242 | 1242 | return false; |
1243 | 1243 | } |
1244 | - } else if ( $payment === true ) { |
|
1244 | + } else if ($payment === true) { |
|
1245 | 1245 | // please note that offline payment methods will NOT make a payment, |
1246 | 1246 | // but instead just mark themselves as the PMD_ID on the transaction, and return true |
1247 | 1247 | $this->checkout->payment = $payment; |
@@ -1261,22 +1261,22 @@ discard block |
||
1261 | 1261 | */ |
1262 | 1262 | protected function _last_second_ticket_verifications() { |
1263 | 1263 | // don't bother re-validating if not a return visit |
1264 | - if ( ! $this->checkout->revisit ) { |
|
1264 | + if ( ! $this->checkout->revisit) { |
|
1265 | 1265 | return true; |
1266 | 1266 | } |
1267 | 1267 | $registrations = $this->checkout->transaction->registrations(); |
1268 | - if ( empty( $registrations ) ) { |
|
1268 | + if (empty($registrations)) { |
|
1269 | 1269 | return false; |
1270 | 1270 | } |
1271 | - foreach ( $registrations as $registration ) { |
|
1272 | - if ( $registration instanceof EE_Registration ) { |
|
1271 | + foreach ($registrations as $registration) { |
|
1272 | + if ($registration instanceof EE_Registration) { |
|
1273 | 1273 | $event = $registration->event_obj(); |
1274 | - if ( ! ( $event instanceof EE_Event && $event->is_sold_out( true ) ) ) { |
|
1274 | + if ( ! ($event instanceof EE_Event && $event->is_sold_out(true))) { |
|
1275 | 1275 | EE_Error::add_error( |
1276 | 1276 | apply_filters( |
1277 | 1277 | 'FHEE__EE_SPCO_Reg_Step_Payment_Options___last_second_ticket_verifications__sold_out_events_msg', |
1278 | 1278 | sprintf( |
1279 | - __( 'It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso' ), |
|
1279 | + __('It appears that the %1$s event that you were about to make a payment for has sold out since you first registered and/or arrived at this page. Please refresh the page and try again. If you have already made a partial payment towards this event, please contact the event administrator for a refund.', 'event_espresso'), |
|
1280 | 1280 | $event->name() |
1281 | 1281 | ) |
1282 | 1282 | ), |
@@ -1300,10 +1300,10 @@ discard block |
||
1300 | 1300 | * @return bool |
1301 | 1301 | */ |
1302 | 1302 | public function redirect_form() { |
1303 | - $payment_method_billing_info = $this->_payment_method_billing_info( $this->_get_payment_method_for_selected_method_of_payment() ); |
|
1303 | + $payment_method_billing_info = $this->_payment_method_billing_info($this->_get_payment_method_for_selected_method_of_payment()); |
|
1304 | 1304 | $html = $payment_method_billing_info->get_html_and_js(); |
1305 | 1305 | $html .= $this->checkout->redirect_form; |
1306 | - EE_Registry::instance()->REQ->add_output( $html ); |
|
1306 | + EE_Registry::instance()->REQ->add_output($html); |
|
1307 | 1307 | return TRUE; |
1308 | 1308 | } |
1309 | 1309 | |
@@ -1316,36 +1316,36 @@ discard block |
||
1316 | 1316 | * @return bool |
1317 | 1317 | */ |
1318 | 1318 | private function _billing_form_is_valid() { |
1319 | - if ( ! $this->checkout->payment_method->type_obj()->has_billing_form() ) { |
|
1319 | + if ( ! $this->checkout->payment_method->type_obj()->has_billing_form()) { |
|
1320 | 1320 | return TRUE; |
1321 | 1321 | } |
1322 | - if ( $this->checkout->billing_form instanceof EE_Billing_Info_Form ) { |
|
1323 | - if ( $this->checkout->billing_form->was_submitted() ) { |
|
1322 | + if ($this->checkout->billing_form instanceof EE_Billing_Info_Form) { |
|
1323 | + if ($this->checkout->billing_form->was_submitted()) { |
|
1324 | 1324 | $this->checkout->billing_form->receive_form_submission(); |
1325 | - if ( $this->checkout->billing_form->is_valid() ) { |
|
1325 | + if ($this->checkout->billing_form->is_valid()) { |
|
1326 | 1326 | return TRUE; |
1327 | 1327 | } |
1328 | 1328 | $validation_errors = $this->checkout->billing_form->get_validation_errors_accumulated(); |
1329 | 1329 | $error_strings = array(); |
1330 | - foreach( $validation_errors as $validation_error ){ |
|
1331 | - if( $validation_error instanceof EE_Validation_Error ){ |
|
1330 | + foreach ($validation_errors as $validation_error) { |
|
1331 | + if ($validation_error instanceof EE_Validation_Error) { |
|
1332 | 1332 | $form_section = $validation_error->get_form_section(); |
1333 | - if( $form_section instanceof EE_Form_Input_Base ){ |
|
1333 | + if ($form_section instanceof EE_Form_Input_Base) { |
|
1334 | 1334 | $label = $form_section->html_label_text(); |
1335 | - }elseif( $form_section instanceof EE_Form_Section_Base ){ |
|
1335 | + }elseif ($form_section instanceof EE_Form_Section_Base) { |
|
1336 | 1336 | $label = $form_section->name(); |
1337 | - }else{ |
|
1338 | - $label = __( 'Validation Error', 'event_espresso' ); |
|
1337 | + } else { |
|
1338 | + $label = __('Validation Error', 'event_espresso'); |
|
1339 | 1339 | } |
1340 | - $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage() ); |
|
1340 | + $error_strings[] = sprintf('%1$s: %2$s', $label, $validation_error->getMessage()); |
|
1341 | 1341 | } |
1342 | 1342 | } |
1343 | - EE_Error::add_error( sprintf( __( 'One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso' ), '<br/>', implode( '<br/>', $error_strings ) ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1343 | + EE_Error::add_error(sprintf(__('One or more billing form inputs are invalid and require correction before proceeding. %1$s %2$s', 'event_espresso'), '<br/>', implode('<br/>', $error_strings)), __FILE__, __FUNCTION__, __LINE__); |
|
1344 | 1344 | } else { |
1345 | - EE_Error::add_error( __( 'The billing form was not submitted or something prevented it\'s submission.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1345 | + EE_Error::add_error(__('The billing form was not submitted or something prevented it\'s submission.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1346 | 1346 | } |
1347 | 1347 | } else { |
1348 | - EE_Error::add_error( __( 'The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1348 | + EE_Error::add_error(__('The submitted billing form is invalid possibly due to a technical reason.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1349 | 1349 | } |
1350 | 1350 | return FALSE; |
1351 | 1351 | } |
@@ -1363,9 +1363,9 @@ discard block |
||
1363 | 1363 | */ |
1364 | 1364 | private function _setup_primary_registrant_prior_to_payment() { |
1365 | 1365 | // check if transaction has a primary registrant and that it has a related Attendee object |
1366 | - if ( ! $this->checkout->transaction_has_primary_registrant() ) { |
|
1366 | + if ( ! $this->checkout->transaction_has_primary_registrant()) { |
|
1367 | 1367 | // need to at least gather some primary registrant data before attempting payment |
1368 | - if ( $this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form() ) { |
|
1368 | + if ($this->checkout->billing_form instanceof EE_Billing_Attendee_Info_Form && ! $this->_capture_primary_registration_data_from_billing_form()) { |
|
1369 | 1369 | return FALSE; |
1370 | 1370 | } |
1371 | 1371 | } |
@@ -1373,13 +1373,13 @@ discard block |
||
1373 | 1373 | // grab the primary_registration object |
1374 | 1374 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1375 | 1375 | /** @type EE_Transaction_Processor $transaction_processor */ |
1376 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1376 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1377 | 1377 | // at this point we'll consider a TXN to not have been failed |
1378 | - $transaction_processor->toggle_failed_transaction_status( $this->checkout->transaction ); |
|
1378 | + $transaction_processor->toggle_failed_transaction_status($this->checkout->transaction); |
|
1379 | 1379 | // save the TXN ( which clears cached copy of primary_registration) |
1380 | 1380 | $this->checkout->transaction->save(); |
1381 | 1381 | // grab TXN ID and save it to the primary_registration |
1382 | - $primary_registration->set_transaction_id( $this->checkout->transaction->ID() ); |
|
1382 | + $primary_registration->set_transaction_id($this->checkout->transaction->ID()); |
|
1383 | 1383 | // save what we have so far |
1384 | 1384 | $primary_registration->save(); |
1385 | 1385 | return TRUE; |
@@ -1396,41 +1396,41 @@ discard block |
||
1396 | 1396 | private function _capture_primary_registration_data_from_billing_form() { |
1397 | 1397 | // convert billing form data into an attendee |
1398 | 1398 | $this->checkout->primary_attendee_obj = $this->checkout->billing_form->create_attendee_from_billing_form_data(); |
1399 | - if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee ) { |
|
1399 | + if ( ! $this->checkout->primary_attendee_obj instanceof EE_Attendee) { |
|
1400 | 1400 | EE_Error::add_error( |
1401 | 1401 | sprintf( |
1402 | - __( 'The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1402 | + __('The billing form details could not be used for attendee details due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1403 | 1403 | '<br/>', |
1404 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1404 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1405 | 1405 | ), __FILE__, __FUNCTION__, __LINE__ |
1406 | 1406 | ); |
1407 | 1407 | return FALSE; |
1408 | 1408 | } |
1409 | 1409 | $primary_registration = $this->checkout->transaction->primary_registration(); |
1410 | - if ( ! $primary_registration instanceof EE_Registration ) { |
|
1410 | + if ( ! $primary_registration instanceof EE_Registration) { |
|
1411 | 1411 | EE_Error::add_error( |
1412 | 1412 | sprintf( |
1413 | - __( 'The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1413 | + __('The primary registrant for this transaction could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1414 | 1414 | '<br/>', |
1415 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1415 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1416 | 1416 | ), __FILE__, __FUNCTION__, __LINE__ |
1417 | 1417 | ); |
1418 | 1418 | return FALSE; |
1419 | 1419 | } |
1420 | - if ( ! $primary_registration->_add_relation_to( $this->checkout->primary_attendee_obj, 'Attendee' ) instanceof EE_Attendee ) { |
|
1420 | + if ( ! $primary_registration->_add_relation_to($this->checkout->primary_attendee_obj, 'Attendee') instanceof EE_Attendee) { |
|
1421 | 1421 | EE_Error::add_error( |
1422 | 1422 | sprintf( |
1423 | - __( 'The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1423 | + __('The primary registrant could not be associated with this transaction due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1424 | 1424 | '<br/>', |
1425 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1425 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1426 | 1426 | ), __FILE__, __FUNCTION__, __LINE__ |
1427 | 1427 | ); |
1428 | 1428 | return FALSE; |
1429 | 1429 | } |
1430 | 1430 | /** @type EE_Registration_Processor $registration_processor */ |
1431 | - $registration_processor = EE_Registry::instance()->load_class( 'Registration_Processor' ); |
|
1431 | + $registration_processor = EE_Registry::instance()->load_class('Registration_Processor'); |
|
1432 | 1432 | // at this point, we should have enough details about the registrant to consider the registration NOT incomplete |
1433 | - $registration_processor->toggle_incomplete_registration_status_to_default( $primary_registration ); |
|
1433 | + $registration_processor->toggle_incomplete_registration_status_to_default($primary_registration); |
|
1434 | 1434 | |
1435 | 1435 | return TRUE; |
1436 | 1436 | } |
@@ -1446,35 +1446,35 @@ discard block |
||
1446 | 1446 | */ |
1447 | 1447 | private function _get_payment_method_for_selected_method_of_payment() { |
1448 | 1448 | // get EE_Payment_Method object |
1449 | - if ( isset( $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ] )) { |
|
1450 | - $payment_method = $this->checkout->available_payment_methods[ $this->checkout->selected_method_of_payment ]; |
|
1449 | + if (isset($this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment])) { |
|
1450 | + $payment_method = $this->checkout->available_payment_methods[$this->checkout->selected_method_of_payment]; |
|
1451 | 1451 | } else { |
1452 | 1452 | // load EEM_Payment_Method |
1453 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
1453 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
1454 | 1454 | /** @type EEM_Payment_Method $EEM_Payment_Method */ |
1455 | 1455 | $EEM_Payment_Method = EE_Registry::instance()->LIB->EEM_Payment_Method; |
1456 | - $payment_method = $EEM_Payment_Method->get_one_by_slug( $this->checkout->selected_method_of_payment ); |
|
1456 | + $payment_method = $EEM_Payment_Method->get_one_by_slug($this->checkout->selected_method_of_payment); |
|
1457 | 1457 | } |
1458 | 1458 | // verify $payment_method |
1459 | - if ( ! $payment_method instanceof EE_Payment_Method ) { |
|
1459 | + if ( ! $payment_method instanceof EE_Payment_Method) { |
|
1460 | 1460 | // not a payment |
1461 | 1461 | EE_Error::add_error( |
1462 | 1462 | sprintf( |
1463 | - __( 'The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1463 | + __('The selected method of payment could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1464 | 1464 | '<br/>', |
1465 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1465 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1466 | 1466 | ), __FILE__, __FUNCTION__, __LINE__ |
1467 | 1467 | ); |
1468 | 1468 | return NULL; |
1469 | 1469 | } |
1470 | 1470 | // and verify it has a valid Payment_Method Type object |
1471 | - if ( ! $payment_method->type_obj() instanceof EE_PMT_Base ) { |
|
1471 | + if ( ! $payment_method->type_obj() instanceof EE_PMT_Base) { |
|
1472 | 1472 | // not a payment |
1473 | 1473 | EE_Error::add_error( |
1474 | 1474 | sprintf( |
1475 | - __( 'A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1475 | + __('A valid payment method could not be determined due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1476 | 1476 | '<br/>', |
1477 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1477 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1478 | 1478 | ), __FILE__, __FUNCTION__, __LINE__ |
1479 | 1479 | ); |
1480 | 1480 | return NULL; |
@@ -1493,30 +1493,30 @@ discard block |
||
1493 | 1493 | * @type EE_Payment_Method $payment_method |
1494 | 1494 | * @return mixed EE_Payment | boolean |
1495 | 1495 | */ |
1496 | - private function _attempt_payment( EE_Payment_Method $payment_method ) { |
|
1497 | - $payment =NULL; |
|
1496 | + private function _attempt_payment(EE_Payment_Method $payment_method) { |
|
1497 | + $payment = NULL; |
|
1498 | 1498 | $this->checkout->transaction->save(); |
1499 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1500 | - if ( ! $payment_processor instanceof EE_Payment_Processor ) { |
|
1499 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1500 | + if ( ! $payment_processor instanceof EE_Payment_Processor) { |
|
1501 | 1501 | return FALSE; |
1502 | 1502 | } |
1503 | 1503 | try { |
1504 | - $payment_processor->set_revisit( $this->checkout->revisit ); |
|
1504 | + $payment_processor->set_revisit($this->checkout->revisit); |
|
1505 | 1505 | // generate payment object |
1506 | 1506 | $payment = $payment_processor->process_payment( |
1507 | 1507 | $payment_method, |
1508 | 1508 | $this->checkout->transaction, |
1509 | 1509 | $this->checkout->amount_owing, |
1510 | 1510 | $this->checkout->billing_form, |
1511 | - $this->_get_return_url( $payment_method ), |
|
1511 | + $this->_get_return_url($payment_method), |
|
1512 | 1512 | 'CART', |
1513 | 1513 | $this->checkout->admin_request, |
1514 | 1514 | TRUE, |
1515 | 1515 | $this->reg_step_url() |
1516 | 1516 | ); |
1517 | 1517 | |
1518 | - } catch( Exception $e ) { |
|
1519 | - $this->_handle_payment_processor_exception( $e ); |
|
1518 | + } catch (Exception $e) { |
|
1519 | + $this->_handle_payment_processor_exception($e); |
|
1520 | 1520 | } |
1521 | 1521 | return $payment; |
1522 | 1522 | } |
@@ -1530,12 +1530,12 @@ discard block |
||
1530 | 1530 | * @param \Exception $e |
1531 | 1531 | * @return void |
1532 | 1532 | */ |
1533 | - protected function _handle_payment_processor_exception( Exception $e ) { |
|
1533 | + protected function _handle_payment_processor_exception(Exception $e) { |
|
1534 | 1534 | EE_Error::add_error( |
1535 | 1535 | sprintf( |
1536 | - __( 'The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso' ), |
|
1536 | + __('The payment could not br processed due to a technical issue.%1$sPlease try again or contact %2$s for assistance.||The following Exception was thrown in %4$s on line %5$s:%1$s%3$s', 'event_espresso'), |
|
1537 | 1537 | '<br/>', |
1538 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ), |
|
1538 | + EE_Registry::instance()->CFG->organization->get_pretty('email'), |
|
1539 | 1539 | $e->getMessage(), |
1540 | 1540 | $e->getFile(), |
1541 | 1541 | $e->getLine() |
@@ -1552,9 +1552,9 @@ discard block |
||
1552 | 1552 | * @param \EE_Payment_Method $payment_method |
1553 | 1553 | * @return string |
1554 | 1554 | */ |
1555 | - protected function _get_return_url( EE_Payment_Method $payment_method ) { |
|
1555 | + protected function _get_return_url(EE_Payment_Method $payment_method) { |
|
1556 | 1556 | $return_url = ''; |
1557 | - switch ( $payment_method->type_obj()->payment_occurs() ) { |
|
1557 | + switch ($payment_method->type_obj()->payment_occurs()) { |
|
1558 | 1558 | |
1559 | 1559 | case EE_PMT_Base::offsite : |
1560 | 1560 | $return_url = add_query_arg( |
@@ -1585,18 +1585,18 @@ discard block |
||
1585 | 1585 | * @param EE_Payment $payment |
1586 | 1586 | * @return EE_Payment | FALSE |
1587 | 1587 | */ |
1588 | - private function _validate_payment( $payment = NULL ) { |
|
1589 | - if ( $this->checkout->payment_method->is_off_line() ) { |
|
1588 | + private function _validate_payment($payment = NULL) { |
|
1589 | + if ($this->checkout->payment_method->is_off_line()) { |
|
1590 | 1590 | return TRUE; |
1591 | 1591 | } |
1592 | 1592 | // verify payment object |
1593 | - if ( ! $payment instanceof EE_Payment ) { |
|
1593 | + if ( ! $payment instanceof EE_Payment) { |
|
1594 | 1594 | // not a payment |
1595 | 1595 | EE_Error::add_error( |
1596 | 1596 | sprintf( |
1597 | - __( 'A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1597 | + __('A valid payment was not generated due to a technical issue.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1598 | 1598 | '<br/>', |
1599 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1599 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1600 | 1600 | ), __FILE__, __FUNCTION__, __LINE__ |
1601 | 1601 | ); |
1602 | 1602 | return FALSE; |
@@ -1613,23 +1613,23 @@ discard block |
||
1613 | 1613 | * @param EE_Payment $payment |
1614 | 1614 | * @return bool |
1615 | 1615 | */ |
1616 | - private function _post_payment_processing( $payment = NULL ) { |
|
1616 | + private function _post_payment_processing($payment = NULL) { |
|
1617 | 1617 | // On-Site payment? |
1618 | - if ( $this->checkout->payment_method->is_on_site() ) { |
|
1619 | - if ( ! $this->_process_payment_status( $payment, EE_PMT_Base::onsite )) { |
|
1618 | + if ($this->checkout->payment_method->is_on_site()) { |
|
1619 | + if ( ! $this->_process_payment_status($payment, EE_PMT_Base::onsite)) { |
|
1620 | 1620 | //$this->_setup_redirect_for_next_step(); |
1621 | 1621 | $this->checkout->continue_reg = false; |
1622 | 1622 | } |
1623 | 1623 | // Off-Site payment? |
1624 | - } else if ( $this->checkout->payment_method->is_off_site() ) { |
|
1624 | + } else if ($this->checkout->payment_method->is_off_site()) { |
|
1625 | 1625 | // if a payment object was made and it specifies a redirect url, then we'll setup that redirect info |
1626 | - if ( $payment instanceof EE_Payment && $payment->redirect_url() ){ |
|
1627 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()' ); |
|
1626 | + if ($payment instanceof EE_Payment && $payment->redirect_url()) { |
|
1627 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->redirect_url(), '$payment->redirect_url()'); |
|
1628 | 1628 | $this->checkout->redirect = TRUE; |
1629 | 1629 | $this->checkout->redirect_form = $payment->redirect_form(); |
1630 | - $this->checkout->redirect_url = $this->reg_step_url( 'redirect_form' ); |
|
1630 | + $this->checkout->redirect_url = $this->reg_step_url('redirect_form'); |
|
1631 | 1631 | // set JSON response |
1632 | - $this->checkout->json_response->set_redirect_form( $this->checkout->redirect_form ); |
|
1632 | + $this->checkout->json_response->set_redirect_form($this->checkout->redirect_form); |
|
1633 | 1633 | // set cron job for finalizing the TXN |
1634 | 1634 | // in case the user does not return from the off-site gateway |
1635 | 1635 | EE_Cron_Tasks::schedule_finalize_abandoned_transactions_check( |
@@ -1637,21 +1637,21 @@ discard block |
||
1637 | 1637 | $this->checkout->transaction->ID() |
1638 | 1638 | ); |
1639 | 1639 | // and lastly, let's bump the payment status to pending |
1640 | - $payment->set_status( EEM_Payment::status_id_pending ); |
|
1640 | + $payment->set_status(EEM_Payment::status_id_pending); |
|
1641 | 1641 | $payment->save(); |
1642 | 1642 | } else { |
1643 | 1643 | // not a payment |
1644 | 1644 | $this->checkout->continue_reg = false; |
1645 | 1645 | EE_Error::add_error( |
1646 | 1646 | sprintf( |
1647 | - __( 'It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1647 | + __('It appears the Off Site Payment Method was not configured properly.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1648 | 1648 | '<br/>', |
1649 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1649 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1650 | 1650 | ), __FILE__, __FUNCTION__, __LINE__ |
1651 | 1651 | ); |
1652 | 1652 | } |
1653 | 1653 | // Off-Line payment? |
1654 | - } else if ( $payment === TRUE ) { |
|
1654 | + } else if ($payment === TRUE) { |
|
1655 | 1655 | //$this->_setup_redirect_for_next_step(); |
1656 | 1656 | return TRUE; |
1657 | 1657 | } else { |
@@ -1687,65 +1687,65 @@ discard block |
||
1687 | 1687 | * @return bool |
1688 | 1688 | * @throws \EE_Error |
1689 | 1689 | */ |
1690 | - private function _process_payment_status( $payment, $payment_occurs = EE_PMT_Base::offline ) { |
|
1690 | + private function _process_payment_status($payment, $payment_occurs = EE_PMT_Base::offline) { |
|
1691 | 1691 | // off-line payment? carry on |
1692 | - if ( $payment_occurs == EE_PMT_Base::offline ) { |
|
1692 | + if ($payment_occurs == EE_PMT_Base::offline) { |
|
1693 | 1693 | return true; |
1694 | 1694 | } |
1695 | 1695 | // verify payment validity |
1696 | - if ( $payment instanceof EE_Payment ) { |
|
1697 | - do_action( 'AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()' ); |
|
1696 | + if ($payment instanceof EE_Payment) { |
|
1697 | + do_action('AHEE_log', __CLASS__, __FUNCTION__, $payment->status(), '$payment->status()'); |
|
1698 | 1698 | $msg = $payment->gateway_response(); |
1699 | 1699 | // check results |
1700 | - switch ( $payment->status() ) { |
|
1700 | + switch ($payment->status()) { |
|
1701 | 1701 | |
1702 | 1702 | // good payment |
1703 | 1703 | case EEM_Payment::status_id_approved : |
1704 | - EE_Error::add_success( __( 'Your payment was processed successfully.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
1704 | + EE_Error::add_success(__('Your payment was processed successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
1705 | 1705 | return TRUE; |
1706 | 1706 | break; |
1707 | 1707 | |
1708 | 1708 | // slow payment |
1709 | 1709 | case EEM_Payment::status_id_pending : |
1710 | - if ( empty( $msg )) { |
|
1711 | - $msg = __( 'Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso' ); |
|
1710 | + if (empty($msg)) { |
|
1711 | + $msg = __('Your payment appears to have been processed successfully, but the Instant Payment Notification has not yet been received. It should arrive shortly.', 'event_espresso'); |
|
1712 | 1712 | } |
1713 | - EE_Error::add_success( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1713 | + EE_Error::add_success($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1714 | 1714 | return TRUE; |
1715 | 1715 | break; |
1716 | 1716 | |
1717 | 1717 | // don't wanna payment |
1718 | 1718 | case EEM_Payment::status_id_cancelled : |
1719 | - if ( empty( $msg )) { |
|
1719 | + if (empty($msg)) { |
|
1720 | 1720 | $msg = _n( |
1721 | 1721 | 'Payment cancelled. Please try again.', |
1722 | 1722 | 'Payment cancelled. Please try again or select another method of payment.', |
1723 | - count( $this->checkout->available_payment_methods ), |
|
1723 | + count($this->checkout->available_payment_methods), |
|
1724 | 1724 | 'event_espresso' |
1725 | 1725 | ); |
1726 | 1726 | } |
1727 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1727 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1728 | 1728 | return FALSE; |
1729 | 1729 | break; |
1730 | 1730 | |
1731 | 1731 | // not enough payment |
1732 | 1732 | case EEM_Payment::status_id_declined : |
1733 | - if ( empty( $msg )) { |
|
1733 | + if (empty($msg)) { |
|
1734 | 1734 | $msg = _n( |
1735 | 1735 | 'We\'re sorry but your payment was declined. Please try again.', |
1736 | 1736 | 'We\'re sorry but your payment was declined. Please try again or select another method of payment.', |
1737 | - count( $this->checkout->available_payment_methods ), |
|
1737 | + count($this->checkout->available_payment_methods), |
|
1738 | 1738 | 'event_espresso' |
1739 | 1739 | ); |
1740 | 1740 | } |
1741 | - EE_Error::add_attention( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1741 | + EE_Error::add_attention($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1742 | 1742 | return FALSE; |
1743 | 1743 | break; |
1744 | 1744 | |
1745 | 1745 | // bad payment |
1746 | 1746 | case EEM_Payment::status_id_failed : |
1747 | - if ( ! empty( $msg ) ) { |
|
1748 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1747 | + if ( ! empty($msg)) { |
|
1748 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1749 | 1749 | return false; |
1750 | 1750 | } |
1751 | 1751 | // default to error below |
@@ -1755,14 +1755,14 @@ discard block |
||
1755 | 1755 | } |
1756 | 1756 | // off-site payment gateway responses are too unreliable, so let's just assume that |
1757 | 1757 | // the payment processing is just running slower than the registrant's request |
1758 | - if ( $payment_occurs == EE_PMT_Base::offsite ) { |
|
1758 | + if ($payment_occurs == EE_PMT_Base::offsite) { |
|
1759 | 1759 | return true; |
1760 | 1760 | } |
1761 | 1761 | EE_Error::add_error( |
1762 | 1762 | sprintf( |
1763 | - __( 'Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso' ), |
|
1763 | + __('Your payment could not be processed successfully due to a technical issue.%sPlease try again or contact %s for assistance.', 'event_espresso'), |
|
1764 | 1764 | '<br/>', |
1765 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1765 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1766 | 1766 | ), |
1767 | 1767 | __FILE__, __FUNCTION__, __LINE__ |
1768 | 1768 | ); |
@@ -1795,13 +1795,13 @@ discard block |
||
1795 | 1795 | public function process_gateway_response() { |
1796 | 1796 | $payment = null; |
1797 | 1797 | // how have they chosen to pay? |
1798 | - $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment( true ); |
|
1798 | + $this->checkout->selected_method_of_payment = $this->_get_selected_method_of_payment(true); |
|
1799 | 1799 | // get EE_Payment_Method object |
1800 | - if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() ) { |
|
1800 | + if ( ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment()) { |
|
1801 | 1801 | $this->checkout->continue_reg = false; |
1802 | 1802 | return false; |
1803 | 1803 | } |
1804 | - if ( ! $this->checkout->payment_method->is_off_site() ) { |
|
1804 | + if ( ! $this->checkout->payment_method->is_off_site()) { |
|
1805 | 1805 | return false; |
1806 | 1806 | } |
1807 | 1807 | $this->_validate_offsite_return(); |
@@ -1815,23 +1815,23 @@ discard block |
||
1815 | 1815 | // true |
1816 | 1816 | //); |
1817 | 1817 | // verify TXN |
1818 | - if ( $this->checkout->transaction instanceof EE_Transaction ) { |
|
1818 | + if ($this->checkout->transaction instanceof EE_Transaction) { |
|
1819 | 1819 | $gateway = $this->checkout->payment_method->type_obj()->get_gateway(); |
1820 | - if ( ! $gateway instanceof EE_Offsite_Gateway ) { |
|
1820 | + if ( ! $gateway instanceof EE_Offsite_Gateway) { |
|
1821 | 1821 | $this->checkout->continue_reg = false; |
1822 | 1822 | return false; |
1823 | 1823 | } |
1824 | - $payment = $this->_process_off_site_payment( $gateway ); |
|
1825 | - $payment = $this->_process_cancelled_payments( $payment ); |
|
1826 | - $payment = $this->_validate_payment( $payment ); |
|
1824 | + $payment = $this->_process_off_site_payment($gateway); |
|
1825 | + $payment = $this->_process_cancelled_payments($payment); |
|
1826 | + $payment = $this->_validate_payment($payment); |
|
1827 | 1827 | // if payment was not declined by the payment gateway or cancelled by the registrant |
1828 | - if ( $this->_process_payment_status( $payment, EE_PMT_Base::offsite ) ) { |
|
1828 | + if ($this->_process_payment_status($payment, EE_PMT_Base::offsite)) { |
|
1829 | 1829 | //$this->_setup_redirect_for_next_step(); |
1830 | 1830 | // store that for later |
1831 | 1831 | $this->checkout->payment = $payment; |
1832 | 1832 | // mark this reg step as completed, as long as gateway doesn't use a separate IPN request, |
1833 | 1833 | // because we will complete this step during the IPN processing then |
1834 | - if ( $gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request() ) { |
|
1834 | + if ($gateway instanceof EE_Offsite_Gateway && ! $gateway->uses_separate_IPN_request()) { |
|
1835 | 1835 | $this->set_completed(); |
1836 | 1836 | } |
1837 | 1837 | return true; |
@@ -1854,19 +1854,19 @@ discard block |
||
1854 | 1854 | * @return bool |
1855 | 1855 | */ |
1856 | 1856 | private function _validate_offsite_return() { |
1857 | - $TXN_ID = (int)EE_Registry::instance()->REQ->get( 'spco_txn', 0 ); |
|
1858 | - if ( $TXN_ID != $this->checkout->transaction->ID() ) { |
|
1857 | + $TXN_ID = (int) EE_Registry::instance()->REQ->get('spco_txn', 0); |
|
1858 | + if ($TXN_ID != $this->checkout->transaction->ID()) { |
|
1859 | 1859 | // Houston... we might have a problem |
1860 | 1860 | $invalid_TXN = false; |
1861 | 1861 | // first gather some info |
1862 | - $valid_TXN = EEM_Transaction::instance()->get_one_by_ID( $TXN_ID ); |
|
1862 | + $valid_TXN = EEM_Transaction::instance()->get_one_by_ID($TXN_ID); |
|
1863 | 1863 | $primary_registrant = $valid_TXN instanceof EE_Transaction ? $valid_TXN->primary_registration() : null; |
1864 | 1864 | // let's start by retrieving the cart for this TXN |
1865 | - $cart = EE_Cart::get_cart_from_txn( $this->checkout->transaction ); |
|
1866 | - if ( $cart instanceof EE_Cart ) { |
|
1865 | + $cart = EE_Cart::get_cart_from_txn($this->checkout->transaction); |
|
1866 | + if ($cart instanceof EE_Cart) { |
|
1867 | 1867 | // verify that the current cart has tickets |
1868 | 1868 | $tickets = $cart->get_tickets(); |
1869 | - if ( empty( $tickets ) ) { |
|
1869 | + if (empty($tickets)) { |
|
1870 | 1870 | $invalid_TXN = true; |
1871 | 1871 | } |
1872 | 1872 | } else { |
@@ -1874,39 +1874,39 @@ discard block |
||
1874 | 1874 | } |
1875 | 1875 | $valid_TXN_SID = $primary_registrant instanceof EE_Registration ? $primary_registrant->session_ID() : null; |
1876 | 1876 | // validate current Session ID and compare against valid TXN session ID |
1877 | - if ( EE_Session::instance()->id() === null ) { |
|
1877 | + if (EE_Session::instance()->id() === null) { |
|
1878 | 1878 | $invalid_TXN = true; |
1879 | - } else if ( EE_Session::instance()->id() === $valid_TXN_SID ) { |
|
1879 | + } else if (EE_Session::instance()->id() === $valid_TXN_SID) { |
|
1880 | 1880 | // WARNING !!! |
1881 | 1881 | // this could be PayPal sending back duplicate requests (ya they do that) |
1882 | 1882 | // or it **could** mean someone is simply registering AGAIN after having just done so |
1883 | 1883 | // so now we need to determine if this current TXN looks valid or not |
1884 | 1884 | /** @type EE_Transaction_Processor $transaction_processor */ |
1885 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1885 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1886 | 1886 | // has this step even been started ? |
1887 | - if ( $transaction_processor->reg_step_completed( $this->checkout->transaction, $this->slug() === false ) |
|
1887 | + if ($transaction_processor->reg_step_completed($this->checkout->transaction, $this->slug() === false) |
|
1888 | 1888 | ) { |
1889 | 1889 | // really? you're half way through this reg step, but you never started it ? |
1890 | 1890 | $invalid_TXN = true; |
1891 | 1891 | } |
1892 | 1892 | } |
1893 | - if ( $invalid_TXN ) { |
|
1893 | + if ($invalid_TXN) { |
|
1894 | 1894 | // is the valid TXN completed ? |
1895 | - if ( $valid_TXN instanceof EE_Transaction ) { |
|
1895 | + if ($valid_TXN instanceof EE_Transaction) { |
|
1896 | 1896 | /** @type EE_Transaction_Processor $transaction_processor */ |
1897 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
1897 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
1898 | 1898 | // has this step even been started ? |
1899 | - $reg_step_completed = $transaction_processor->reg_step_completed( $valid_TXN, $this->slug() ); |
|
1900 | - if ( $reg_step_completed !== false && $reg_step_completed !== true ) { |
|
1899 | + $reg_step_completed = $transaction_processor->reg_step_completed($valid_TXN, $this->slug()); |
|
1900 | + if ($reg_step_completed !== false && $reg_step_completed !== true) { |
|
1901 | 1901 | // so it **looks** like this is a double request from PayPal |
1902 | 1902 | // so let's try to pick up where we left off |
1903 | 1903 | $this->checkout->transaction = $valid_TXN; |
1904 | - $this->checkout->refresh_all_entities( true ); |
|
1904 | + $this->checkout->refresh_all_entities(true); |
|
1905 | 1905 | return; |
1906 | 1906 | } |
1907 | 1907 | } |
1908 | 1908 | // you appear to be lost? |
1909 | - $this->_redirect_wayward_request( $primary_registrant ); |
|
1909 | + $this->_redirect_wayward_request($primary_registrant); |
|
1910 | 1910 | } |
1911 | 1911 | } |
1912 | 1912 | } |
@@ -1920,16 +1920,16 @@ discard block |
||
1920 | 1920 | * @param \EE_Registration $primary_registrant |
1921 | 1921 | * @return bool |
1922 | 1922 | */ |
1923 | - private function _redirect_wayward_request( EE_Registration $primary_registrant ) { |
|
1924 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1923 | + private function _redirect_wayward_request(EE_Registration $primary_registrant) { |
|
1924 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1925 | 1925 | // try redirecting based on the current TXN |
1926 | 1926 | $primary_registrant = $this->checkout->transaction instanceof EE_Transaction ? $this->checkout->transaction->primary_registration() : null; |
1927 | - if ( ! $primary_registrant instanceof EE_Registration ) { |
|
1927 | + if ( ! $primary_registrant instanceof EE_Registration) { |
|
1928 | 1928 | EE_Error::add_error( |
1929 | 1929 | sprintf( |
1930 | - __( 'Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso' ), |
|
1930 | + __('Invalid information was received from the Off-Site Payment Processor and your Transaction details could not be retrieved from the database.%1$sPlease try again or contact %2$s for assistance.', 'event_espresso'), |
|
1931 | 1931 | '<br/>', |
1932 | - EE_Registry::instance()->CFG->organization->get_pretty( 'email' ) |
|
1932 | + EE_Registry::instance()->CFG->organization->get_pretty('email') |
|
1933 | 1933 | ), |
1934 | 1934 | __FILE__, __FUNCTION__, __LINE__ |
1935 | 1935 | ); |
@@ -1957,16 +1957,16 @@ discard block |
||
1957 | 1957 | * @param \EE_Offsite_Gateway $gateway |
1958 | 1958 | * @return \EE_Payment |
1959 | 1959 | */ |
1960 | - private function _process_off_site_payment( EE_Offsite_Gateway $gateway ) { |
|
1960 | + private function _process_off_site_payment(EE_Offsite_Gateway $gateway) { |
|
1961 | 1961 | try { |
1962 | 1962 | // if gateway uses_separate_IPN_request, then we don't have to process the IPN manually |
1963 | - if ( $gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request() ) { |
|
1963 | + if ($gateway instanceof EE_Offsite_Gateway && $gateway->uses_separate_IPN_request()) { |
|
1964 | 1964 | $payment = $this->checkout->transaction->last_payment(); |
1965 | 1965 | //$payment_source = 'last_payment'; |
1966 | 1966 | } else { |
1967 | 1967 | // get payment details and process results |
1968 | 1968 | /** @type EE_Payment_Processor $payment_processor */ |
1969 | - $payment_processor = EE_Registry::instance()->load_core( 'Payment_Processor' ); |
|
1969 | + $payment_processor = EE_Registry::instance()->load_core('Payment_Processor'); |
|
1970 | 1970 | $payment = $payment_processor->process_ipn( |
1971 | 1971 | $_REQUEST, |
1972 | 1972 | $this->checkout->transaction, |
@@ -1976,14 +1976,14 @@ discard block |
||
1976 | 1976 | ); |
1977 | 1977 | //$payment_source = 'process_ipn'; |
1978 | 1978 | } |
1979 | - } catch ( Exception $e ) { |
|
1979 | + } catch (Exception $e) { |
|
1980 | 1980 | // let's just eat the exception and try to move on using any previously set payment info |
1981 | 1981 | $payment = $this->checkout->transaction->last_payment(); |
1982 | 1982 | //$payment_source = 'last_payment after Exception'; |
1983 | 1983 | // but if we STILL don't have a payment object |
1984 | - if ( ! $payment instanceof EE_Payment ) { |
|
1984 | + if ( ! $payment instanceof EE_Payment) { |
|
1985 | 1985 | // then we'll object ! ( not object like a thing... but object like what a lawyer says ! ) |
1986 | - $this->_handle_payment_processor_exception( $e ); |
|
1986 | + $this->_handle_payment_processor_exception($e); |
|
1987 | 1987 | } |
1988 | 1988 | } |
1989 | 1989 | // DEBUG LOG |
@@ -2007,13 +2007,13 @@ discard block |
||
2007 | 2007 | * @param EE_Payment $payment |
2008 | 2008 | * @return EE_Payment | FALSE |
2009 | 2009 | */ |
2010 | - private function _process_cancelled_payments( $payment = NULL ) { |
|
2010 | + private function _process_cancelled_payments($payment = NULL) { |
|
2011 | 2011 | if ( |
2012 | - isset( $_REQUEST[ 'ee_cancel_payment' ] ) |
|
2012 | + isset($_REQUEST['ee_cancel_payment']) |
|
2013 | 2013 | && $payment instanceof EE_Payment |
2014 | 2014 | && $payment->status() == EEM_Payment::status_id_failed |
2015 | 2015 | ) { |
2016 | - $payment->set_status( EEM_Payment::status_id_cancelled ); |
|
2016 | + $payment->set_status(EEM_Payment::status_id_cancelled); |
|
2017 | 2017 | } |
2018 | 2018 | return $payment; |
2019 | 2019 | } |
@@ -2030,23 +2030,23 @@ discard block |
||
2030 | 2030 | public function get_transaction_details_for_gateways() { |
2031 | 2031 | $txn_details = array(); |
2032 | 2032 | // ya gotta make a choice man |
2033 | - if ( empty( $this->checkout->selected_method_of_payment ) ) { |
|
2033 | + if (empty($this->checkout->selected_method_of_payment)) { |
|
2034 | 2034 | $txn_details = array( |
2035 | - 'error' => __( 'Please select a method of payment before proceeding.', 'event_espresso' ) |
|
2035 | + 'error' => __('Please select a method of payment before proceeding.', 'event_espresso') |
|
2036 | 2036 | ); |
2037 | 2037 | } |
2038 | 2038 | // get EE_Payment_Method object |
2039 | 2039 | if ( |
2040 | - empty( $txn_details ) && |
|
2040 | + empty($txn_details) && |
|
2041 | 2041 | ! $this->checkout->payment_method = $this->_get_payment_method_for_selected_method_of_payment() |
2042 | 2042 | ) { |
2043 | 2043 | $txn_details = array( |
2044 | 2044 | 'selected_method_of_payment' => $this->checkout->selected_method_of_payment, |
2045 | - 'error' => __( 'A valid Payment Method could not be determined.', 'event_espresso' ) |
|
2045 | + 'error' => __('A valid Payment Method could not be determined.', 'event_espresso') |
|
2046 | 2046 | ); |
2047 | 2047 | } |
2048 | - if ( empty( $txn_details ) && $this->checkout->transaction instanceof EE_Transaction ) { |
|
2049 | - $return_url = $this->_get_return_url( $this->checkout->payment_method ); |
|
2048 | + if (empty($txn_details) && $this->checkout->transaction instanceof EE_Transaction) { |
|
2049 | + $return_url = $this->_get_return_url($this->checkout->payment_method); |
|
2050 | 2050 | $txn_details = array( |
2051 | 2051 | 'TXN_ID' => $this->checkout->transaction->ID(), |
2052 | 2052 | 'TXN_timestamp' => $this->checkout->transaction->datetime(), |
@@ -2057,7 +2057,7 @@ discard block |
||
2057 | 2057 | 'PMD_ID' => $this->checkout->transaction->payment_method_ID(), |
2058 | 2058 | 'payment_amount' => $this->checkout->amount_owing, |
2059 | 2059 | 'return_url' => $return_url, |
2060 | - 'cancel_url' => add_query_arg( array( 'ee_cancel_payment' => true ), $return_url ), |
|
2060 | + 'cancel_url' => add_query_arg(array('ee_cancel_payment' => true), $return_url), |
|
2061 | 2061 | 'notify_url' => EE_Config::instance()->core->txn_page_url( |
2062 | 2062 | array( |
2063 | 2063 | 'e_reg_url_link' => $this->checkout->transaction->primary_registration()->reg_url_link(), |
@@ -2066,7 +2066,7 @@ discard block |
||
2066 | 2066 | ) |
2067 | 2067 | ); |
2068 | 2068 | } |
2069 | - echo json_encode( $txn_details ); |
|
2069 | + echo json_encode($txn_details); |
|
2070 | 2070 | exit(); |
2071 | 2071 | } |
2072 | 2072 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | /** |
6 | 6 | * Class EED_Ticket_Sales_Monitor |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | class EED_Ticket_Sales_Monitor extends EED_Module { |
19 | 19 | |
20 | - const debug = false; // true false |
|
20 | + const debug = false; // true false |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * an array of raw ticket data from EED_Ticket_Selector |
@@ -59,13 +59,13 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public static function set_hooks() { |
61 | 61 | // check ticket reserves AFTER MER does it's check (hence priority 20) |
62 | - add_filter( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', |
|
63 | - array( 'EED_Ticket_Sales_Monitor', 'validate_ticket_sale' ), |
|
62 | + add_filter('FHEE__EE_Ticket_Selector___add_ticket_to_cart__ticket_qty', |
|
63 | + array('EED_Ticket_Sales_Monitor', 'validate_ticket_sale'), |
|
64 | 64 | 20, 3 |
65 | 65 | ); |
66 | 66 | // add notices for sold out tickets |
67 | - add_action( 'AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', |
|
68 | - array( 'EED_Ticket_Sales_Monitor', 'post_notices' ), |
|
67 | + add_action('AHEE__EE_Ticket_Selector__process_ticket_selections__after_tickets_added_to_cart', |
|
68 | + array('EED_Ticket_Sales_Monitor', 'post_notices'), |
|
69 | 69 | 10 |
70 | 70 | ); |
71 | 71 | // handle ticket quantities adjusted in cart |
@@ -77,40 +77,40 @@ discard block |
||
77 | 77 | // handle tickets deleted from cart |
78 | 78 | add_action( |
79 | 79 | 'FHEE__EED_Multi_Event_Registration__delete_ticket__ticket_removed_from_cart', |
80 | - array( 'EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart' ), |
|
80 | + array('EED_Ticket_Sales_Monitor', 'ticket_removed_from_cart'), |
|
81 | 81 | 10, 2 |
82 | 82 | ); |
83 | 83 | // handle emptied carts |
84 | 84 | add_action( |
85 | 85 | 'AHEE__EE_Session__reset_cart__before_reset', |
86 | - array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ), |
|
86 | + array('EED_Ticket_Sales_Monitor', 'session_cart_reset'), |
|
87 | 87 | 10, 1 |
88 | 88 | ); |
89 | 89 | add_action( |
90 | 90 | 'AHEE__EED_Multi_Event_Registration__empty_event_cart__before_delete_cart', |
91 | - array( 'EED_Ticket_Sales_Monitor', 'session_cart_reset' ), |
|
91 | + array('EED_Ticket_Sales_Monitor', 'session_cart_reset'), |
|
92 | 92 | 10, 1 |
93 | 93 | ); |
94 | 94 | // handle cancelled registrations |
95 | 95 | add_action( |
96 | 96 | 'AHEE__EE_Session__reset_checkout__before_reset', |
97 | - array( 'EED_Ticket_Sales_Monitor', 'session_checkout_reset' ), |
|
97 | + array('EED_Ticket_Sales_Monitor', 'session_checkout_reset'), |
|
98 | 98 | 10, 1 |
99 | 99 | ); |
100 | 100 | // cron tasks |
101 | 101 | add_action( |
102 | 102 | 'AHEE__EE_Cron_Tasks__finalize_abandoned_transactions__abandoned_transaction', |
103 | - array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ), |
|
103 | + array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'), |
|
104 | 104 | 10, 1 |
105 | 105 | ); |
106 | 106 | add_action( |
107 | 107 | 'AHEE__EE_Cron_Tasks__process_expired_transactions__incomplete_transaction', |
108 | - array( 'EED_Ticket_Sales_Monitor', 'process_abandoned_transactions' ), |
|
108 | + array('EED_Ticket_Sales_Monitor', 'process_abandoned_transactions'), |
|
109 | 109 | 10, 1 |
110 | 110 | ); |
111 | 111 | add_action( |
112 | 112 | 'AHEE__EE_Cron_Tasks__process_expired_transactions__failed_transaction', |
113 | - array( 'EED_Ticket_Sales_Monitor', 'process_failed_transactions' ), |
|
113 | + array('EED_Ticket_Sales_Monitor', 'process_failed_transactions'), |
|
114 | 114 | 10, 1 |
115 | 115 | ); |
116 | 116 | |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @return EED_Ticket_Sales_Monitor |
135 | 135 | */ |
136 | 136 | public static function instance() { |
137 | - return parent::get_instance( __CLASS__ ); |
|
137 | + return parent::get_instance(__CLASS__); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param WP_Query $WP_Query |
147 | 147 | * @return void |
148 | 148 | */ |
149 | - public function run( $WP_Query ) { |
|
149 | + public function run($WP_Query) { |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | * @param \EE_Ticket $ticket |
165 | 165 | * @return bool |
166 | 166 | */ |
167 | - public static function validate_ticket_sale( $qty = 1, EE_Ticket $ticket ) { |
|
168 | - $qty = absint( $qty ); |
|
169 | - if ( $qty > 0 ) { |
|
170 | - $qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale( $ticket, $qty ); |
|
167 | + public static function validate_ticket_sale($qty = 1, EE_Ticket $ticket) { |
|
168 | + $qty = absint($qty); |
|
169 | + if ($qty > 0) { |
|
170 | + $qty = EED_Ticket_Sales_Monitor::instance()->_validate_ticket_sale($ticket, $qty); |
|
171 | 171 | } |
172 | - if ( self::debug ) { |
|
173 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
174 | - echo "\n qty: " . $qty; |
|
172 | + if (self::debug) { |
|
173 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
174 | + echo "\n qty: ".$qty; |
|
175 | 175 | } |
176 | 176 | return $qty; |
177 | 177 | } |
@@ -187,45 +187,45 @@ discard block |
||
187 | 187 | * @param int $qty |
188 | 188 | * @return int |
189 | 189 | */ |
190 | - protected function _validate_ticket_sale( EE_Ticket $ticket, $qty = 1 ) { |
|
191 | - if ( self::debug ) { |
|
192 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
190 | + protected function _validate_ticket_sale(EE_Ticket $ticket, $qty = 1) { |
|
191 | + if (self::debug) { |
|
192 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
193 | 193 | } |
194 | - if ( ! $ticket instanceof EE_Ticket ) { |
|
194 | + if ( ! $ticket instanceof EE_Ticket) { |
|
195 | 195 | return 0; |
196 | 196 | } |
197 | - if ( self::debug ) { |
|
198 | - echo "\n . ticket->ID: " . $ticket->ID() . '<br />'; |
|
199 | - echo "\n . original ticket->reserved: " . $ticket->reserved() . '<br />'; |
|
197 | + if (self::debug) { |
|
198 | + echo "\n . ticket->ID: ".$ticket->ID().'<br />'; |
|
199 | + echo "\n . original ticket->reserved: ".$ticket->reserved().'<br />'; |
|
200 | 200 | } |
201 | 201 | $ticket->refresh_from_db(); |
202 | 202 | // first let's determine the ticket availability based on sales |
203 | - $available = $ticket->qty( 'saleable' ); |
|
204 | - if ( self::debug ) { |
|
205 | - echo "\n . . . ticket->qty: " . $ticket->qty() . '<br />'; |
|
206 | - echo "\n . . . ticket->sold: " . $ticket->sold() . '<br />'; |
|
207 | - echo "\n . . . ticket->reserved: " . $ticket->reserved() . '<br />'; |
|
208 | - echo "\n . . . ticket->qty(saleable): " . $ticket->qty( 'saleable' ) . '<br />'; |
|
209 | - echo "\n . . . available: " . $available . '<br />'; |
|
210 | - } |
|
211 | - if ( $available < 1 ) { |
|
212 | - $this->_ticket_sold_out( $ticket ); |
|
203 | + $available = $ticket->qty('saleable'); |
|
204 | + if (self::debug) { |
|
205 | + echo "\n . . . ticket->qty: ".$ticket->qty().'<br />'; |
|
206 | + echo "\n . . . ticket->sold: ".$ticket->sold().'<br />'; |
|
207 | + echo "\n . . . ticket->reserved: ".$ticket->reserved().'<br />'; |
|
208 | + echo "\n . . . ticket->qty(saleable): ".$ticket->qty('saleable').'<br />'; |
|
209 | + echo "\n . . . available: ".$available.'<br />'; |
|
210 | + } |
|
211 | + if ($available < 1) { |
|
212 | + $this->_ticket_sold_out($ticket); |
|
213 | 213 | return 0; |
214 | 214 | } |
215 | - if ( self::debug ) { |
|
216 | - echo "\n . . . qty: " . $qty . '<br />'; |
|
215 | + if (self::debug) { |
|
216 | + echo "\n . . . qty: ".$qty.'<br />'; |
|
217 | 217 | } |
218 | - if ( $available < $qty ) { |
|
218 | + if ($available < $qty) { |
|
219 | 219 | $qty = $available; |
220 | - if ( self::debug ) { |
|
221 | - echo "\n . . . QTY ADJUSTED: " . $qty . '<br />'; |
|
220 | + if (self::debug) { |
|
221 | + echo "\n . . . QTY ADJUSTED: ".$qty.'<br />'; |
|
222 | 222 | } |
223 | - $this->_ticket_quantity_decremented( $ticket ); |
|
223 | + $this->_ticket_quantity_decremented($ticket); |
|
224 | 224 | } |
225 | - if ( self::debug ) { |
|
226 | - echo "\n\n . . . INCREASE RESERVED: " . $qty . '<br/><br/>'; |
|
225 | + if (self::debug) { |
|
226 | + echo "\n\n . . . INCREASE RESERVED: ".$qty.'<br/><br/>'; |
|
227 | 227 | } |
228 | - $this->_reserve_ticket( $ticket, $qty ); |
|
228 | + $this->_reserve_ticket($ticket, $qty); |
|
229 | 229 | return $qty; |
230 | 230 | } |
231 | 231 | |
@@ -241,11 +241,11 @@ discard block |
||
241 | 241 | * @return bool |
242 | 242 | * @throws \EE_Error |
243 | 243 | */ |
244 | - protected function _reserve_ticket( EE_Ticket $ticket, $quantity = 1 ) { |
|
245 | - if ( self::debug ) { |
|
246 | - echo "\n\n . . . INCREASE RESERVED: " . $quantity . '<br/><br/>'; |
|
244 | + protected function _reserve_ticket(EE_Ticket $ticket, $quantity = 1) { |
|
245 | + if (self::debug) { |
|
246 | + echo "\n\n . . . INCREASE RESERVED: ".$quantity.'<br/><br/>'; |
|
247 | 247 | } |
248 | - $ticket->increase_reserved( $quantity ); |
|
248 | + $ticket->increase_reserved($quantity); |
|
249 | 249 | return $ticket->save(); |
250 | 250 | } |
251 | 251 | |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | * @return bool |
261 | 261 | * @throws \EE_Error |
262 | 262 | */ |
263 | - protected function _release_reserved_ticket( EE_Ticket $ticket, $quantity = 1 ) { |
|
264 | - if ( self::debug ) { |
|
265 | - echo "\n . . . ticket->ID: " . $ticket->ID() . '<br />'; |
|
266 | - echo "\n . . . ticket->reserved: " . $ticket->reserved() . '<br />'; |
|
263 | + protected function _release_reserved_ticket(EE_Ticket $ticket, $quantity = 1) { |
|
264 | + if (self::debug) { |
|
265 | + echo "\n . . . ticket->ID: ".$ticket->ID().'<br />'; |
|
266 | + echo "\n . . . ticket->reserved: ".$ticket->reserved().'<br />'; |
|
267 | 267 | } |
268 | - $ticket->decrease_reserved( $quantity ); |
|
269 | - if ( self::debug ) { |
|
270 | - echo "\n . . . ticket->reserved: " . $ticket->reserved() . '<br />'; |
|
268 | + $ticket->decrease_reserved($quantity); |
|
269 | + if (self::debug) { |
|
270 | + echo "\n . . . ticket->reserved: ".$ticket->reserved().'<br />'; |
|
271 | 271 | } |
272 | 272 | return $ticket->save() ? 1 : 0; |
273 | 273 | } |
@@ -283,12 +283,12 @@ discard block |
||
283 | 283 | * @return bool |
284 | 284 | * @throws \EE_Error |
285 | 285 | */ |
286 | - protected function _ticket_sold_out( EE_Ticket $ticket ) { |
|
287 | - if ( self::debug ) { |
|
288 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
289 | - echo "\n . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket ) . '<br />'; |
|
286 | + protected function _ticket_sold_out(EE_Ticket $ticket) { |
|
287 | + if (self::debug) { |
|
288 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
289 | + echo "\n . . ticket->name: ".$this->_get_ticket_and_event_name($ticket).'<br />'; |
|
290 | 290 | } |
291 | - $this->sold_out_tickets[] = $this->_get_ticket_and_event_name( $ticket ); |
|
291 | + $this->sold_out_tickets[] = $this->_get_ticket_and_event_name($ticket); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | * @param \EE_Ticket $ticket |
302 | 302 | * @return bool |
303 | 303 | */ |
304 | - protected function _ticket_quantity_decremented( EE_Ticket $ticket ) { |
|
305 | - if ( self::debug ) { |
|
306 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
307 | - echo "\n . . ticket->name: " . $this->_get_ticket_and_event_name( $ticket ) . '<br />'; |
|
304 | + protected function _ticket_quantity_decremented(EE_Ticket $ticket) { |
|
305 | + if (self::debug) { |
|
306 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
307 | + echo "\n . . ticket->name: ".$this->_get_ticket_and_event_name($ticket).'<br />'; |
|
308 | 308 | } |
309 | - $this->decremented_tickets[] = $this->_get_ticket_and_event_name( $ticket ); |
|
309 | + $this->decremented_tickets[] = $this->_get_ticket_and_event_name($ticket); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | |
@@ -319,11 +319,11 @@ discard block |
||
319 | 319 | * @param \EE_Ticket $ticket |
320 | 320 | * @return string |
321 | 321 | */ |
322 | - protected function _get_ticket_and_event_name( EE_Ticket $ticket ) { |
|
322 | + protected function _get_ticket_and_event_name(EE_Ticket $ticket) { |
|
323 | 323 | $event = $ticket->get_related_event(); |
324 | - if ( $event instanceof EE_Event ) { |
|
324 | + if ($event instanceof EE_Event) { |
|
325 | 325 | $ticket_name = sprintf( |
326 | - _x( '%1$s for %2$s', 'ticket name for event name', 'event_espresso' ), |
|
326 | + _x('%1$s for %2$s', 'ticket name for event name', 'event_espresso'), |
|
327 | 327 | $ticket->name(), |
328 | 328 | $event->name() |
329 | 329 | ); |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | * @param int $quantity |
349 | 349 | * @return void |
350 | 350 | */ |
351 | - public static function ticket_quantity_updated( EE_Line_Item $line_item, $quantity = 1 ) { |
|
352 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( absint( $line_item->OBJ_ID() ) ); |
|
353 | - if ( $ticket instanceof EE_Ticket ) { |
|
354 | - if ( $quantity > 0 ) { |
|
355 | - EED_Ticket_Sales_Monitor::instance()->_reserve_ticket( $ticket, $quantity ); |
|
351 | + public static function ticket_quantity_updated(EE_Line_Item $line_item, $quantity = 1) { |
|
352 | + $ticket = EEM_Ticket::instance()->get_one_by_ID(absint($line_item->OBJ_ID())); |
|
353 | + if ($ticket instanceof EE_Ticket) { |
|
354 | + if ($quantity > 0) { |
|
355 | + EED_Ticket_Sales_Monitor::instance()->_reserve_ticket($ticket, $quantity); |
|
356 | 356 | } else { |
357 | - EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity ); |
|
357 | + EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity); |
|
358 | 358 | } |
359 | 359 | } |
360 | 360 | } |
@@ -370,8 +370,8 @@ discard block |
||
370 | 370 | * @param int $quantity |
371 | 371 | * @return void |
372 | 372 | */ |
373 | - public static function ticket_removed_from_cart( EE_Ticket $ticket, $quantity = 1 ) { |
|
374 | - EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket( $ticket, $quantity ); |
|
373 | + public static function ticket_removed_from_cart(EE_Ticket $ticket, $quantity = 1) { |
|
374 | + EED_Ticket_Sales_Monitor::instance()->_release_reserved_ticket($ticket, $quantity); |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | |
@@ -399,34 +399,34 @@ discard block |
||
399 | 399 | * @return void |
400 | 400 | */ |
401 | 401 | protected function _post_notices() { |
402 | - if ( self::debug ) { |
|
403 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
402 | + if (self::debug) { |
|
403 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
404 | 404 | } |
405 | - if ( ! empty( $this->sold_out_tickets ) ) { |
|
405 | + if ( ! empty($this->sold_out_tickets)) { |
|
406 | 406 | EE_Error::add_attention( |
407 | 407 | sprintf( |
408 | 408 | apply_filters( |
409 | 409 | 'FHEE__EED_Ticket_Sales_Monitor___post_notices__sold_out_tickets_notice', |
410 | - __( 'We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.', 'event_espresso' ) |
|
410 | + __('We\'re sorry...%1$sThe following items have sold out since you first viewed this page, and can no longer be registered for:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.', 'event_espresso') |
|
411 | 411 | ), |
412 | 412 | '<br />', |
413 | - implode( '<br />', $this->sold_out_tickets ) |
|
413 | + implode('<br />', $this->sold_out_tickets) |
|
414 | 414 | ) |
415 | 415 | ); |
416 | 416 | // alter code flow in the Ticket Selector for better UX |
417 | - add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true' ); |
|
418 | - add_filter( 'FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false' ); |
|
417 | + add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__tckts_slctd', '__return_true'); |
|
418 | + add_filter('FHEE__EED_Ticket_Selector__process_ticket_selections__success', '__return_false'); |
|
419 | 419 | $this->sold_out_tickets = array(); |
420 | 420 | } |
421 | - if ( ! empty( $this->decremented_tickets ) ) { |
|
421 | + if ( ! empty($this->decremented_tickets)) { |
|
422 | 422 | EE_Error::add_attention( |
423 | 423 | sprintf( |
424 | 424 | apply_filters( |
425 | 425 | 'FHEE__EED_Ticket_Sales_Monitor___ticket_quantity_decremented__notice', |
426 | - __( 'We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.', 'event_espresso' ) |
|
426 | + __('We\'re sorry...%1$sDue to sales that have occurred since you first viewed the last page, the following items have had their quantities adjusted to match the current available amount:%1$s%1$s%2$s%1$s%1$sPlease note that availability can change at any time due to cancellations, so please check back again later if registration for this event(s) is important to you.', 'event_espresso') |
|
427 | 427 | ), |
428 | 428 | '<br />', |
429 | - implode( '<br />', $this->decremented_tickets ) |
|
429 | + implode('<br />', $this->decremented_tickets) |
|
430 | 430 | ) |
431 | 431 | ); |
432 | 432 | $this->decremented_tickets = array(); |
@@ -448,27 +448,27 @@ discard block |
||
448 | 448 | * @param EE_Transaction $transaction |
449 | 449 | * @return int |
450 | 450 | */ |
451 | - protected function _release_all_reserved_tickets_for_transaction( EE_Transaction $transaction ) { |
|
452 | - if ( self::debug ) { |
|
453 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
454 | - echo "\n . transaction->ID: " . $transaction->ID() . '<br />'; |
|
451 | + protected function _release_all_reserved_tickets_for_transaction(EE_Transaction $transaction) { |
|
452 | + if (self::debug) { |
|
453 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
454 | + echo "\n . transaction->ID: ".$transaction->ID().'<br />'; |
|
455 | 455 | } |
456 | 456 | /** @type EE_Transaction_Processor $transaction_processor */ |
457 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
457 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
458 | 458 | // check if 'finalize_registration' step has been completed... |
459 | - $finalized = $transaction_processor->reg_step_completed( $transaction, 'finalize_registration' ); |
|
460 | - if ( self::debug ) { |
|
459 | + $finalized = $transaction_processor->reg_step_completed($transaction, 'finalize_registration'); |
|
460 | + if (self::debug) { |
|
461 | 461 | // DEBUG LOG |
462 | 462 | EEH_Debug_Tools::log( |
463 | 463 | __CLASS__, __FUNCTION__, __LINE__, |
464 | - array( 'finalized' => $finalized ), |
|
465 | - false, 'EE_Transaction: ' . $transaction->ID() |
|
464 | + array('finalized' => $finalized), |
|
465 | + false, 'EE_Transaction: '.$transaction->ID() |
|
466 | 466 | ); |
467 | 467 | } |
468 | 468 | // how many tickets were released |
469 | 469 | $count = 0; |
470 | - if ( self::debug ) { |
|
471 | - echo "\n . . . finalized: " . $finalized . '<br />'; |
|
470 | + if (self::debug) { |
|
471 | + echo "\n . . . finalized: ".$finalized.'<br />'; |
|
472 | 472 | } |
473 | 473 | $release_tickets_with_TXN_status = array( |
474 | 474 | EEM_Transaction::failed_status_code, |
@@ -476,13 +476,13 @@ discard block |
||
476 | 476 | EEM_Transaction::incomplete_status_code, |
477 | 477 | ); |
478 | 478 | // if the session is getting cleared BEFORE the TXN has been finalized |
479 | - if ( ! $finalized || in_array( $transaction->status_ID(), $release_tickets_with_TXN_status ) ) { |
|
479 | + if ( ! $finalized || in_array($transaction->status_ID(), $release_tickets_with_TXN_status)) { |
|
480 | 480 | // let's cancel any reserved tickets |
481 | 481 | $registrations = $transaction->registrations(); |
482 | - if ( ! empty( $registrations ) ) { |
|
483 | - foreach ( $registrations as $registration ) { |
|
484 | - if ( $registration instanceof EE_Registration ) { |
|
485 | - $count += $this->_release_reserved_ticket_for_registration( $registration, $transaction ); |
|
482 | + if ( ! empty($registrations)) { |
|
483 | + foreach ($registrations as $registration) { |
|
484 | + if ($registration instanceof EE_Registration) { |
|
485 | + $count += $this->_release_reserved_ticket_for_registration($registration, $transaction); |
|
486 | 486 | } |
487 | 487 | } |
488 | 488 | } |
@@ -503,12 +503,12 @@ discard block |
||
503 | 503 | * @return int |
504 | 504 | * @throws \EE_Error |
505 | 505 | */ |
506 | - protected function _release_reserved_ticket_for_registration( EE_Registration $registration, EE_Transaction $transaction ) { |
|
507 | - if ( self::debug ) { |
|
508 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
509 | - echo "\n . . registration->ID: " . $registration->ID() . '<br />'; |
|
510 | - echo "\n . . registration->status_ID: " . $registration->status_ID() . '<br />'; |
|
511 | - echo "\n . . transaction->status_ID(): " . $transaction->status_ID() . '<br />'; |
|
506 | + protected function _release_reserved_ticket_for_registration(EE_Registration $registration, EE_Transaction $transaction) { |
|
507 | + if (self::debug) { |
|
508 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
509 | + echo "\n . . registration->ID: ".$registration->ID().'<br />'; |
|
510 | + echo "\n . . registration->status_ID: ".$registration->status_ID().'<br />'; |
|
511 | + echo "\n . . transaction->status_ID(): ".$transaction->status_ID().'<br />'; |
|
512 | 512 | } |
513 | 513 | if ( |
514 | 514 | // release Tickets for Failed Transactions and Abandoned Transactions |
@@ -521,8 +521,8 @@ discard block |
||
521 | 521 | ) |
522 | 522 | ) { |
523 | 523 | $ticket = $registration->ticket(); |
524 | - if ( $ticket instanceof EE_Ticket ) { |
|
525 | - return $this->_release_reserved_ticket( $ticket ); |
|
524 | + if ($ticket instanceof EE_Ticket) { |
|
525 | + return $this->_release_reserved_ticket($ticket); |
|
526 | 526 | } |
527 | 527 | } |
528 | 528 | return 0; |
@@ -542,20 +542,20 @@ discard block |
||
542 | 542 | * @param EE_Session $session |
543 | 543 | * @return void |
544 | 544 | */ |
545 | - public static function session_cart_reset( EE_Session $session ) { |
|
546 | - if ( self::debug ) { |
|
547 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
545 | + public static function session_cart_reset(EE_Session $session) { |
|
546 | + if (self::debug) { |
|
547 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
548 | 548 | } |
549 | 549 | $cart = $session->cart(); |
550 | - if ( $cart instanceof EE_Cart ) { |
|
551 | - if ( self::debug ) { |
|
552 | - echo "\n\n cart instanceof EE_Cart: " . "<br />"; |
|
550 | + if ($cart instanceof EE_Cart) { |
|
551 | + if (self::debug) { |
|
552 | + echo "\n\n cart instanceof EE_Cart: "."<br />"; |
|
553 | 553 | } |
554 | - EED_Ticket_Sales_Monitor::instance()->_session_cart_reset( $cart ); |
|
554 | + EED_Ticket_Sales_Monitor::instance()->_session_cart_reset($cart); |
|
555 | 555 | } else { |
556 | - if ( self::debug ) { |
|
557 | - echo "\n\n invalid EE_Cart: " . "<br />"; |
|
558 | - var_dump( $cart ); |
|
556 | + if (self::debug) { |
|
557 | + echo "\n\n invalid EE_Cart: "."<br />"; |
|
558 | + var_dump($cart); |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | } |
@@ -570,30 +570,30 @@ discard block |
||
570 | 570 | * @param EE_Cart $cart |
571 | 571 | * @return void |
572 | 572 | */ |
573 | - protected function _session_cart_reset( EE_Cart $cart ) { |
|
574 | - if ( self::debug ) { |
|
575 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
573 | + protected function _session_cart_reset(EE_Cart $cart) { |
|
574 | + if (self::debug) { |
|
575 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
576 | 576 | } |
577 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
577 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
578 | 578 | $ticket_line_items = $cart->get_tickets(); |
579 | - if ( empty( $ticket_line_items ) ) { |
|
579 | + if (empty($ticket_line_items)) { |
|
580 | 580 | return; |
581 | 581 | } |
582 | - foreach ( $ticket_line_items as $ticket_line_item ) { |
|
583 | - if ( self::debug ) { |
|
584 | - echo "\n . ticket_line_item->ID(): " . $ticket_line_item->ID() . "<br />"; |
|
582 | + foreach ($ticket_line_items as $ticket_line_item) { |
|
583 | + if (self::debug) { |
|
584 | + echo "\n . ticket_line_item->ID(): ".$ticket_line_item->ID()."<br />"; |
|
585 | 585 | } |
586 | - if ( $ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket' ) { |
|
587 | - if ( self::debug ) { |
|
588 | - echo "\n . . ticket_line_item->OBJ_ID(): " . $ticket_line_item->OBJ_ID() . "<br />"; |
|
586 | + if ($ticket_line_item instanceof EE_Line_Item && $ticket_line_item->OBJ_type() == 'Ticket') { |
|
587 | + if (self::debug) { |
|
588 | + echo "\n . . ticket_line_item->OBJ_ID(): ".$ticket_line_item->OBJ_ID()."<br />"; |
|
589 | 589 | } |
590 | - $ticket = EEM_Ticket::instance()->get_one_by_ID( $ticket_line_item->OBJ_ID() ); |
|
591 | - if ( $ticket instanceof EE_Ticket ) { |
|
592 | - if ( self::debug ) { |
|
593 | - echo "\n . . ticket->ID(): " . $ticket->ID() . "<br />"; |
|
594 | - echo "\n . . ticket_line_item->quantity(): " . $ticket_line_item->quantity() . "<br />"; |
|
590 | + $ticket = EEM_Ticket::instance()->get_one_by_ID($ticket_line_item->OBJ_ID()); |
|
591 | + if ($ticket instanceof EE_Ticket) { |
|
592 | + if (self::debug) { |
|
593 | + echo "\n . . ticket->ID(): ".$ticket->ID()."<br />"; |
|
594 | + echo "\n . . ticket_line_item->quantity(): ".$ticket_line_item->quantity()."<br />"; |
|
595 | 595 | } |
596 | - $this->_release_reserved_ticket( $ticket, $ticket_line_item->quantity() ); |
|
596 | + $this->_release_reserved_ticket($ticket, $ticket_line_item->quantity()); |
|
597 | 597 | } |
598 | 598 | } |
599 | 599 | } |
@@ -613,10 +613,10 @@ discard block |
||
613 | 613 | * @param EE_Session $session |
614 | 614 | * @return void |
615 | 615 | */ |
616 | - public static function session_checkout_reset( EE_Session $session ) { |
|
616 | + public static function session_checkout_reset(EE_Session $session) { |
|
617 | 617 | $checkout = $session->checkout(); |
618 | - if ( $checkout instanceof EE_Checkout ) { |
|
619 | - EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset( $checkout ); |
|
618 | + if ($checkout instanceof EE_Checkout) { |
|
619 | + EED_Ticket_Sales_Monitor::instance()->_session_checkout_reset($checkout); |
|
620 | 620 | } |
621 | 621 | } |
622 | 622 | |
@@ -630,15 +630,15 @@ discard block |
||
630 | 630 | * @param EE_Checkout $checkout |
631 | 631 | * @return void |
632 | 632 | */ |
633 | - protected function _session_checkout_reset( EE_Checkout $checkout ) { |
|
634 | - if ( self::debug ) { |
|
635 | - echo "\n\n " . __LINE__ . ") " . __METHOD__ . "() <br />"; |
|
633 | + protected function _session_checkout_reset(EE_Checkout $checkout) { |
|
634 | + if (self::debug) { |
|
635 | + echo "\n\n ".__LINE__.") ".__METHOD__."() <br />"; |
|
636 | 636 | } |
637 | 637 | // we want to release the each registration's reserved tickets if the session was cleared, but not if this is a revisit |
638 | - if ( $checkout->revisit || ! $checkout->transaction instanceof EE_Transaction ) { |
|
638 | + if ($checkout->revisit || ! $checkout->transaction instanceof EE_Transaction) { |
|
639 | 639 | return; |
640 | 640 | } |
641 | - $this->_release_all_reserved_tickets_for_transaction( $checkout->transaction ); |
|
641 | + $this->_release_all_reserved_tickets_for_transaction($checkout->transaction); |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | * @param EE_Session $session |
655 | 655 | * @return void |
656 | 656 | */ |
657 | - public static function session_expired_reset( EE_Session $session ) { |
|
657 | + public static function session_expired_reset(EE_Session $session) { |
|
658 | 658 | |
659 | 659 | } |
660 | 660 | |
@@ -673,30 +673,30 @@ discard block |
||
673 | 673 | * @param EE_Transaction $transaction |
674 | 674 | * @return void |
675 | 675 | */ |
676 | - public static function process_abandoned_transactions( EE_Transaction $transaction ) { |
|
676 | + public static function process_abandoned_transactions(EE_Transaction $transaction) { |
|
677 | 677 | // is this TXN free or has any money been paid towards this TXN? If so, then leave it alone |
678 | - if ( $transaction->is_free() || $transaction->paid() > 0 ) { |
|
679 | - if ( self::debug ) { |
|
678 | + if ($transaction->is_free() || $transaction->paid() > 0) { |
|
679 | + if (self::debug) { |
|
680 | 680 | // DEBUG LOG |
681 | 681 | EEH_Debug_Tools::log( |
682 | 682 | __CLASS__, __FUNCTION__, __LINE__, |
683 | - array( $transaction ), |
|
684 | - false, 'EE_Transaction: ' . $transaction->ID() |
|
683 | + array($transaction), |
|
684 | + false, 'EE_Transaction: '.$transaction->ID() |
|
685 | 685 | ); |
686 | 686 | } |
687 | 687 | return; |
688 | 688 | } |
689 | 689 | // have their been any successful payments made ? |
690 | 690 | $payments = $transaction->payments(); |
691 | - foreach ( $payments as $payment ) { |
|
692 | - if ( $payment instanceof EE_Payment ) { |
|
693 | - if ( $payment->status() === EEM_Payment::status_id_approved ) { |
|
694 | - if ( self::debug ) { |
|
691 | + foreach ($payments as $payment) { |
|
692 | + if ($payment instanceof EE_Payment) { |
|
693 | + if ($payment->status() === EEM_Payment::status_id_approved) { |
|
694 | + if (self::debug) { |
|
695 | 695 | // DEBUG LOG |
696 | 696 | EEH_Debug_Tools::log( |
697 | 697 | __CLASS__, __FUNCTION__, __LINE__, |
698 | - array( $payment ), |
|
699 | - false, 'EE_Transaction: ' . $transaction->ID() |
|
698 | + array($payment), |
|
699 | + false, 'EE_Transaction: '.$transaction->ID() |
|
700 | 700 | ); |
701 | 701 | } |
702 | 702 | return; |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | } |
705 | 705 | } |
706 | 706 | // since you haven't even attempted to pay for your ticket... |
707 | - EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction ); |
|
707 | + EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | |
@@ -721,9 +721,9 @@ discard block |
||
721 | 721 | * @param EE_Transaction $transaction |
722 | 722 | * @return void |
723 | 723 | */ |
724 | - public static function process_failed_transactions( EE_Transaction $transaction ) { |
|
724 | + public static function process_failed_transactions(EE_Transaction $transaction) { |
|
725 | 725 | // since you haven't even attempted to pay for your ticket... |
726 | - EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction( $transaction ); |
|
726 | + EED_Ticket_Sales_Monitor::instance()->_release_all_reserved_tickets_for_transaction($transaction); |
|
727 | 727 | } |
728 | 728 | |
729 | 729 |