@@ -13,381 +13,381 @@  | 
                                                    ||
| 13 | 13 | class EE_Admin_Table_Line_Item_Display_Strategy implements EEI_Line_Item_Display  | 
                                                        
| 14 | 14 |  { | 
                                                        
| 15 | 15 | |
| 16 | - /**  | 
                                                        |
| 17 | - * whether to display the taxes row or not  | 
                                                        |
| 18 | - *  | 
                                                        |
| 19 | - * @type bool $_show_taxes  | 
                                                        |
| 20 | - */  | 
                                                        |
| 21 | - protected $_show_taxes = false;  | 
                                                        |
| 22 | -  | 
                                                        |
| 23 | - /**  | 
                                                        |
| 24 | - * html for any tax rows  | 
                                                        |
| 25 | - *  | 
                                                        |
| 26 | - * @type string $_show_taxes  | 
                                                        |
| 27 | - */  | 
                                                        |
| 28 | - protected $_taxes_html = '';  | 
                                                        |
| 29 | -  | 
                                                        |
| 30 | -  | 
                                                        |
| 31 | - /**  | 
                                                        |
| 32 | - * total amount including tax we can bill for at this time  | 
                                                        |
| 33 | - *  | 
                                                        |
| 34 | - * @type float $_grand_total  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | - protected $_grand_total = 0.00;  | 
                                                        |
| 37 | -  | 
                                                        |
| 38 | -  | 
                                                        |
| 39 | - /**  | 
                                                        |
| 40 | - * @return float  | 
                                                        |
| 41 | - */  | 
                                                        |
| 42 | - public function grand_total()  | 
                                                        |
| 43 | -    { | 
                                                        |
| 44 | - return $this->_grand_total;  | 
                                                        |
| 45 | - }  | 
                                                        |
| 46 | -  | 
                                                        |
| 47 | -  | 
                                                        |
| 48 | - /**  | 
                                                        |
| 49 | - * This is used to output a single  | 
                                                        |
| 50 | - *  | 
                                                        |
| 51 | - * @param EE_Line_Item $line_item  | 
                                                        |
| 52 | - * @param array $options  | 
                                                        |
| 53 | - * @return mixed  | 
                                                        |
| 54 | - * @throws EE_Error  | 
                                                        |
| 55 | - * @throws ReflectionException  | 
                                                        |
| 56 | - */  | 
                                                        |
| 57 | - public function display_line_item(EE_Line_Item $line_item, $options = [])  | 
                                                        |
| 58 | -    { | 
                                                        |
| 59 | - $html = '';  | 
                                                        |
| 60 | - // set some default options and merge with incoming  | 
                                                        |
| 61 | - $default_options = [  | 
                                                        |
| 62 | - 'odd' => true,  | 
                                                        |
| 63 | - 'use_table_wrapper' => true,  | 
                                                        |
| 64 | - 'table_css_class' => 'admin-primary-mbox-tbl',  | 
                                                        |
| 65 | - 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',  | 
                                                        |
| 66 | - 'total_tr_css_class' => 'admin-primary-mbox-total-tr',  | 
                                                        |
| 67 | - ];  | 
                                                        |
| 68 | - $options = array_merge($default_options, (array) $options);  | 
                                                        |
| 69 | -  | 
                                                        |
| 70 | -        switch ($line_item->type()) { | 
                                                        |
| 71 | - case EEM_Line_Item::type_line_item:  | 
                                                        |
| 72 | - // item row  | 
                                                        |
| 73 | - $html .= $this->_item_row($line_item, $options);  | 
                                                        |
| 74 | - break;  | 
                                                        |
| 75 | -  | 
                                                        |
| 76 | - case EEM_Line_Item::type_sub_line_item:  | 
                                                        |
| 77 | - // currently not showing sub-items  | 
                                                        |
| 78 | - // $html .= $this->_sub_item_row($line_item, $options);  | 
                                                        |
| 79 | - break;  | 
                                                        |
| 80 | -  | 
                                                        |
| 81 | - case EEM_Line_Item::type_sub_total:  | 
                                                        |
| 82 | -                if ($line_item->quantity() === 0) { | 
                                                        |
| 83 | - return $html;  | 
                                                        |
| 84 | - }  | 
                                                        |
| 85 | - // loop through children  | 
                                                        |
| 86 | - $child_line_items = $line_item->children();  | 
                                                        |
| 87 | - // loop through children  | 
                                                        |
| 88 | -                foreach ($child_line_items as $child_line_item) { | 
                                                        |
| 89 | - // recursively feed children back into this method  | 
                                                        |
| 90 | - $html .= $this->display_line_item($child_line_item, $options);  | 
                                                        |
| 91 | - }  | 
                                                        |
| 92 | - // currently not showing subtotal row  | 
                                                        |
| 93 | - // $html .= $this->_sub_total_row($line_item, $options);  | 
                                                        |
| 94 | - break;  | 
                                                        |
| 95 | -  | 
                                                        |
| 96 | - case EEM_Line_Item::type_tax:  | 
                                                        |
| 97 | -                if ($this->_show_taxes) { | 
                                                        |
| 98 | - $this->_taxes_html .= $this->_tax_row($line_item);  | 
                                                        |
| 99 | - }  | 
                                                        |
| 100 | - break;  | 
                                                        |
| 101 | -  | 
                                                        |
| 102 | - case EEM_Line_Item::type_tax_sub_total:  | 
                                                        |
| 103 | -                foreach ($line_item->children() as $child_line_item) { | 
                                                        |
| 104 | -                    if ($child_line_item->type() == EEM_Line_Item::type_tax) { | 
                                                        |
| 105 | - $this->display_line_item($child_line_item, $options);  | 
                                                        |
| 106 | - }  | 
                                                        |
| 107 | - }  | 
                                                        |
| 108 | - break;  | 
                                                        |
| 109 | -  | 
                                                        |
| 110 | - case EEM_Line_Item::type_total:  | 
                                                        |
| 111 | - // determine whether to display taxes or not  | 
                                                        |
| 112 | - $this->_show_taxes = $line_item->get_total_tax() > 0;  | 
                                                        |
| 113 | - // get all child line items  | 
                                                        |
| 114 | - $children = $line_item->children();  | 
                                                        |
| 115 | -  | 
                                                        |
| 116 | - // loop thru all non-tax child line items  | 
                                                        |
| 117 | -                foreach ($children as $child_line_item) { | 
                                                        |
| 118 | - $html .= $this->display_line_item($child_line_item, $options);  | 
                                                        |
| 119 | - }  | 
                                                        |
| 120 | -  | 
                                                        |
| 121 | - $html .= $this->_taxes_html;  | 
                                                        |
| 122 | - $html .= $this->_total_row($line_item);  | 
                                                        |
| 123 | -                if ($options['use_table_wrapper']) { | 
                                                        |
| 124 | - $html = $this->_table_header($options) . $html . $this->_table_footer();  | 
                                                        |
| 125 | - }  | 
                                                        |
| 126 | - break;  | 
                                                        |
| 127 | - }  | 
                                                        |
| 128 | -  | 
                                                        |
| 129 | - return $html;  | 
                                                        |
| 130 | - }  | 
                                                        |
| 131 | -  | 
                                                        |
| 132 | -  | 
                                                        |
| 133 | - /**  | 
                                                        |
| 134 | - * Table header for display.  | 
                                                        |
| 135 | - *  | 
                                                        |
| 136 | - * @param array $options array of options for the table.  | 
                                                        |
| 137 | - * @return string  | 
                                                        |
| 138 | - * @since 4.8  | 
                                                        |
| 139 | - */  | 
                                                        |
| 140 | - protected function _table_header(array $options)  | 
                                                        |
| 141 | -    { | 
                                                        |
| 142 | -        $html = EEH_HTML::table('', '', $options['table_css_class']); | 
                                                        |
| 143 | - $html .= EEH_HTML::thead();  | 
                                                        |
| 144 | - $html .= EEH_HTML::tr();  | 
                                                        |
| 145 | -        $html .= EEH_HTML::th(esc_html__('Name', 'event_espresso'), '', 'jst-left'); | 
                                                        |
| 146 | -        $html .= EEH_HTML::th(esc_html__('Type', 'event_espresso'), '', 'jst-left'); | 
                                                        |
| 147 | -        $html .= EEH_HTML::th(esc_html__('Amount', 'event_espresso'), '', 'jst-cntr'); | 
                                                        |
| 148 | -        $html .= EEH_HTML::th(esc_html__('Qty', 'event_espresso'), '', 'jst-cntr'); | 
                                                        |
| 149 | -        $html .= EEH_HTML::th(esc_html__('Line Total', 'event_espresso'), '', 'jst-cntr'); | 
                                                        |
| 150 | - $html .= EEH_HTML::tbody();  | 
                                                        |
| 151 | - return $html;  | 
                                                        |
| 152 | - }  | 
                                                        |
| 153 | -  | 
                                                        |
| 154 | -  | 
                                                        |
| 155 | - /**  | 
                                                        |
| 156 | - * Table footer for display  | 
                                                        |
| 157 | - *  | 
                                                        |
| 158 | - * @return string  | 
                                                        |
| 159 | - * @since 4.8  | 
                                                        |
| 160 | - */  | 
                                                        |
| 161 | - protected function _table_footer()  | 
                                                        |
| 162 | -    { | 
                                                        |
| 163 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex();  | 
                                                        |
| 164 | - }  | 
                                                        |
| 165 | -  | 
                                                        |
| 166 | -  | 
                                                        |
| 167 | - /**  | 
                                                        |
| 168 | - * _item_row  | 
                                                        |
| 169 | - *  | 
                                                        |
| 170 | - * @param EE_Line_Item $line_item  | 
                                                        |
| 171 | - * @param array $options  | 
                                                        |
| 172 | - * @return mixed  | 
                                                        |
| 173 | - * @throws EE_Error  | 
                                                        |
| 174 | - * @throws ReflectionException  | 
                                                        |
| 175 | - */  | 
                                                        |
| 176 | - protected function _item_row(EE_Line_Item $line_item, $options = [])  | 
                                                        |
| 177 | -    { | 
                                                        |
| 178 | - $line_item_related_object = $line_item->get_object();  | 
                                                        |
| 179 | - $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item  | 
                                                        |
| 180 | - ? $line_item->parent()->get_object()  | 
                                                        |
| 181 | - : null;  | 
                                                        |
| 182 | - // start of row  | 
                                                        |
| 183 | - $row_class = $options['odd'] ? 'item odd' : 'item';  | 
                                                        |
| 184 | -        $html      = EEH_HTML::tr('', '', $row_class); | 
                                                        |
| 185 | -  | 
                                                        |
| 186 | - // Name Column  | 
                                                        |
| 187 | - $name_link = $line_item_related_object instanceof EEI_Admin_Links  | 
                                                        |
| 188 | - ? $line_item_related_object->get_admin_details_link()  | 
                                                        |
| 189 | - : '';  | 
                                                        |
| 190 | -  | 
                                                        |
| 191 | - // related object scope.  | 
                                                        |
| 192 | - $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object  | 
                                                        |
| 193 | - ? $parent_line_item_related_object->name()  | 
                                                        |
| 194 | - : '';  | 
                                                        |
| 195 | - $parent_related_object_name = empty($parent_related_object_name)  | 
                                                        |
| 196 | - && $line_item->parent() instanceof EE_Line_Item  | 
                                                        |
| 197 | - ? $line_item->parent()->name()  | 
                                                        |
| 198 | - : $parent_related_object_name;  | 
                                                        |
| 199 | -  | 
                                                        |
| 200 | - $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links  | 
                                                        |
| 201 | - ? $parent_line_item_related_object->get_admin_details_link()  | 
                                                        |
| 202 | - : '';  | 
                                                        |
| 203 | -  | 
                                                        |
| 204 | - $name_html = $line_item_related_object instanceof EEI_Line_Item_Object  | 
                                                        |
| 205 | - ? $line_item_related_object->name()  | 
                                                        |
| 206 | - : $line_item->name();  | 
                                                        |
| 207 | -  | 
                                                        |
| 208 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;  | 
                                                        |
| 209 | - $name_html .= $line_item->is_taxable() ? ' *' : '';  | 
                                                        |
| 210 | -  | 
                                                        |
| 211 | - // maybe preface with icon?  | 
                                                        |
| 212 | - $name_html = $line_item_related_object instanceof EEI_Has_Icon  | 
                                                        |
| 213 | - ? $line_item_related_object->get_icon() . $name_html  | 
                                                        |
| 214 | - : $name_html;  | 
                                                        |
| 215 | -  | 
                                                        |
| 216 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';  | 
                                                        |
| 217 | -  | 
                                                        |
| 218 | - $name_html .= sprintf(  | 
                                                        |
| 219 | -            _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), | 
                                                        |
| 220 | - '<span class="ee-line-item-related-parent-object">',  | 
                                                        |
| 221 | - $line_item->parent() instanceof EE_Line_Item  | 
                                                        |
| 222 | - ? $line_item->parent()->OBJ_type_i18n()  | 
                                                        |
| 223 | -                : esc_html__('Item:', 'event_espresso'), | 
                                                        |
| 224 | - $parent_related_object_link  | 
                                                        |
| 225 | - ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>'  | 
                                                        |
| 226 | - : $parent_related_object_name,  | 
                                                        |
| 227 | - '</span>'  | 
                                                        |
| 228 | - );  | 
                                                        |
| 229 | -  | 
                                                        |
| 230 | - $name_html = apply_filters(  | 
                                                        |
| 231 | - 'FHEE__EE_Admin_Table_Line_Item_Display_Strategy___item_row__name_html',  | 
                                                        |
| 232 | - $name_html,  | 
                                                        |
| 233 | - $line_item,  | 
                                                        |
| 234 | - $options  | 
                                                        |
| 235 | - );  | 
                                                        |
| 236 | -  | 
                                                        |
| 237 | - $html .= EEH_HTML::td($name_html, '', 'jst-left');  | 
                                                        |
| 238 | -  | 
                                                        |
| 239 | - // Type Column  | 
                                                        |
| 240 | - $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : '';  | 
                                                        |
| 241 | - $type_html .= $this->_get_cancellations($line_item);  | 
                                                        |
| 242 | - $type_html .= $line_item->OBJ_type() ? '<br />' : '';  | 
                                                        |
| 243 | - $code = $line_item_related_object instanceof EEI_Has_Code  | 
                                                        |
| 244 | - ? $line_item_related_object->code()  | 
                                                        |
| 245 | - : '';  | 
                                                        |
| 246 | - $type_html .= ! empty($code)  | 
                                                        |
| 247 | -            ? '<span class="ee-line-item-id">' . sprintf(esc_html__('Code: %s', 'event_espresso'), $code) . '</span>' | 
                                                        |
| 248 | - : '';  | 
                                                        |
| 249 | - $html .= EEH_HTML::td($type_html, '', 'jst-left');  | 
                                                        |
| 250 | -  | 
                                                        |
| 251 | - // Amount Column  | 
                                                        |
| 252 | - $html .= $line_item->is_percent()  | 
                                                        |
| 253 | - ? EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght')  | 
                                                        |
| 254 | - : EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');  | 
                                                        |
| 255 | -  | 
                                                        |
| 256 | - // QTY column  | 
                                                        |
| 257 | - $html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');  | 
                                                        |
| 258 | -  | 
                                                        |
| 259 | - // total column  | 
                                                        |
| 260 | - $html .= EEH_HTML::td(  | 
                                                        |
| 261 | - EEH_Template::format_currency($line_item->total(), false, false),  | 
                                                        |
| 262 | - '',  | 
                                                        |
| 263 | - 'jst-rght'  | 
                                                        |
| 264 | - );  | 
                                                        |
| 265 | -  | 
                                                        |
| 266 | - // finish things off and return  | 
                                                        |
| 267 | - $html .= EEH_HTML::trx();  | 
                                                        |
| 268 | - return $html;  | 
                                                        |
| 269 | - }  | 
                                                        |
