Class: Workarea::Storefront::GlobalEController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/workarea/storefront/global_e_controller.rb

Instance Method Summary collapse

Instance Method Details

#get_checkout_cart_infoObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/workarea/storefront/global_e_controller.rb', line 4

def get_checkout_cart_info
  if checkout_cart_info_params[:countryCode].present? || checkout_cart_info_params[:MerchantGUID].present?
    order.update_attribute(:checkout_started_at, Time.current)
  end

  if checkout_cart_info_params[:IsStockValidation]
    InventoryAdjustment.new(order).tap(&:perform)
  end

  # GlobalE overriding fixed pricing for the order
  #
  if checkout_cart_info_params[:isFixedPriceSupported].present? &&
      checkout_cart_info_params[:isFixedPriceSupported].to_s == "false"
    order.update_attribute(:fixed_pricing, false)
  end

  render json: Workarea::GlobalE::CheckoutCartInfo.new(order).to_json
end