Sha256: 6afff722fb70d49631daf4d8eaf4ed59923eed5738f6492f6e0cda8a8cbbda3a

Contents?: true

Size: 632 Bytes

Versions: 2

Compression:

Stored size: 632 Bytes

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-global_e-1.3.0 app/controllers/workarea/storefront/checkouts_controller.decorator
workarea-global_e-1.2.1 app/controllers/workarea/storefront/checkouts_controller.decorator