| 270 | -  | 
                                                        |
| 271 | -  | 
                                                        |
| 272 | - /**  | 
                                                        |
| 273 | - * _get_cancellations  | 
                                                        |
| 274 | - *  | 
                                                        |
| 275 | - * @param EE_Line_Item $line_item  | 
                                                        |
| 276 | - * @return string  | 
                                                        |
| 277 | - * @throws EE_Error  | 
                                                        |
| 278 | - * @throws ReflectionException  | 
                                                        |
| 279 | - */  | 
                                                        |
| 280 | - protected function _get_cancellations(EE_Line_Item $line_item)  | 
                                                        |
| 281 | -    { | 
                                                        |
| 282 | - $html = '';  | 
                                                        |
| 283 | - $cancellations = $line_item->get_cancellations();  | 
                                                        |
| 284 | - $cancellation = reset($cancellations);  | 
                                                        |
| 285 | -        if ($cancellation instanceof EE_Line_Item) { | 
                                                        |
| 286 | - $html .= ' <span class="ee-line-item-id">';  | 
                                                        |
| 287 | - $html .= sprintf(  | 
                                                        |
| 288 | - _n(  | 
                                                        |
| 289 | - '(%1$s Cancellation)',  | 
                                                        |
| 290 | - '(%1$s Cancellations)',  | 
                                                        |
| 291 | - $cancellation->quantity(),  | 
                                                        |
| 292 | - 'event_espresso'  | 
                                                        |
| 293 | - ),  | 
                                                        |
| 294 | - $cancellation->quantity()  | 
                                                        |
| 295 | - );  | 
                                                        |
| 296 | - $html .= '</span>';  | 
                                                        |
| 297 | - }  | 
                                                        |
| 298 | - return $html;  | 
                                                        |
| 299 | - }  | 
                                                        |
| 300 | -  | 
                                                        |
| 301 | -  | 
                                                        |
| 302 | - // /**  | 
                                                        |
| 303 | - // * _sub_item_row  | 
                                                        |
| 304 | - // *  | 
                                                        |
| 305 | - // * @param EE_Line_Item $line_item  | 
                                                        |
| 306 | - // * @param array $options  | 
                                                        |
| 307 | - // * @return mixed  | 
                                                        |
| 308 | - // */  | 
                                                        |
| 309 | - // protected function _sub_item_row(EE_Line_Item $line_item, $options = [])  | 
                                                        |
| 310 | -    // { | 
                                                        |
| 311 | - // // for now we're not showing sub-items  | 
                                                        |
| 312 | - // return '';  | 
                                                        |
| 313 | - // }  | 
                                                        |
| 314 | -  | 
                                                        |
| 315 | -  | 
                                                        |
| 316 | - /**  | 
                                                        |
| 317 | - * _tax_row  | 
                                                        |
| 318 | - *  | 
                                                        |
| 319 | - * @param EE_Line_Item $line_item  | 
                                                        |
| 320 | - * @return mixed  | 
                                                        |
| 321 | - * @throws EE_Error  | 
                                                        |
| 322 | - * @throws ReflectionException  | 
                                                        |
| 323 | - */  | 
                                                        |
| 324 | - protected function _tax_row(EE_Line_Item $line_item)  | 
                                                        |
| 325 | -    { | 
                                                        |
| 326 | - // start of row  | 
                                                        |
| 327 | -        $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); | 
                                                        |
| 328 | - // name th  | 
                                                        |
| 329 | - $html .= EEH_HTML::th(  | 
                                                        |
| 330 | -            $line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', | 
                                                        |
| 331 | - '',  | 
                                                        |
| 332 | - 'jst-rght',  | 
                                                        |
| 333 | - '',  | 
                                                        |
| 334 | - ' colspan="4"'  | 
                                                        |
| 335 | - );  | 
                                                        |
| 336 | - // total th  | 
                                                        |
| 337 | - $html .= EEH_HTML::th(  | 
                                                        |
| 338 | - EEH_Template::format_currency($line_item->total(), false, false),  | 
                                                        |
| 339 | - '',  | 
                                                        |
| 340 | - 'jst-rght'  | 
                                                        |
| 341 | - );  | 
                                                        |
| 342 | - // end of row  | 
                                                        |
| 343 | - $html .= EEH_HTML::trx();  | 
                                                        |
| 344 | - return $html;  | 
                                                        |
| 345 | - }  | 
                                                        |
| 346 | -  | 
                                                        |
| 347 | -  | 
                                                        |
| 348 | - // /**  | 
                                                        |
| 349 | - // * _total_row  | 
                                                        |
| 350 | - // *  | 
                                                        |
| 351 | - // * @param EE_Line_Item $line_item  | 
                                                        |
| 352 | - // * @param string $text  | 
                                                        |
| 353 | - // * @param array $options  | 
                                                        |
| 354 | - // * @return mixed  | 
                                                        |
| 355 | - // */  | 
                                                        |
| 356 | - // protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = [])  | 
                                                        |
| 357 | -    // { | 
                                                        |
| 358 | - // // currently not showing subtotal row  | 
                                                        |
| 359 | - // return '';  | 
                                                        |
| 360 | - // }  | 
                                                        |
| 361 | -  | 
                                                        |
| 362 | -  | 
                                                        |
| 363 | - /**  | 
                                                        |
| 364 | - * _total_row  | 
                                                        |
| 365 | - *  | 
                                                        |
| 366 | - * @param EE_Line_Item $line_item  | 
                                                        |
| 367 | - * @return mixed  | 
                                                        |
| 368 | - * @throws EE_Error  | 
                                                        |
| 369 | - * @throws ReflectionException  | 
                                                        |
| 370 | - */  | 
                                                        |
| 371 | - protected function _total_row(EE_Line_Item $line_item)  | 
                                                        |
| 372 | -    { | 
                                                        |
| 373 | - // start of row  | 
                                                        |
| 374 | -        $html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); | 
                                                        |
| 375 | - // Total th label  | 
                                                        |
| 376 | - $total_label =  | 
                                                        |
| 377 | - sprintf(  | 
                                                        |
| 378 | -                esc_html__('Transaction Total %s', 'event_espresso'), | 
                                                        |
| 379 | -                '(' . EE_Registry::instance()->CFG->currency->code . ')' | 
                                                        |
| 380 | - );  | 
                                                        |
| 381 | - $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');  | 
                                                        |
| 382 | - // total th  | 
                                                        |
| 383 | -  | 
                                                        |
| 384 | - $html .= EEH_HTML::th(  | 
                                                        |
| 385 | - EEH_Template::format_currency($line_item->total(), false, false),  | 
                                                        |
| 386 | - '',  | 
                                                        |
| 387 | - 'jst-rght'  | 
                                                        |
| 388 | - );  | 
                                                        |
| 389 | - // end of row  | 
                                                        |
| 390 | - $html .= EEH_HTML::trx();  | 
                                                        |
| 391 | - return $html;  | 
                                                        |
| 392 | - }  | 
                                                        |
| 16 | + /**  | 
                                                        |
| 17 | + * whether to display the taxes row or not  | 
                                                        |
| 18 | + *  | 
                                                        |
| 19 | + * @type bool $_show_taxes  | 
                                                        |
| 20 | + */  | 
                                                        |
| 21 | + protected $_show_taxes = false;  | 
                                                        |
| 22 | +  | 
                                                        |
| 23 | + /**  | 
                                                        |
| 24 | + * html for any tax rows  | 
                                                        |
| 25 | + *  | 
                                                        |
| 26 | + * @type string $_show_taxes  | 
                                                        |
| 27 | + */  | 
                                                        |
| 28 | + protected $_taxes_html = '';  | 
                                                        |
| 29 | +  | 
                                                        |
| 30 | +  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * total amount including tax we can bill for at this time  | 
                                                        |
| 33 | + *  | 
                                                        |
| 34 | + * @type float $_grand_total  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | + protected $_grand_total = 0.00;  | 
                                                        |
| 37 | +  | 
                                                        |
| 38 | +  | 
                                                        |
| 39 | + /**  | 
                                                        |
| 40 | + * @return float  | 
                                                        |
| 41 | + */  | 
                                                        |
| 42 | + public function grand_total()  | 
                                                        |
| 43 | +	{ | 
                                                        |
| 44 | + return $this->_grand_total;  | 
                                                        |
| 45 | + }  | 
                                                        |
| 46 | +  | 
                                                        |
