From b585172ce3c187f02815dbf9b43a9fb1887a821d Mon Sep 17 00:00:00 2001 From: Thein Lin Kyaw Date: Mon, 27 Jan 2020 18:13:10 +0630 Subject: [PATCH] uncomment action controller --- app/controllers/api/shops_controller.rb | 3 +- config/initializers/action_controller.rb | 46 ++++++++++++------------ 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/app/controllers/api/shops_controller.rb b/app/controllers/api/shops_controller.rb index af22cab0..e9023cd2 100644 --- a/app/controllers/api/shops_controller.rb +++ b/app/controllers/api/shops_controller.rb @@ -8,7 +8,8 @@ class Api::ShopsController < Api::ApiController def show @shop = Shop.find_by_shop_code(params[:id]) end + def get_tax_profiles - @inclusive_tax,@exclusive_tax =TaxProfile.calculate_tax("online_order") + @inclusive_tax,@exclusive_tax = TaxProfile.calculate_tax("online_order") end end diff --git a/config/initializers/action_controller.rb b/config/initializers/action_controller.rb index 0317c2a6..dfcf041d 100644 --- a/config/initializers/action_controller.rb +++ b/config/initializers/action_controller.rb @@ -4,29 +4,29 @@ class ActionController::Base private def lookup_domain - # if request.subdomains.last && request.subdomains.last != "www" && ENV["SERVER_MODE"] == "cloud" - # @license = cache_license(ENV["SX_PROVISION_URL"], request.host) # request.subdomain.downcase - # if (!@license.nil?) - # logger.info "Location - " + @license.dbschema - # ActiveRecord::Base.establish_connection(website_connection(@license)) - # # authenticate_session_token - # # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema - # else - # # reconnect_default_db - # logger.info 'License is nil' - # # redirect_to root_url(:host => request.domain) + "store_error" - # render :json => [{ status: false, message: 'Invalid Access!'}] - # end - # elsif request.subdomains.last && request.subdomains.last != "www" || ENV["SERVER_MODE"] == "application" - # # check for license file - # if check_license(request.host) - # current_license(ENV["SX_PROVISION_URL"], request.host) - # else - # redirect_to activate_path - # end - # else - # not_found - # end + if request.subdomains.last && request.subdomains.last != "www" && ENV["SERVER_MODE"] == "cloud" + @license = cache_license(ENV["SX_PROVISION_URL"], request.host) # request.subdomain.downcase + if (!@license.nil?) + logger.info "Location - " + @license.dbschema + ActiveRecord::Base.establish_connection(website_connection(@license)) + # authenticate_session_token + # logger.info "Connecting to - " + @license.subdomain + " - "+ @license.dbhost + "@" + @license.dbschema + else + # reconnect_default_db + logger.info 'License is nil' + # redirect_to root_url(:host => request.domain) + "store_error" + render :json => [{ status: false, message: 'Invalid Access!'}] + end + elsif request.subdomains.last && request.subdomains.last != "www" || ENV["SERVER_MODE"] == "application" + # check for license file + if check_license(request.host) + current_license(ENV["SX_PROVISION_URL"], request.host) + else + redirect_to activate_path + end + else + not_found + end end def not_found