/**
  * 	_submit_promo_code
  *
  * @access        private
  * @return        void
  */
 private function _submit_promo_code()
 {
     $return_data = array();
     // get the EE_Cart object being used for the current transaction
     /** @type EE_Cart $cart */
     $cart = EE_Registry::instance()->SSN->cart();
     if ($cart instanceof EE_Cart) {
         // and make sure the model cache is
         $cart->get_grand_total()->get_model()->refresh_entity_map_with($cart->get_grand_total()->ID(), $cart->get_grand_total());
         $promotion = $this->get_promotion_details_from_request();
         if ($promotion instanceof EE_Promotion) {
             // determine if the promotion can be applied to an item in the current cart
             $applicable_items = $this->get_applicable_items($promotion, $cart, false, true);
             if (!empty($applicable_items)) {
                 // add line item
                 if ($this->generate_promotion_line_items($promotion, $applicable_items, $this->_config->affects_tax())) {
                     // ensure cart totals have been recalculated and saved
                     $cart->get_grand_total()->recalculate_total_including_taxes();
                     $cart->get_grand_total()->save();
                     /** @type EE_Registration_Processor $registration_processor */
                     $registration_processor = EE_Registry::instance()->load_class('Registration_Processor');
                     $registration_processor->update_registration_final_prices($cart->get_grand_total()->transaction());
                     $cart->save_cart(false);
                     $return_data = $this->_get_payment_info($cart);
                     $return_data['success'] = $promotion->accept_message();
                     EED_Single_Page_Checkout::update_checkout();
                 } else {
                     EE_Error::add_attention($promotion->decline_message(), __FILE__, __FUNCTION__, __LINE__);
                 }
             }
         }
     } else {
         EE_Error::add_error(sprintf(apply_filters('FHEE__EED_Promotions___submit_promo_code__invalid_cart_notice', __('We\'re sorry, but the %1$s could not be applied because the event cart could not be retrieved.', 'event_espresso')), strtolower($this->_config->label->singular)), __FILE__, __FUNCTION__, __LINE__);
     }
     $this->generate_JSON_response($return_data);
 }