| 47 | +  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * This is used to output a single  | 
                                                        |
| 50 | + *  | 
                                                        |
| 51 | + * @param EE_Line_Item $line_item  | 
                                                        |
| 52 | + * @param array $options  | 
                                                        |
| 53 | + * @return mixed  | 
                                                        |
| 54 | + * @throws EE_Error  | 
                                                        |
| 55 | + * @throws ReflectionException  | 
                                                        |
| 56 | + */  | 
                                                        |
| 57 | + public function display_line_item(EE_Line_Item $line_item, $options = [])  | 
                                                        |
| 58 | +	{ | 
                                                        |
| 59 | + $html = '';  | 
                                                        |
| 60 | + // set some default options and merge with incoming  | 
                                                        |
| 61 | + $default_options = [  | 
                                                        |
| 62 | + 'odd' => true,  | 
                                                        |
| 63 | + 'use_table_wrapper' => true,  | 
                                                        |
| 64 | + 'table_css_class' => 'admin-primary-mbox-tbl',  | 
                                                        |
| 65 | + 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',  | 
                                                        |
| 66 | + 'total_tr_css_class' => 'admin-primary-mbox-total-tr',  | 
                                                        |
| 67 | + ];  | 
                                                        |
| 68 | + $options = array_merge($default_options, (array) $options);  | 
                                                        |
| 69 | +  | 
                                                        |
| 70 | +		switch ($line_item->type()) { | 
                                                        |
| 71 | + case EEM_Line_Item::type_line_item:  | 
                                                        |
| 72 | + // item row  | 
                                                        |
| 73 | + $html .= $this->_item_row($line_item, $options);  | 
                                                        |
| 74 | + break;  | 
                                                        |
| 75 | +  | 
                                                        |
| 76 | + case EEM_Line_Item::type_sub_line_item:  | 
                                                        |
| 77 | + // currently not showing sub-items  | 
                                                        |
| 78 | + // $html .= $this->_sub_item_row($line_item, $options);  | 
                                                        |
| 79 | + break;  | 
                                                        |
| 80 | +  | 
                                                        |
| 81 | + case EEM_Line_Item::type_sub_total:  | 
                                                        |
| 82 | +				if ($line_item->quantity() === 0) { | 
                                                        |
| 83 | + return $html;  | 
                                                        |
| 84 | + }  | 
                                                        |
| 85 | + // loop through children  | 
                                                        |
| 86 | + $child_line_items = $line_item->children();  | 
                                                        |
| 87 | + // loop through children  | 
                                                        |
| 88 | +				foreach ($child_line_items as $child_line_item) { | 
                                                        |
| 89 | + // recursively feed children back into this method  | 
                                                        |
| 90 | + $html .= $this->display_line_item($child_line_item, $options);  | 
                                                        |
| 91 | + }  | 
                                                        |
| 92 | + // currently not showing subtotal row  | 
                                                        |
| 93 | + // $html .= $this->_sub_total_row($line_item, $options);  | 
                                                        |
| 94 | + break;  | 
                                                        |
| 95 | +  | 
                                                        |
| 96 | + case EEM_Line_Item::type_tax:  | 
                                                        |
| 97 | +				if ($this->_show_taxes) { | 
                                                        |
| 98 | + $this->_taxes_html .= $this->_tax_row($line_item);  | 
                                                        |
| 99 | + }  | 
                                                        |
| 100 | + break;  | 
                                                        |
| 101 | +  | 
                                                        |
| 102 | + case EEM_Line_Item::type_tax_sub_total:  | 
                                                        |
| 103 | +				foreach ($line_item->children() as $child_line_item) { | 
                                                        |
| 104 | +					if ($child_line_item->type() == EEM_Line_Item::type_tax) { | 
                                                        |
| 105 | + $this->display_line_item($child_line_item, $options);  | 
                                                        |
| 106 | + }  | 
                                                        |
| 107 | + }  | 
                                                        |
| 108 | + break;  | 
                                                        |
| 109 | +  | 
                                                        |
| 110 | + case EEM_Line_Item::type_total:  | 
                                                        |
| 111 | + // determine whether to display taxes or not  | 
                                                        |
| 112 | + $this->_show_taxes = $line_item->get_total_tax() > 0;  | 
                                                        |
| 113 | + // get all child line items  | 
                                                        |
| 114 | + $children = $line_item->children();  | 
                                                        |
| 115 | +  | 
                                                        |
| 116 | + // loop thru all non-tax child line items  | 
                                                        |
| 117 | +				foreach ($children as $child_line_item) { | 
                                                        |
| 118 | + $html .= $this->display_line_item($child_line_item, $options);  | 
                                                        |
| 119 | + }  | 
                                                        |
| 120 | +  | 
                                                        |
| 121 | + $html .= $this->_taxes_html;  | 
                                                        |
| 122 | + $html .= $this->_total_row($line_item);  | 
                                                        |
| 123 | +				if ($options['use_table_wrapper']) { | 
                                                        |
| 124 | + $html = $this->_table_header($options) . $html . $this->_table_footer();  | 
                                                        |
| 125 | + }  | 
                                                        |
| 126 | + break;  | 
                                                        |
| 127 | + }  | 
                                                        |
| 128 | +  | 
                                                        |
| 129 | + return $html;  | 
                                                        |
| 130 | + }  | 
                                                        |
| 131 | +  | 
                                                        |
| 132 | +  | 
                                                        |
| 133 | + /**  | 
                                                        |
| 134 | + * Table header for display.  | 
                                                        |
| 135 | + *  | 
                                                        |
| 136 | + * @param array $options array of options for the table.  | 
                                                        |
| 137 | + * @return string  | 
                                                        |
| 138 | + * @since 4.8  | 
                                                        |
| 139 | + */  | 
                                                        |
| 140 | + protected function _table_header(array $options)  | 
                                                        |
| 141 | +	{ | 
                                                        |
| 142 | +		$html = EEH_HTML::table('', '', $options['table_css_class']); | 
                                                        |
| 143 | + $html .= EEH_HTML::thead();  | 
                                                        |
| 144 | + $html .= EEH_HTML::tr();  | 
                                                        |
| 145 | +		$html .= EEH_HTML::th(esc_html__('Name', 'event_espresso'), '', 'jst-left'); | 
                                                        |
| 146 | +		$html .= EEH_HTML::th(esc_html__('Type', 'event_espresso'), '', 'jst-left'); | 
                                                        |
| 147 | +		$html .= EEH_HTML::th(esc_html__('Amount', 'event_espresso'), '', 'jst-cntr'); | 
                                                        |
| 148 | +		$html .= EEH_HTML::th(esc_html__('Qty', 'event_espresso'), '', 'jst-cntr'); | 
                                                        |
| 149 | +		$html .= EEH_HTML::th(esc_html__('Line Total', 'event_espresso'), '', 'jst-cntr'); | 
                                                        |
| 150 | + $html .= EEH_HTML::tbody();  | 
                                                        |
| 151 | + return $html;  | 
                                                        |
| 152 | + }  | 
                                                        |
| 153 | +  | 
                                                        |
| 154 | +  | 
                                                        |
| 155 | + /**  | 
                                                        |
| 156 | + * Table footer for display  | 
                                                        |
| 157 | + *  | 
                                                        |
| 158 | + * @return string  | 
                                                        |
| 159 | + * @since 4.8  | 
                                                        |
| 160 | + */  | 
                                                        |
| 161 | + protected function _table_footer()  | 
                                                        |
| 162 | +	{ | 
                                                        |
| 163 | + return EEH_HTML::tbodyx() . EEH_HTML::tablex();  | 
                                                        |
| 164 | + }  | 
                                                        |
| 165 | +  | 
                                                        |
| 166 | +  | 
                                                        |
| 167 | + /**  | 
                                                        |
| 168 | + * _item_row  | 
                                                        |
| 169 | + *  | 
                                                        |
| 170 | + * @param EE_Line_Item $line_item  | 
                                                        |
| 171 | + * @param array $options  | 
                                                        |
| 172 | + * @return mixed  | 
                                                        |
| 173 | + * @throws EE_Error  | 
                                                        |
| 174 | + * @throws ReflectionException  | 
                                                        |
| 175 | + */  | 
                                                        |
| 176 | + protected function _item_row(EE_Line_Item $line_item, $options = [])  | 
                                                        |
| 177 | +	{ | 
                                                        |
| 178 | + $line_item_related_object = $line_item->get_object();  | 
                                                        |
| 179 | + $parent_line_item_related_object = $line_item->parent() instanceof EE_Line_Item  | 
                                                        |
| 180 | + ? $line_item->parent()->get_object()  | 
                                                        |
| 181 | + : null;  | 
                                                        |
| 182 | + // start of row  | 
                                                        |
| 183 | + $row_class = $options['odd'] ? 'item odd' : 'item';  | 
                                                        |
| 184 | +		$html      = EEH_HTML::tr('', '', $row_class); | 
                                                        |
| 185 | +  | 
                                                        |
| 186 | + // Name Column  | 
                                                        |
| 187 | + $name_link = $line_item_related_object instanceof EEI_Admin_Links  | 
                                                        |
| 188 | + ? $line_item_related_object->get_admin_details_link()  | 
                                                        |
| 189 | + : '';  | 
                                                        |
| 190 | +  | 
                                                        |
| 191 | + // related object scope.  | 
                                                        |
| 192 | + $parent_related_object_name = $parent_line_item_related_object instanceof EEI_Line_Item_Object  | 
                                                        |
| 193 | + ? $parent_line_item_related_object->name()  | 
                                                        |
| 194 | + : '';  | 
                                                        |
| 195 | + $parent_related_object_name = empty($parent_related_object_name)  | 
                                                        |
| 196 | + && $line_item->parent() instanceof EE_Line_Item  | 
                                                        |
| 197 | + ? $line_item->parent()->name()  | 
                                                        |
| 198 | + : $parent_related_object_name;  | 
                                                        |
| 199 | +  | 
                                                        |
| 200 | + $parent_related_object_link = $parent_line_item_related_object instanceof EEI_Admin_Links  | 
                                                        |
| 201 | + ? $parent_line_item_related_object->get_admin_details_link()  | 
                                                        |
| 202 | + : '';  | 
                                                        |
| 203 | +  | 
                                                        |
| 204 | + $name_html = $line_item_related_object instanceof EEI_Line_Item_Object  | 
                                                        |
| 205 | + ? $line_item_related_object->name()  | 
                                                        |
| 206 | + : $line_item->name();  | 
                                                        |
| 207 | +  | 
                                                        |
| 208 | + $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;  | 
                                                        |
| 209 | + $name_html .= $line_item->is_taxable() ? ' *' : '';  | 
                                                        |
| 210 | +  | 
                                                        |
| 211 | + // maybe preface with icon?  | 
                                                        |
| 212 | + $name_html = $line_item_related_object instanceof EEI_Has_Icon  | 
                                                        |
| 213 | + ? $line_item_related_object->get_icon() . $name_html  | 
                                                        |
| 214 | + : $name_html;  | 
                                                        |
| 215 | +  | 
                                                        |
| 216 | + $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';  | 
                                                        |
| 217 | +  | 
                                                        |
| 218 | + $name_html .= sprintf(  | 
                                                        |
| 219 | +			_x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), | 
                                                        |
| 220 | + '<span class="ee-line-item-related-parent-object">',  | 
                                                        |
| 221 | + $line_item->parent() instanceof EE_Line_Item  | 
                                                        |
| 222 | + ? $line_item->parent()->OBJ_type_i18n()  | 
                                                        |
| 223 | +				: esc_html__('Item:', 'event_espresso'), | 
                                                        |
| 224 | + $parent_related_object_link  | 
                                                        |
| 225 | + ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>'  | 
                                                        |
| 226 | + : $parent_related_object_name,  | 
                                                        |
| 227 | + '</span>'  | 
                                                        |
| 228 | + );  | 
                                                        |
| 229 | +  | 
                                                        |
| 230 | + $name_html = apply_filters(  | 
                                                        |
| 231 | + 'FHEE__EE_Admin_Table_Line_Item_Display_Strategy___item_row__name_html',  | 
                                                        |
| 232 | + $name_html,  | 
                                                        |
| 233 | + $line_item,  | 
                                                        |
| 234 | + $options  | 
                                                        |
| 235 | + );  | 
                                                        |
