module Workarea decorate Storefront::CheckoutsController, with: :global_e do decorated { before_action :route_global_e_order, if: :is_operated_by_global_e? } private def route_global_e_order current_checkout.reset! current_order.update_attributes(user_id: current_user.id) if current_user.present? Pricing.perform(current_order) redirect_to ge_checkout_path end def global_e_cookie JSON.parse cookies[:GlobalE_Data] rescue {} end def is_operated_by_global_e? cookies.fetch(:GlobalE_IsOperated, 'false').casecmp?('true') end end end