Sha256: d43a53350ed25b8677a8f4c5a78334b2716625c9a8e0cb5357983a8d36557b07

Contents?: true

Size: 1012 Bytes

Versions: 1

Compression:

Stored size: 1012 Bytes

Contents

# frozen_string_literal: true

module Spree
  module Admin
    class BoltsController < Spree::Admin::BaseController
      before_action :bolt_configuration

      def show; end

      def edit; end

      def update
        if @bolt_configuration.update(bolt_configuration_params)
          flash[:success] = t('spree.admin.bolt.updated_successfully')
          redirect_to admin_bolt_path
        else
          flash[:error] = @bolt_configuration.errors.full_messages.to_sentence
          render :edit
        end
      end

      private

      def bolt_configuration
        @bolt_configuration = SolidusBolt::BoltConfiguration.fetch
      end

      def bolt_configuration_params
        params
          .require(:solidus_bolt_bolt_configuration)
          .permit(
            :bearer_token,
            :environment,
            :merchant_public_id,
            :division_public_id,
            :api_key,
            :signing_secret,
            :publishable_key
          )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solidus_bolt-0.0.1 app/controllers/spree/admin/bolts_controller.rb