| 236 | +  | 
                                                        |
| 237 | + $html .= EEH_HTML::td($name_html, '', 'jst-left');  | 
                                                        |
| 238 | +  | 
                                                        |
| 239 | + // Type Column  | 
                                                        |
| 240 | + $type_html = $line_item->OBJ_type() ? $line_item->OBJ_type_i18n() : '';  | 
                                                        |
| 241 | + $type_html .= $this->_get_cancellations($line_item);  | 
                                                        |
| 242 | + $type_html .= $line_item->OBJ_type() ? '<br />' : '';  | 
                                                        |
| 243 | + $code = $line_item_related_object instanceof EEI_Has_Code  | 
                                                        |
| 244 | + ? $line_item_related_object->code()  | 
                                                        |
| 245 | + : '';  | 
                                                        |
| 246 | + $type_html .= ! empty($code)  | 
                                                        |
| 247 | +			? '<span class="ee-line-item-id">' . sprintf(esc_html__('Code: %s', 'event_espresso'), $code) . '</span>' | 
                                                        |
| 248 | + : '';  | 
                                                        |
| 249 | + $html .= EEH_HTML::td($type_html, '', 'jst-left');  | 
                                                        |
| 250 | +  | 
                                                        |
| 251 | + // Amount Column  | 
                                                        |
| 252 | + $html .= $line_item->is_percent()  | 
                                                        |
| 253 | + ? EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght')  | 
                                                        |
| 254 | + : EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');  | 
                                                        |
| 255 | +  | 
                                                        |
| 256 | + // QTY column  | 
                                                        |
| 257 | + $html .= EEH_HTML::td($line_item->quantity(), '', 'jst-rght');  | 
                                                        |
| 258 | +  | 
                                                        |
| 259 | + // total column  | 
                                                        |
| 260 | + $html .= EEH_HTML::td(  | 
                                                        |
| 261 | + EEH_Template::format_currency($line_item->total(), false, false),  | 
                                                        |
| 262 | + '',  | 
                                                        |
| 263 | + 'jst-rght'  | 
                                                        |
| 264 | + );  | 
                                                        |
| 265 | +  | 
                                                        |
| 266 | + // finish things off and return  | 
                                                        |
| 267 | + $html .= EEH_HTML::trx();  | 
                                                        |
| 268 | + return $html;  | 
                                                        |
| 269 | + }  | 
                                                        |
| 270 | +  | 
                                                        |
| 271 | +  | 
                                                        |
| 272 | + /**  | 
                                                        |
| 273 | + * _get_cancellations  | 
                                                        |
| 274 | + *  | 
                                                        |
| 275 | + * @param EE_Line_Item $line_item  | 
                                                        |
| 276 | + * @return string  | 
                                                        |
| 277 | + * @throws EE_Error  | 
                                                        |
| 278 | + * @throws ReflectionException  | 
                                                        |
| 279 | + */  | 
                                                        |
| 280 | + protected function _get_cancellations(EE_Line_Item $line_item)  | 
                                                        |
| 281 | +	{ | 
                                                        |
| 282 | + $html = '';  | 
                                                        |
| 283 | + $cancellations = $line_item->get_cancellations();  | 
                                                        |
| 284 | + $cancellation = reset($cancellations);  | 
                                                        |
| 285 | +		if ($cancellation instanceof EE_Line_Item) { | 
                                                        |
| 286 | + $html .= ' <span class="ee-line-item-id">';  | 
                                                        |
| 287 | + $html .= sprintf(  | 
                                                        |
| 288 | + _n(  | 
                                                        |
| 289 | + '(%1$s Cancellation)',  | 
                                                        |
| 290 | + '(%1$s Cancellations)',  | 
                                                        |
| 291 | + $cancellation->quantity(),  | 
                                                        |
| 292 | + 'event_espresso'  | 
                                                        |
| 293 | + ),  | 
                                                        |
| 294 | + $cancellation->quantity()  | 
                                                        |
| 295 | + );  | 
                                                        |
| 296 | + $html .= '</span>';  | 
                                                        |
| 297 | + }  | 
                                                        |
| 298 | + return $html;  | 
                                                        |
| 299 | + }  | 
                                                        |
| 300 | +  | 
                                                        |
| 301 | +  | 
                                                        |
| 302 | + // /**  | 
                                                        |
| 303 | + // * _sub_item_row  | 
                                                        |
| 304 | + // *  | 
                                                        |
| 305 | + // * @param EE_Line_Item $line_item  | 
                                                        |
| 306 | + // * @param array $options  | 
                                                        |
| 307 | + // * @return mixed  | 
                                                        |
| 308 | + // */  | 
                                                        |
| 309 | + // protected function _sub_item_row(EE_Line_Item $line_item, $options = [])  | 
                                                        |
| 310 | +	// { | 
                                                        |
| 311 | + // // for now we're not showing sub-items  | 
                                                        |
| 312 | + // return '';  | 
                                                        |
| 313 | + // }  | 
                                                        |
| 314 | +  | 
                                                        |
| 315 | +  | 
                                                        |
| 316 | + /**  | 
                                                        |
| 317 | + * _tax_row  | 
                                                        |
| 318 | + *  | 
                                                        |
| 319 | + * @param EE_Line_Item $line_item  | 
                                                        |
| 320 | + * @return mixed  | 
                                                        |
| 321 | + * @throws EE_Error  | 
                                                        |
| 322 | + * @throws ReflectionException  | 
                                                        |
| 323 | + */  | 
                                                        |
| 324 | + protected function _tax_row(EE_Line_Item $line_item)  | 
                                                        |
| 325 | +	{ | 
                                                        |
| 326 | + // start of row  | 
                                                        |
| 327 | +		$html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); | 
                                                        |
| 328 | + // name th  | 
                                                        |
| 329 | + $html .= EEH_HTML::th(  | 
                                                        |
| 330 | +			$line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', | 
                                                        |
| 331 | + '',  | 
                                                        |
| 332 | + 'jst-rght',  | 
                                                        |
| 333 | + '',  | 
                                                        |
| 334 | + ' colspan="4"'  | 
                                                        |
| 335 | + );  | 
                                                        |
| 336 | + // total th  | 
                                                        |
| 337 | + $html .= EEH_HTML::th(  | 
                                                        |
| 338 | + EEH_Template::format_currency($line_item->total(), false, false),  | 
                                                        |
| 339 | + '',  | 
                                                        |
| 340 | + 'jst-rght'  | 
                                                        |
| 341 | + );  | 
                                                        |
| 342 | + // end of row  | 
                                                        |
| 343 | + $html .= EEH_HTML::trx();  | 
                                                        |
| 344 | + return $html;  | 
                                                        |
| 345 | + }  | 
                                                        |
| 346 | +  | 
                                                        |
| 347 | +  | 
                                                        |
| 348 | + // /**  | 
                                                        |
| 349 | + // * _total_row  | 
                                                        |
| 350 | + // *  | 
                                                        |
| 351 | + // * @param EE_Line_Item $line_item  | 
                                                        |
| 352 | + // * @param string $text  | 
                                                        |
| 353 | + // * @param array $options  | 
                                                        |
| 354 | + // * @return mixed  | 
                                                        |
| 355 | + // */  | 
                                                        |
| 356 | + // protected function _sub_total_row(EE_Line_Item $line_item, $text = '', $options = [])  | 
                                                        |
| 357 | +	// { | 
                                                        |
| 358 | + // // currently not showing subtotal row  | 
                                                        |
| 359 | + // return '';  | 
                                                        |
| 360 | + // }  | 
                                                        |
| 361 | +  | 
                                                        |
| 362 | +  | 
                                                        |
| 363 | + /**  | 
                                                        |
| 364 | + * _total_row  | 
                                                        |
| 365 | + *  | 
                                                        |
| 366 | + * @param EE_Line_Item $line_item  | 
                                                        |
| 367 | + * @return mixed  | 
                                                        |
| 368 | + * @throws EE_Error  | 
                                                        |
| 369 | + * @throws ReflectionException  | 
                                                        |
| 370 | + */  | 
                                                        |
| 371 | + protected function _total_row(EE_Line_Item $line_item)  | 
                                                        |
| 372 | +	{ | 
                                                        |
| 373 | + // start of row  | 
                                                        |
| 374 | +		$html = EEH_HTML::tr('', '', 'admin-primary-mbox-total-tr'); | 
                                                        |
| 375 | + // Total th label  | 
                                                        |
| 376 | + $total_label =  | 
                                                        |
| 377 | + sprintf(  | 
                                                        |
| 378 | +				esc_html__('Transaction Total %s', 'event_espresso'), | 
                                                        |
| 379 | +				'(' . EE_Registry::instance()->CFG->currency->code . ')' | 
                                                        |
| 380 | + );  | 
                                                        |
| 381 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');  | 
                                                        |
| 382 | + // total th  | 
                                                        |
| 383 | +  | 
                                                        |
| 384 | + $html .= EEH_HTML::th(  | 
                                                        |
| 385 | + EEH_Template::format_currency($line_item->total(), false, false),  | 
                                                        |
| 386 | + '',  | 
                                                        |
| 387 | + 'jst-rght'  | 
                                                        |
| 388 | + );  | 
                                                        |
| 389 | + // end of row  | 
                                                        |
| 390 | + $html .= EEH_HTML::trx();  | 
                                                        |
| 391 | + return $html;  | 
                                                        |
| 392 | + }  | 
                                                        |
| 393 | 393 | }  | 
                                                        
@@ -65,7 +65,7 @@ discard block  | 
                                                    ||
| 65 | 65 | 'taxes_tr_css_class' => 'admin-primary-mbox-taxes-tr',  | 
                                                        
| 66 | 66 | 'total_tr_css_class' => 'admin-primary-mbox-total-tr',  | 
                                                        
| 67 | 67 | ];  | 
                                                        
| 68 | - $options = array_merge($default_options, (array) $options);  | 
                                                        |
| 68 | + $options = array_merge($default_options, (array) $options);  | 
                                                        |
| 69 | 69 | |
| 70 | 70 |          switch ($line_item->type()) { | 
                                                        
| 71 | 71 | case EEM_Line_Item::type_line_item:  | 
                                                        
@@ -121,7 +121,7 @@ discard block  | 
                                                    ||
| 121 | 121 | $html .= $this->_taxes_html;  | 
                                                        
| 122 | 122 | $html .= $this->_total_row($line_item);  | 
                                                        
| 123 | 123 |                  if ($options['use_table_wrapper']) { | 
                                                        
| 124 | - $html = $this->_table_header($options) . $html . $this->_table_footer();  | 
                                                        |
| 124 | + $html = $this->_table_header($options).$html.$this->_table_footer();  | 
                                                        |
| 125 | 125 | }  | 
                                                        
| 126 | 126 | break;  | 
                                                        
| 127 | 127 | }  | 
                                                        
@@ -160,7 +160,7 @@ discard block  | 
                                                    ||
| 160 | 160 | */  | 
                                                        
| 161 | 161 | protected function _table_footer()  | 
                                                        
| 162 | 162 |      { | 
                                                        
| 163 | - return EEH_HTML::tbodyx() . EEH_HTML::tablex();  | 
                                                        |
| 163 | + return EEH_HTML::tbodyx().EEH_HTML::tablex();  | 
                                                        |
| 164 | 164 | }  | 
                                                        
| 165 | 165 | |
| 166 | 166 | |
@@ -205,15 +205,15 @@ discard block  | 
                                                    ||
| 205 | 205 | ? $line_item_related_object->name()  | 
                                                        
| 206 | 206 | : $line_item->name();  | 
                                                        
| 207 | 207 | |
| 208 | - $name_html = $name_link ? '<a href="' . $name_link . '">' . $name_html . '</a>' : $name_html;  | 
                                                        |
| 208 | + $name_html = $name_link ? '<a href="'.$name_link.'">'.$name_html.'</a>' : $name_html;  | 
                                                        |
| 209 | 209 | $name_html .= $line_item->is_taxable() ? ' *' : '';  | 
                                                        
| 210 | 210 | |
| 211 | 211 | // maybe preface with icon?  | 
                                                        
| 212 | 212 | $name_html = $line_item_related_object instanceof EEI_Has_Icon  | 
                                                        
| 213 | - ? $line_item_related_object->get_icon() . $name_html  | 
                                                        |
| 213 | + ? $line_item_related_object->get_icon().$name_html  | 
                                                        |
| 214 | 214 | : $name_html;  | 
                                                        
| 215 | 215 | |
| 216 | - $name_html = '<span class="ee-line-item-name linked">' . $name_html . '</span><br>';  | 
                                                        |
| 216 | + $name_html = '<span class="ee-line-item-name linked">'.$name_html.'</span><br>';  | 
                                                        |
| 217 | 217 | |
| 218 | 218 | $name_html .= sprintf(  | 
                                                        
| 219 | 219 |              _x('%1$sfor the %2$s: %3$s%4$s', 'eg. "for the Event: My Cool Event"', 'event_espresso'), | 
                                                        
@@ -222,7 +222,7 @@ discard block  | 
                                                    ||
| 222 | 222 | ? $line_item->parent()->OBJ_type_i18n()  | 
                                                        
| 223 | 223 |                  : esc_html__('Item:', 'event_espresso'), | 
                                                        
| 224 | 224 | $parent_related_object_link  | 
                                                        
| 225 | - ? '<a href="' . $parent_related_object_link . '">' . $parent_related_object_name . '</a>'  | 
                                                        |
| 225 | + ? '<a href="'.$parent_related_object_link.'">'.$parent_related_object_name.'</a>'  | 
                                                        |
| 226 | 226 | : $parent_related_object_name,  | 
                                                        
| 227 | 227 | '</span>'  | 
                                                        
| 228 | 228 | );  | 
                                                        
@@ -244,13 +244,13 @@ discard block  | 
                                                    ||
| 244 | 244 | ? $line_item_related_object->code()  | 
                                                        
| 245 | 245 | : '';  | 
                                                        
| 246 | 246 | $type_html .= ! empty($code)  | 
                                                        
| 247 | -            ? '<span class="ee-line-item-id">' . sprintf(esc_html__('Code: %s', 'event_espresso'), $code) . '</span>' | 
                                                        |
| 247 | +            ? '<span class="ee-line-item-id">'.sprintf(esc_html__('Code: %s', 'event_espresso'), $code).'</span>' | 
                                                        |
| 248 | 248 | : '';  | 
                                                        
| 249 | 249 | $html .= EEH_HTML::td($type_html, '', 'jst-left');  | 
                                                        
| 250 | 250 | |
| 251 | 251 | // Amount Column  | 
                                                        
| 252 | 252 | $html .= $line_item->is_percent()  | 
                                                        
| 253 | - ? EEH_HTML::td($line_item->percent() . '%', '', 'jst-rght')  | 
                                                        |
| 253 | + ? EEH_HTML::td($line_item->percent().'%', '', 'jst-rght')  | 
                                                        |
| 254 | 254 | : EEH_HTML::td($line_item->unit_price_no_code(), '', 'jst-rght');  | 
                                                        
| 255 | 255 | |
| 256 | 256 | // QTY column  | 
                                                        
@@ -327,7 +327,7 @@ discard block  | 
                                                    ||
| 327 | 327 |          $html = EEH_HTML::tr('', 'admin-primary-mbox-taxes-tr'); | 
                                                        
| 328 | 328 | // name th  | 
                                                        
| 329 | 329 | $html .= EEH_HTML::th(  | 
                                                        
| 330 | -            $line_item->name() . '(' . $line_item->get_pretty('LIN_percent') . '%)', | 
                                                        |
| 330 | +            $line_item->name().'('.$line_item->get_pretty('LIN_percent').'%)', | 
                                                        |
| 331 | 331 | '',  | 
                                                        
| 332 | 332 | 'jst-rght',  | 
                                                        
| 333 | 333 | '',  | 
                                                        
@@ -376,9 +376,9 @@ discard block  | 
                                                    ||
| 376 | 376 | $total_label =  | 
                                                        
| 377 | 377 | sprintf(  | 
                                                        
| 378 | 378 |                  esc_html__('Transaction Total %s', 'event_espresso'), | 
                                                        
| 379 | -                '(' . EE_Registry::instance()->CFG->currency->code . ')' | 
                                                        |
| 379 | +                '('.EE_Registry::instance()->CFG->currency->code.')' | 
                                                        |
| 380 | 380 | );  | 
                                                        
| 381 | - $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');  | 
                                                        |
| 381 | + $html .= EEH_HTML::th($total_label, '', 'jst-rght', '', ' colspan="4"');  | 
                                                        |
| 382 | 382 | // total th  | 
                                                        
| 383 | 383 | |
| 384 | 384 | $html .= EEH_HTML::th(  | 
                                                        
@@ -18,87 +18,87 @@  | 
                                                    ||
| 18 | 18 |  { | 
                                                        
| 19 | 19 | |
| 20 | 20 | |
| 21 | - /**  | 
                                                        |
| 22 | - * @var ExtraTxnFeesDistributionStrategyInterface  | 
                                                        |
| 23 | - */  | 
                                                        |
| 24 | - protected $extra_fees_strategy;  | 
                                                        |
| 21 | + /**  | 
                                                        |
| 22 | + * @var ExtraTxnFeesDistributionStrategyInterface  | 
                                                        |
| 23 | + */  | 
                                                        |
| 24 | + protected $extra_fees_strategy;  | 
                                                        |
| 25 | 25 | |
| 26 | 26 | |
| 27 | - /**  | 
                                                        |
| 28 | - * @return ExtraTxnFeesDistributionStrategyInterface  | 
                                                        |
| 29 | - * @throws DomainException  | 
                                                        |
| 30 | - */  | 
                                                        |
| 31 | - private function getExtraTxnFeesDistributionStrategy()  | 
                                                        |
| 32 | -    { | 
                                                        |
| 33 | -        if (! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { | 
                                                        |
| 34 | -            switch ($this->getDistributionStrategy()) { | 
                                                        |
| 35 | - case ExtraTxnFeesHandler::STRATEGY_PRIMARY_REGISTRANT_ONLY:  | 
                                                        |
| 36 | - $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly();  | 
                                                        |
| 37 | - break;  | 
                                                        |
| 38 | - case ExtraTxnFeesHandler::STRATEGY_DISTRIBUTE_EVENLY:  | 
                                                        |
| 39 | - $extra_fees_strategy = new ApplyExtraFeesToAllRegistrationsEvenly();  | 
                                                        |
| 40 | - break;  | 
                                                        |
| 41 | - default:  | 
                                                        |
| 42 | - $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly();  | 
                                                        |
| 43 | - }  | 
                                                        |
| 44 | - $this->validateExtraTxnFeesDistributionStrategy(  | 
                                                        |
| 45 | - $extra_fees_strategy,  | 
                                                        |
| 46 | - ExtraTxnFeesDistributionStrategyInterface::class  | 
                                                        |
| 47 | - );  | 
                                                        |
| 48 | - $this->extra_fees_strategy = $extra_fees_strategy;  | 
                                                        |
| 49 | - }  | 
                                                        |
| 50 | - return $this->extra_fees_strategy;  | 
                                                        |
| 51 | - }  | 
                                                        |
| 27 | + /**  | 
                                                        |
| 28 | + * @return ExtraTxnFeesDistributionStrategyInterface  | 
                                                        |
| 29 | + * @throws DomainException  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | + private function getExtraTxnFeesDistributionStrategy()  | 
                                                        |
| 32 | +	{ | 
                                                        |
| 33 | +		if (! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { | 
                                                        |
| 34 | +			switch ($this->getDistributionStrategy()) { | 
                                                        |
| 35 | + case ExtraTxnFeesHandler::STRATEGY_PRIMARY_REGISTRANT_ONLY:  | 
                                                        |
| 36 | + $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly();  | 
                                                        |
| 37 | + break;  | 
                                                        |
| 38 | + case ExtraTxnFeesHandler::STRATEGY_DISTRIBUTE_EVENLY:  | 
                                                        |
| 39 | + $extra_fees_strategy = new ApplyExtraFeesToAllRegistrationsEvenly();  | 
                                                        |
| 40 | + break;  | 
                                                        |
| 41 | + default:  | 
                                                        |
| 42 | + $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly();  | 
                                                        |
| 43 | + }  | 
                                                        |
| 44 | + $this->validateExtraTxnFeesDistributionStrategy(  | 
                                                        |
| 45 | + $extra_fees_strategy,  | 
                                                        |
| 46 | + ExtraTxnFeesDistributionStrategyInterface::class  | 
                                                        |
| 47 | + );  | 
                                                        |
| 48 | + $this->extra_fees_strategy = $extra_fees_strategy;  | 
                                                        |
| 49 | + }  | 
                                                        |
| 50 | + return $this->extra_fees_strategy;  | 
                                                        |
| 51 | + }  | 
                                                        |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - /**  | 
                                                        |
| 55 | - * @param EEI_Line_Item $line_item  | 
                                                        |
| 56 | - * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 57 | - * @param float $original_li_total  | 
                                                        |
| 58 | - * @param float $running_total_for_all_tickets  | 
                                                        |
| 59 | - * @param float $running_total_for_specific_ticket  | 
                                                        |
| 60 | - * @param bool $is_primary_registrant  | 
                                                        |
| 61 | - * @throws EE_Error  | 
                                                        |
| 62 | - */  | 
                                                        |
| 63 | - public function adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 64 | - EEI_Line_Item $line_item,  | 
                                                        |
| 65 | - EEI_Line_Item $child_line_item,  | 
                                                        |
| 66 | - $original_li_total,  | 
                                                        |
| 67 | - $running_total_for_all_tickets,  | 
                                                        |
| 68 | - $running_total_for_specific_ticket,  | 
                                                        |
| 69 | - $is_primary_registrant  | 
                                                        |
| 70 | -    ) { | 
                                                        |
| 71 | - $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy();  | 
                                                        |
| 72 | - $extra_fees_strategy->adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 73 | - $line_item,  | 
                                                        |
| 74 | - $child_line_item,  | 
                                                        |
| 75 | - $original_li_total,  | 
                                                        |
| 76 | - $running_total_for_all_tickets,  | 
                                                        |
| 77 | - $running_total_for_specific_ticket,  | 
                                                        |
| 78 | - $is_primary_registrant,  | 
                                                        |
| 79 | - $this->total_reg_count,  | 
                                                        |
| 80 | - $this->context  | 
                                                        |
| 81 | - );  | 
                                                        |
| 82 | - }  | 
                                                        |
| 54 | + /**  | 
                                                        |
| 55 | + * @param EEI_Line_Item $line_item  | 
                                                        |
| 56 | + * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 57 | + * @param float $original_li_total  | 
                                                        |
| 58 | + * @param float $running_total_for_all_tickets  | 
                                                        |
| 59 | + * @param float $running_total_for_specific_ticket  | 
                                                        |
| 60 | + * @param bool $is_primary_registrant  | 
                                                        |
| 61 | + * @throws EE_Error  | 
                                                        |
| 62 | + */  | 
                                                        |
| 63 | + public function adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 64 | + EEI_Line_Item $line_item,  | 
                                                        |
| 65 | + EEI_Line_Item $child_line_item,  | 
                                                        |
| 66 | + $original_li_total,  | 
                                                        |
| 67 | + $running_total_for_all_tickets,  | 
                                                        |
| 68 | + $running_total_for_specific_ticket,  | 
                                                        |
| 69 | + $is_primary_registrant  | 
                                                        |
| 70 | +	) { | 
                                                        |
| 71 | + $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy();  | 
                                                        |
| 72 | + $extra_fees_strategy->adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 73 | + $line_item,  | 
                                                        |
| 74 | + $child_line_item,  | 
                                                        |
| 75 | + $original_li_total,  | 
                                                        |
| 76 | + $running_total_for_all_tickets,  | 
                                                        |
| 77 | + $running_total_for_specific_ticket,  | 
                                                        |
| 78 | + $is_primary_registrant,  | 
                                                        |
| 79 | + $this->total_reg_count,  | 
                                                        |
| 80 | + $this->context  | 
                                                        |
| 81 | + );  | 
                                                        |
| 82 | + }  | 
                                                        |
| 83 | 83 | |
| 84 | 84 | |
| 85 | - /**  | 
                                                        |
| 86 | - * @param EEI_Line_Item $line_item  | 
                                                        |
| 87 | - * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 88 | - * @param bool $is_primary_registrant  | 
                                                        |
| 89 | - */  | 
                                                        |
| 90 | - public function adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 91 | - EEI_Line_Item $line_item,  | 
                                                        |
| 92 | - EEI_Line_Item $child_line_item,  | 
                                                        |
| 93 | - $is_primary_registrant  | 
                                                        |
| 94 | -    ) { | 
                                                        |
| 95 | - $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy();  | 
                                                        |
| 96 | - $extra_fees_strategy->adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 97 | - $line_item,  | 
                                                        |
| 98 | - $child_line_item,  | 
                                                        |
| 99 | - $is_primary_registrant,  | 
                                                        |
| 100 | - $this->total_reg_count,  | 
                                                        |
| 101 | - $this->context  | 
                                                        |
| 102 | - );  | 
                                                        |
| 103 | - }  | 
                                                        |
| 85 | + /**  | 
                                                        |
| 86 | + * @param EEI_Line_Item $line_item  | 
                                                        |
| 87 | + * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 88 | + * @param bool $is_primary_registrant  | 
                                                        |
| 89 | + */  | 
                                                        |
| 90 | + public function adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 91 | + EEI_Line_Item $line_item,  | 
                                                        |
| 92 | + EEI_Line_Item $child_line_item,  | 
                                                        |
| 93 | + $is_primary_registrant  | 
                                                        |
| 94 | +	) { | 
                                                        |
| 95 | + $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy();  | 
                                                        |
| 96 | + $extra_fees_strategy->adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 97 | + $line_item,  | 
                                                        |
| 98 | + $child_line_item,  | 
                                                        |
| 99 | + $is_primary_registrant,  | 
                                                        |
| 100 | + $this->total_reg_count,  | 
                                                        |
| 101 | + $this->context  | 
                                                        |
| 102 | + );  | 
                                                        |
| 103 | + }  | 
                                                        |
| 104 | 104 | }  | 
                                                        
@@ -30,7 +30,7 @@  | 
                                                    ||
| 30 | 30 | */  | 
                                                        
| 31 | 31 | private function getExtraTxnFeesDistributionStrategy()  | 
                                                        
| 32 | 32 |      { | 
                                                        
| 33 | -        if (! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { | 
                                                        |
| 33 | +        if ( ! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { | 
                                                        |
| 34 | 34 |              switch ($this->getDistributionStrategy()) { | 
                                                        
| 35 | 35 | case ExtraTxnFeesHandler::STRATEGY_PRIMARY_REGISTRANT_ONLY:  | 
                                                        
| 36 | 36 | $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly();  | 
                                                        
@@ -6,40 +6,40 @@  | 
                                                    ||
| 6 | 6 | |
| 7 | 7 | interface ExtraTxnFeesDistributionStrategyInterface  | 
                                                        
| 8 | 8 |  { | 
                                                        
| 9 | - /**  | 
                                                        |
| 10 | - * @param EEI_Line_Item $line_item  | 
                                                        |
| 11 | - * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 12 | - * @param float $original_li_total  | 
                                                        |
| 13 | - * @param float $running_total_for_all_tickets  | 
                                                        |
| 14 | - * @param float $running_total_for_specific_ticket  | 
                                                        |
| 15 | - * @param bool $is_primary_registrant  | 
                                                        |
| 16 | - * @param int $total_reg_count  | 
                                                        |
| 17 | - * @param string $context  | 
                                                        |
| 18 | - */  | 
                                                        |
| 19 | - public function adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 20 | - EEI_Line_Item $line_item,  | 
                                                        |
| 21 | - EEI_Line_Item $child_line_item,  | 
                                                        |
| 22 | - $original_li_total,  | 
                                                        |
| 23 | - $running_total_for_all_tickets,  | 
                                                        |
| 24 | - $running_total_for_specific_ticket,  | 
                                                        |
| 25 | - $is_primary_registrant,  | 
                                                        |
| 26 | - $total_reg_count,  | 
                                                        |
| 27 | - $context  | 
                                                        |
| 28 | - );  | 
                                                        |
| 9 | + /**  | 
                                                        |
| 10 | + * @param EEI_Line_Item $line_item  | 
                                                        |
| 11 | + * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 12 | + * @param float $original_li_total  | 
                                                        |
| 13 | + * @param float $running_total_for_all_tickets  | 
                                                        |
| 14 | + * @param float $running_total_for_specific_ticket  | 
                                                        |
| 15 | + * @param bool $is_primary_registrant  | 
                                                        |
| 16 | + * @param int $total_reg_count  | 
                                                        |
| 17 | + * @param string $context  | 
                                                        |
| 18 | + */  | 
                                                        |
| 19 | + public function adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 20 | + EEI_Line_Item $line_item,  | 
                                                        |
| 21 | + EEI_Line_Item $child_line_item,  | 
                                                        |
| 22 | + $original_li_total,  | 
                                                        |
| 23 | + $running_total_for_all_tickets,  | 
                                                        |
| 24 | + $running_total_for_specific_ticket,  | 
                                                        |
| 25 | + $is_primary_registrant,  | 
                                                        |
| 26 | + $total_reg_count,  | 
                                                        |
| 27 | + $context  | 
                                                        |
| 28 | + );  | 
                                                        |
| 29 | 29 | |
| 30 | 30 | |
| 31 | - /**  | 
                                                        |
| 32 | - * @param EEI_Line_Item $line_item  | 
                                                        |
| 33 | - * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 34 | - * @param bool $is_primary_registrant  | 
                                                        |
| 35 | - * @param int $total_reg_count  | 
                                                        |
| 36 | - * @param string $context  | 
                                                        |
| 37 | - */  | 
                                                        |
| 38 | - public function adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 39 | - EEI_Line_Item $line_item,  | 
                                                        |
| 40 | - EEI_Line_Item $child_line_item,  | 
                                                        |
| 41 | - $is_primary_registrant,  | 
                                                        |
| 42 | - $total_reg_count,  | 
                                                        |
| 43 | - $context  | 
                                                        |
| 44 | - );  | 
                                                        |
| 31 | + /**  | 
                                                        |
| 32 | + * @param EEI_Line_Item $line_item  | 
                                                        |
| 33 | + * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 34 | + * @param bool $is_primary_registrant  | 
                                                        |
| 35 | + * @param int $total_reg_count  | 
                                                        |
| 36 | + * @param string $context  | 
                                                        |
| 37 | + */  | 
                                                        |
| 38 | + public function adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 39 | + EEI_Line_Item $line_item,  | 
                                                        |
| 40 | + EEI_Line_Item $child_line_item,  | 
                                                        |
| 41 | + $is_primary_registrant,  | 
                                                        |
| 42 | + $total_reg_count,  | 
                                                        |
| 43 | + $context  | 
                                                        |
| 44 | + );  | 
                                                        |
| 45 | 45 | }  | 
                                                        
@@ -17,62 +17,62 @@  | 
                                                    ||
| 17 | 17 |  { | 
                                                        
| 18 | 18 | |
| 19 | 19 | |
| 20 | - /**  | 
                                                        |
| 21 | - * @param EEI_Line_Item $line_item  | 
                                                        |
| 22 | - * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 23 | - * @param float $original_li_total  | 
                                                        |
| 24 | - * @param float $running_total_for_all_tickets  | 
                                                        |
| 25 | - * @param float $running_total_for_specific_ticket  | 
                                                        |
| 26 | - * @param bool $is_primary_registrant  | 
                                                        |
| 27 | - * @param int $total_reg_count  | 
                                                        |
| 28 | - * @param string $context  | 
                                                        |
| 29 | - * @throws EE_Error  | 
                                                        |
| 30 | - */  | 
                                                        |
| 31 | - public function adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 32 | - EEI_Line_Item $line_item,  | 
                                                        |
| 33 | - EEI_Line_Item $child_line_item,  | 
                                                        |
| 34 | - $original_li_total,  | 
                                                        |
| 35 | - $running_total_for_all_tickets,  | 
                                                        |
| 36 | - $running_total_for_specific_ticket,  | 
                                                        |
| 37 | - $is_primary_registrant,  | 
                                                        |
| 38 | - $total_reg_count,  | 
                                                        |
| 39 | - $context  | 
                                                        |
| 40 | -    ) { | 
                                                        |
| 41 | - $percent_of_running_total = $running_total_for_all_tickets  | 
                                                        |
| 42 | - ? $original_li_total / $running_total_for_all_tickets  | 
                                                        |
| 43 | - : 0;  | 
                                                        |
| 44 | - $line_item->set_total($running_total_for_specific_ticket * $percent_of_running_total);  | 
                                                        |
| 45 | - $line_item->set_total($running_total_for_specific_ticket);  | 
                                                        |
| 20 | + /**  | 
                                                        |
| 21 | + * @param EEI_Line_Item $line_item  | 
                                                        |
| 22 | + * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 23 | + * @param float $original_li_total  | 
                                                        |
| 24 | + * @param float $running_total_for_all_tickets  | 
                                                        |
| 25 | + * @param float $running_total_for_specific_ticket  | 
                                                        |
| 26 | + * @param bool $is_primary_registrant  | 
                                                        |
| 27 | + * @param int $total_reg_count  | 
                                                        |
| 28 | + * @param string $context  | 
                                                        |
| 29 | + * @throws EE_Error  | 
                                                        |
| 30 | + */  | 
                                                        |
| 31 | + public function adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 32 | + EEI_Line_Item $line_item,  | 
                                                        |
| 33 | + EEI_Line_Item $child_line_item,  | 
                                                        |
| 34 | + $original_li_total,  | 
                                                        |
| 35 | + $running_total_for_all_tickets,  | 
                                                        |
| 36 | + $running_total_for_specific_ticket,  | 
                                                        |
| 37 | + $is_primary_registrant,  | 
                                                        |
| 38 | + $total_reg_count,  | 
                                                        |
| 39 | + $context  | 
                                                        |
| 40 | +	) { | 
                                                        |
| 41 | + $percent_of_running_total = $running_total_for_all_tickets  | 
                                                        |
| 42 | + ? $original_li_total / $running_total_for_all_tickets  | 
                                                        |
| 43 | + : 0;  | 
                                                        |
| 44 | + $line_item->set_total($running_total_for_specific_ticket * $percent_of_running_total);  | 
                                                        |
| 45 | + $line_item->set_total($running_total_for_specific_ticket);  | 
                                                        |
| 46 | 46 | |
| 47 | -        if ($context === ExtraTxnFeesHandler::CONTEXT_ONE_REGISTRATION) { | 
                                                        |
| 48 | - $new_unit_price = $original_li_total / $total_reg_count;  | 
                                                        |
| 49 | - $child_line_item->set_unit_price($new_unit_price);  | 
                                                        |
| 50 | - $child_line_item->set_quantity(1);  | 
                                                        |
| 51 | - $child_line_item->set_total($new_unit_price);  | 
                                                        |
| 52 | - }  | 
                                                        |
| 47 | +		if ($context === ExtraTxnFeesHandler::CONTEXT_ONE_REGISTRATION) { | 
                                                        |
| 48 | + $new_unit_price = $original_li_total / $total_reg_count;  | 
                                                        |
| 49 | + $child_line_item->set_unit_price($new_unit_price);  | 
                                                        |
| 50 | + $child_line_item->set_quantity(1);  | 
                                                        |
| 51 | + $child_line_item->set_total($new_unit_price);  | 
                                                        |
| 52 | + }  | 
                                                        |
| 53 | 53 | |
| 54 | -        if (! $line_item->is_percent()) { | 
                                                        |
| 55 | - $line_item->set_unit_price($line_item->total() / $line_item->quantity());  | 
                                                        |
| 56 | - }  | 
                                                        |
| 57 | - }  | 
                                                        |
| 54 | +		if (! $line_item->is_percent()) { | 
                                                        |
| 55 | + $line_item->set_unit_price($line_item->total() / $line_item->quantity());  | 
                                                        |
| 56 | + }  | 
                                                        |
| 57 | + }  | 
                                                        |
| 58 | 58 | |
| 59 | 59 | |
| 60 | - /**  | 
                                                        |
| 61 | - * @param EEI_Line_Item $line_item  | 
                                                        |
| 62 | - * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 63 | - * @param bool $is_primary_registrant  | 
                                                        |
| 64 | - * @param int $total_reg_count  | 
                                                        |
| 65 | - * @param string $context  | 
                                                        |
| 66 | - * @since $VID:$  | 
                                                        |
| 67 | - */  | 
                                                        |
| 68 | - public function adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 69 | - EEI_Line_Item $line_item,  | 
                                                        |
| 70 | - EEI_Line_Item $child_line_item,  | 
                                                        |
| 71 | - $is_primary_registrant,  | 
                                                        |
| 72 | - $total_reg_count,  | 
                                                        |
| 73 | - $context  | 
                                                        |
| 74 | -    ) { | 
                                                        |
| 75 | - $child_line_item->set_quantity($line_item->quantity());  | 
                                                        |
| 76 | - $child_line_item->set_total($child_line_item->unit_price() * $child_line_item->quantity());  | 
                                                        |
| 77 | - }  | 
                                                        |
| 60 | + /**  | 
                                                        |
| 61 | + * @param EEI_Line_Item $line_item  | 
                                                        |
| 62 | + * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 63 | + * @param bool $is_primary_registrant  | 
                                                        |
| 64 | + * @param int $total_reg_count  | 
                                                        |
| 65 | + * @param string $context  | 
                                                        |
| 66 | + * @since $VID:$  | 
                                                        |
| 67 | + */  | 
                                                        |
| 68 | + public function adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 69 | + EEI_Line_Item $line_item,  | 
                                                        |
| 70 | + EEI_Line_Item $child_line_item,  | 
                                                        |
| 71 | + $is_primary_registrant,  | 
                                                        |
| 72 | + $total_reg_count,  | 
                                                        |
| 73 | + $context  | 
                                                        |
| 74 | +	) { | 
                                                        |
| 75 | + $child_line_item->set_quantity($line_item->quantity());  | 
                                                        |
| 76 | + $child_line_item->set_total($child_line_item->unit_price() * $child_line_item->quantity());  | 
                                                        |
| 77 | + }  | 
                                                        |
| 78 | 78 | }  | 
                                                        
@@ -51,7 +51,7 @@  | 
                                                    ||
| 51 | 51 | $child_line_item->set_total($new_unit_price);  | 
                                                        
| 52 | 52 | }  | 
                                                        
| 53 | 53 | |
| 54 | -        if (! $line_item->is_percent()) { | 
                                                        |
| 54 | +        if ( ! $line_item->is_percent()) { | 
                                                        |
| 55 | 55 | $line_item->set_unit_price($line_item->total() / $line_item->quantity());  | 
                                                        
| 56 | 56 | }  | 
                                                        
| 57 | 57 | }  | 
                                                        
@@ -16,59 +16,59 @@  | 
                                                    ||
| 16 | 16 | class ApplyExtraFeesToPrimaryRegistrantOnly implements ExtraTxnFeesDistributionStrategyInterface  | 
                                                        
| 17 | 17 |  { | 
                                                        
| 18 | 18 | |
| 19 | - /**  | 
                                                        |
| 20 | - * @param EEI_Line_Item $line_item  | 
                                                        |
| 21 | - * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 22 | - * @param float $original_li_total  | 
                                                        |
| 23 | - * @param float $running_total_for_all_tickets  | 
                                                        |
| 24 | - * @param float $running_total_for_specific_ticket  | 
                                                        |
| 25 | - * @param bool $is_primary_registrant  | 
                                                        |
| 26 | - * @param int $total_reg_count  | 
                                                        |
| 27 | - * @param string $context  | 
                                                        |
| 28 | - * @throws EE_Error  | 
                                                        |
| 29 | - */  | 
                                                        |
| 30 | - public function adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 31 | - EEI_Line_Item $line_item,  | 
                                                        |
| 32 | - EEI_Line_Item $child_line_item,  | 
                                                        |
| 33 | - $original_li_total,  | 
                                                        |
| 34 | - $running_total_for_all_tickets,  | 
                                                        |
| 35 | - $running_total_for_specific_ticket,  | 
                                                        |
| 36 | - $is_primary_registrant,  | 
                                                        |
| 37 | - $total_reg_count,  | 
                                                        |
| 38 | - $context  | 
                                                        |
| 39 | -    ) { | 
                                                        |
| 40 | - $percent_of_running_total = $running_total_for_all_tickets  | 
                                                        |
| 41 | - ? $original_li_total / $running_total_for_all_tickets  | 
                                                        |
| 42 | - : 0;  | 
                                                        |
| 43 | - $line_item->set_total($running_total_for_specific_ticket * $percent_of_running_total);  | 
                                                        |
| 19 | + /**  | 
                                                        |
| 20 | + * @param EEI_Line_Item $line_item  | 
                                                        |
| 21 | + * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 22 | + * @param float $original_li_total  | 
                                                        |
| 23 | + * @param float $running_total_for_all_tickets  | 
                                                        |
| 24 | + * @param float $running_total_for_specific_ticket  | 
                                                        |
| 25 | + * @param bool $is_primary_registrant  | 
                                                        |
| 26 | + * @param int $total_reg_count  | 
                                                        |
| 27 | + * @param string $context  | 
                                                        |
| 28 | + * @throws EE_Error  | 
                                                        |
| 29 | + */  | 
                                                        |
| 30 | + public function adjustUnitPriceForNonTicketLineItem(  | 
                                                        |
| 31 | + EEI_Line_Item $line_item,  | 
                                                        |
| 32 | + EEI_Line_Item $child_line_item,  | 
                                                        |
| 33 | + $original_li_total,  | 
                                                        |
| 34 | + $running_total_for_all_tickets,  | 
                                                        |
| 35 | + $running_total_for_specific_ticket,  | 
                                                        |
| 36 | + $is_primary_registrant,  | 
                                                        |
| 37 | + $total_reg_count,  | 
                                                        |
| 38 | + $context  | 
                                                        |
| 39 | +	) { | 
                                                        |
| 40 | + $percent_of_running_total = $running_total_for_all_tickets  | 
                                                        |
| 41 | + ? $original_li_total / $running_total_for_all_tickets  | 
                                                        |
| 42 | + : 0;  | 
                                                        |
| 43 | + $line_item->set_total($running_total_for_specific_ticket * $percent_of_running_total);  | 
                                                        |
| 44 | 44 | |
| 45 | -        if ($context === ExtraTxnFeesHandler::CONTEXT_ONE_REGISTRATION && ! $is_primary_registrant) { | 
                                                        |
| 46 | - $child_line_item->set_unit_price(0);  | 
                                                        |
| 47 | - $child_line_item->set_quantity(0);  | 
                                                        |
| 48 | - $child_line_item->set_total(0);  | 
                                                        |
| 49 | - }  | 
                                                        |
| 45 | +		if ($context === ExtraTxnFeesHandler::CONTEXT_ONE_REGISTRATION && ! $is_primary_registrant) { | 
                                                        |
| 46 | + $child_line_item->set_unit_price(0);  | 
                                                        |
| 47 | + $child_line_item->set_quantity(0);  | 
                                                        |
| 48 | + $child_line_item->set_total(0);  | 
                                                        |
| 49 | + }  | 
                                                        |
| 50 | 50 | |
| 51 | -        if (! $line_item->is_percent()) { | 
                                                        |
| 52 | - $line_item->set_unit_price($line_item->total() / $line_item->quantity());  | 
                                                        |
| 53 | - }  | 
                                                        |
| 54 | - }  | 
                                                        |
| 51 | +		if (! $line_item->is_percent()) { | 
                                                        |
| 52 | + $line_item->set_unit_price($line_item->total() / $line_item->quantity());  | 
                                                        |
| 53 | + }  | 
                                                        |
| 54 | + }  | 
                                                        |
| 55 | 55 | |
| 56 | 56 | |
| 57 | - /**  | 
                                                        |
| 58 | - * @param EEI_Line_Item $line_item  | 
                                                        |
| 59 | - * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 60 | - * @param bool $is_primary_registrant  | 
                                                        |
| 61 | - * @param int $total_reg_count  | 
                                                        |
| 62 | - * @param string $context  | 
                                                        |
| 63 | - */  | 
                                                        |
| 64 | - public function adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 65 | - EEI_Line_Item $line_item,  | 
                                                        |
| 66 | - EEI_Line_Item $child_line_item,  | 
                                                        |
| 67 | - $is_primary_registrant,  | 
                                                        |
| 68 | - $total_reg_count,  | 
                                                        |
| 69 | - $context  | 
                                                        |
| 70 | -    ) { | 
                                                        |
| 71 | - $child_line_item->set_quantity($line_item->quantity());  | 
                                                        |
| 72 | - $child_line_item->set_total($child_line_item->unit_price() * $child_line_item->quantity());  | 
                                                        |
| 73 | - }  | 
                                                        |
| 57 | + /**  | 
                                                        |
| 58 | + * @param EEI_Line_Item $line_item  | 
                                                        |
| 59 | + * @param EEI_Line_Item $child_line_item  | 
                                                        |
| 60 | + * @param bool $is_primary_registrant  | 
                                                        |
| 61 | + * @param int $total_reg_count  | 
                                                        |
| 62 | + * @param string $context  | 
                                                        |
| 63 | + */  | 
                                                        |
| 64 | + public function adjustUnitPriceAndQtyForTicketLineItem(  | 
                                                        |
| 65 | + EEI_Line_Item $line_item,  | 
                                                        |
| 66 | + EEI_Line_Item $child_line_item,  | 
                                                        |
| 67 | + $is_primary_registrant,  | 
                                                        |
| 68 | + $total_reg_count,  | 
                                                        |
| 69 | + $context  | 
                                                        |
| 70 | +	) { | 
                                                        |
| 71 | + $child_line_item->set_quantity($line_item->quantity());  | 
                                                        |
| 72 | + $child_line_item->set_total($child_line_item->unit_price() * $child_line_item->quantity());  | 
                                                        |
| 73 | + }  | 
                                                        |
| 74 | 74 | }  | 
                                                        
@@ -48,7 +48,7 @@  | 
                                                    ||
| 48 | 48 | $child_line_item->set_total(0);  | 
                                                        
| 49 | 49 | }  | 
                                                        
| 50 | 50 | |
| 51 | -        if (! $line_item->is_percent()) { | 
                                                        |
| 51 | +        if ( ! $line_item->is_percent()) { | 
                                                        |
| 52 | 52 | $line_item->set_unit_price($line_item->total() / $line_item->quantity());  | 
                                                        
| 53 | 53 | }  | 
                                                        
| 54 | 54 | }  | 
                                                        
@@ -6,9 +6,9 @@  | 
                                                    ||
| 6 | 6 | |
| 7 | 7 | interface ExtraTxnFeesDistributionStrategyInterface  | 
                                                        
| 8 | 8 |  { | 
                                                        
| 9 | - /**  | 
                                                        |
| 10 | - * @param float $extra_fees  | 
                                                        |
| 11 | - * @param EE_Registration[] $registrations  | 
                                                        |
| 12 | - */  | 
                                                        |
| 13 | - public function applyExtraFeesToRegistrants($extra_fees, array $registrations);  | 
                                                        |
| 9 | + /**  | 
                                                        |
| 10 | + * @param float $extra_fees  | 
                                                        |
| 11 | + * @param EE_Registration[] $registrations  | 
                                                        |
| 12 | + */  | 
                                                        |
| 13 | + public function applyExtraFeesToRegistrants($extra_fees, array $registrations);  | 
                                                        |
| 14 | 14 | }  | 
                                                        
@@ -15,22 +15,22 @@  | 
                                                    ||
| 15 | 15 | */  | 
                                                        
| 16 | 16 | class ApplyExtraFeesToAllRegistrationsEvenly implements ExtraTxnFeesDistributionStrategyInterface  | 
                                                        
| 17 | 17 |  { | 
                                                        
| 18 | - /**  | 
                                                        |
| 19 | - * @param float $extra_fees  | 
                                                        |
| 20 | - * @param EE_Registration[] $registrations  | 
                                                        |
| 21 | - * @throws EE_Error  | 
                                                        |
| 22 | - * @throws ReflectionException  | 
                                                        |
| 23 | - */  | 
                                                        |
| 24 | - public function applyExtraFeesToRegistrants($extra_fees, array $registrations)  | 
                                                        |
| 25 | -    { | 
                                                        |
| 26 | - // divide remaining fees by number of registrations and apply to each  | 
                                                        |
| 27 | - $extra_payment = $extra_fees / count($registrations);  | 
                                                        |
| 28 | -        foreach ($registrations as $registration) { | 
                                                        |
| 29 | -            if ($registration instanceof EE_Registration) { | 
                                                        |
| 30 | - $new_registration_total = $registration->final_price() + $extra_payment;  | 
                                                        |
| 31 | - $registration->set_final_price($new_registration_total);  | 
                                                        |
| 32 | - $registration->save();  | 
                                                        |
| 33 | - }  | 
                                                        |
| 34 | - }  | 
                                                        |
| 35 | - }  | 
                                                        |
| 18 | + /**  | 
                                                        |
| 19 | + * @param float $extra_fees  | 
                                                        |
| 20 | + * @param EE_Registration[] $registrations  | 
                                                        |
| 21 | + * @throws EE_Error  | 
                                                        |
| 22 | + * @throws ReflectionException  | 
                                                        |
| 23 | + */  | 
                                                        |
| 24 | + public function applyExtraFeesToRegistrants($extra_fees, array $registrations)  | 
                                                        |
| 25 | +	{ | 
                                                        |
| 26 | + // divide remaining fees by number of registrations and apply to each  | 
                                                        |
| 27 | + $extra_payment = $extra_fees / count($registrations);  | 
                                                        |
| 28 | +		foreach ($registrations as $registration) { | 
                                                        |
| 29 | +			if ($registration instanceof EE_Registration) { | 
                                                        |
| 30 | + $new_registration_total = $registration->final_price() + $extra_payment;  | 
                                                        |
| 31 | + $registration->set_final_price($new_registration_total);  | 
                                                        |
| 32 | + $registration->save();  | 
                                                        |
| 33 | + }  | 
                                                        |
| 34 | + }  | 
                                                        |
| 35 | + }  | 
                                                        |
| 36 | 36 | }  | 
                                                        
@@ -17,51 +17,51 @@  | 
                                                    ||
| 17 | 17 | class ExtraTxnFeesForRegistrantsHandler extends ExtraTxnFeesHandler  | 
                                                        
| 18 | 18 |  { | 
                                                        
| 19 | 19 | |
| 20 | - /**  | 
                                                        |
| 21 | - * @var ExtraTxnFeesDistributionStrategyInterface  | 
                                                        |
| 22 | - */  | 
                                                        |
| 23 | - protected $extra_fees_strategy;  | 
                                                        |
| 20 | + /**  | 
                                                        |
| 21 | + * @var ExtraTxnFeesDistributionStrategyInterface  | 
                                                        |
| 22 | + */  | 
                                                        |
| 23 | + protected $extra_fees_strategy;  | 
                                                        |
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /**  | 
                                                        |
| 27 | - * @return void  | 
                                                        |
| 28 | - * @throws DomainException  | 
                                                        |
| 29 | - * @throws EE_Error  | 
                                                        |
| 30 | - * @throws ReflectionException  | 
                                                        |
| 31 | - */  | 
                                                        |
| 32 | - public function applyExtraFeesToRegistrants()  | 
                                                        |
| 33 | -    { | 
                                                        |
| 34 | - $this->calculateExtraFeesForRegistrations($this->registrations);  | 
                                                        |
| 35 | - // if there's money owing after all the individual registration fees have been subtracted  | 
                                                        |
| 36 | -        if ($this->extra_fees > 0) { | 
                                                        |
| 37 | - // then first decide whether to spread extra fees across all registrations,  | 
                                                        |
| 38 | - // or assign everything to the primary registrant  | 
                                                        |
| 39 | - $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy();  | 
                                                        |
| 40 | - $extra_fees_strategy->applyExtraFeesToRegistrants($this->extra_fees, $this->registrations);  | 
                                                        |
| 41 | - }  | 
                                                        |
| 42 | - }  | 
                                                        |
| 26 | + /**  | 
                                                        |
| 27 | + * @return void  | 
                                                        |
| 28 | + * @throws DomainException  | 
                                                        |
| 29 | + * @throws EE_Error  | 
                                                        |
| 30 | + * @throws ReflectionException  | 
                                                        |
| 31 | + */  | 
                                                        |
| 32 | + public function applyExtraFeesToRegistrants()  | 
                                                        |
| 33 | +	{ | 
                                                        |
| 34 | + $this->calculateExtraFeesForRegistrations($this->registrations);  | 
                                                        |
| 35 | + // if there's money owing after all the individual registration fees have been subtracted  | 
                                                        |
| 36 | +		if ($this->extra_fees > 0) { | 
                                                        |
| 37 | + // then first decide whether to spread extra fees across all registrations,  | 
                                                        |
| 38 | + // or assign everything to the primary registrant  | 
                                                        |
| 39 | + $extra_fees_strategy = $this->getExtraTxnFeesDistributionStrategy();  | 
                                                        |
| 40 | + $extra_fees_strategy->applyExtraFeesToRegistrants($this->extra_fees, $this->registrations);  | 
                                                        |
| 41 | + }  | 
                                                        |
| 42 | + }  | 
                                                        |
| 43 | 43 | |
| 44 | - /**  | 
                                                        |
| 45 | - * @return ExtraTxnFeesDistributionStrategyInterface  | 
                                                        |
| 46 | - * @throws DomainException  | 
                                                        |
| 47 | - */  | 
                                                        |
| 48 | - private function getExtraTxnFeesDistributionStrategy()  | 
                                                        |
| 49 | -    { | 
                                                        |
| 50 | -        if (! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { | 
                                                        |
| 51 | -            switch ($this->getDistributionStrategy()) { | 
                                                        |
| 52 | - case ExtraTxnFeesHandler::STRATEGY_PRIMARY_REGISTRANT_ONLY:  | 
                                                        |
| 53 | - $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly();  | 
                                                        |
| 54 | - break;  | 
                                                        |
| 55 | - case ExtraTxnFeesHandler::STRATEGY_DISTRIBUTE_EVENLY:  | 
                                                        |
| 56 | - default:  | 
                                                        |
| 57 | - $extra_fees_strategy = new ApplyExtraFeesToAllRegistrationsEvenly();  | 
                                                        |
| 58 | - }  | 
                                                        |
| 59 | - $this->validateExtraTxnFeesDistributionStrategy(  | 
                                                        |
| 60 | - $extra_fees_strategy,  | 
                                                        |
| 61 | - ExtraTxnFeesDistributionStrategyInterface::class  | 
                                                        |
| 62 | - );  | 
                                                        |
| 63 | - $this->extra_fees_strategy = $extra_fees_strategy;  | 
                                                        |
| 64 | - }  | 
                                                        |
| 65 | - return $this->extra_fees_strategy;  | 
                                                        |
| 66 | - }  | 
                                                        |
| 44 | + /**  | 
                                                        |
| 45 | + * @return ExtraTxnFeesDistributionStrategyInterface  | 
                                                        |
| 46 | + * @throws DomainException  | 
                                                        |
| 47 | + */  | 
                                                        |
| 48 | + private function getExtraTxnFeesDistributionStrategy()  | 
                                                        |
| 49 | +	{ | 
                                                        |
| 50 | +		if (! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { | 
                                                        |
| 51 | +			switch ($this->getDistributionStrategy()) { | 
                                                        |
| 52 | + case ExtraTxnFeesHandler::STRATEGY_PRIMARY_REGISTRANT_ONLY:  | 
                                                        |
| 53 | + $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly();  | 
                                                        |
| 54 | + break;  | 
                                                        |
| 55 | + case ExtraTxnFeesHandler::STRATEGY_DISTRIBUTE_EVENLY:  | 
                                                        |
| 56 | + default:  | 
                                                        |
| 57 | + $extra_fees_strategy = new ApplyExtraFeesToAllRegistrationsEvenly();  | 
                                                        |
| 58 | + }  | 
                                                        |
| 59 | + $this->validateExtraTxnFeesDistributionStrategy(  | 
                                                        |
| 60 | + $extra_fees_strategy,  | 
                                                        |
| 61 | + ExtraTxnFeesDistributionStrategyInterface::class  | 
                                                        |
| 62 | + );  | 
                                                        |
| 63 | + $this->extra_fees_strategy = $extra_fees_strategy;  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | + return $this->extra_fees_strategy;  | 
                                                        |
| 66 | + }  | 
                                                        |
| 67 | 67 | }  | 
                                                        
@@ -30,7 +30,7 @@  | 
                                                    ||
| 30 | 30 | */  | 
                                                        
| 31 | 31 | private function getExtraTxnFeesDistributionStrategy()  | 
                                                        
| 32 | 32 |      { | 
                                                        
| 33 | -        if (! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { | 
                                                        |
| 33 | +        if ( ! $this->extra_fees_strategy instanceof ExtraTxnFeesDistributionStrategyInterface) { | 
                                                        |
| 34 | 34 |              switch ($this->getDistributionStrategy()) { | 
                                                        
| 35 | 35 | case ExtraTxnFeesHandler::STRATEGY_PRIMARY_REGISTRANT_ONLY:  | 
                                                        
| 36 | 36 | $extra_fees_strategy = new ApplyExtraFeesToPrimaryRegistrantOnly();  | 
                                                        
@@ -15,20 +15,20 @@  | 
                                                    ||
| 15 | 15 | */  | 
                                                        
| 16 | 16 | class ApplyExtraFeesToPrimaryRegistrantOnly implements ExtraTxnFeesDistributionStrategyInterface  | 
                                                        
| 17 | 17 |  { | 
                                                        
| 18 | - /**  | 
                                                        |
| 19 | - * @param float $extra_fees  | 
                                                        |
| 20 | - * @param EE_Registration[] $registrations  | 
                                                        |
| 21 | - * @throws EE_Error  | 
                                                        |
| 22 | - * @throws ReflectionException  | 
                                                        |
| 23 | - */  | 
                                                        |
| 24 | - public function applyExtraFeesToRegistrants($extra_fees, array $registrations)  | 
                                                        |
| 25 | -    { | 
                                                        |
| 26 | -        foreach ($registrations as $registration) { | 
                                                        |
| 27 | -            if ($registration instanceof EE_Registration && $registration->is_primary_registrant()) { | 
                                                        |
| 28 | - $primary_registrant_total = $registration->final_price() + $extra_fees;  | 
                                                        |
| 29 | - $registration->set_final_price($primary_registrant_total);  | 
                                                        |
| 30 | - $registration->save();  | 
                                                        |
| 31 | - }  | 
                                                        |
| 32 | - }  | 
                                                        |
| 33 | - }  | 
                                                        |
| 18 | + /**  | 
                                                        |
| 19 | + * @param float $extra_fees  | 
                                                        |
| 20 | + * @param EE_Registration[] $registrations  | 
                                                        |
| 21 | + * @throws EE_Error  | 
                                                        |
| 22 | + * @throws ReflectionException  | 
                                                        |
| 23 | + */  | 
                                                        |
| 24 | + public function applyExtraFeesToRegistrants($extra_fees, array $registrations)  | 
                                                        |
| 25 | +	{ | 
                                                        |
| 26 | +		foreach ($registrations as $registration) { | 
                                                        |
| 27 | +			if ($registration instanceof EE_Registration && $registration->is_primary_registrant()) { | 
                                                        |
| 28 | + $primary_registrant_total = $registration->final_price() + $extra_fees;  | 
                                                        |
| 29 | + $registration->set_final_price($primary_registrant_total);  | 
                                                        |
| 30 | + $registration->save();  | 
                                                        |
| 31 | + }  | 
                                                        |
| 32 | + }  | 
                                                        |
| 33 | + }  | 
                                                        |
| 34 | 34 | }  |