Sha256: cfd515b82f8b8e34ea42822e34fc0a011b195415f2c7389b71bb1a9851c9a94a

Contents?: true

Size: 1.87 KB

Versions: 59

Compression:

Stored size: 1.87 KB

Contents

module Comee
  module Core
    class CustomsDetailsController < ApplicationController
      include Common

      def filter
        customs_details = Comee::Core::CustomsDetail.includes(:sales_order).ransack(params[:q]).result
        render_content(customs_details)
      end

      def send_customs_details
        service = BeoService.new(publish_params[:ids])
        data = service.send_customs_details
        render json: {success: true, data: data}
      rescue StandardError => e
        render json: {success: false, error: e.message}, status: 422
      end

      def generate_beo_xml
        service = BeoService.new(publish_params[:ids])
        data = service.preprocess_data(xml: true)
        render json: {success: true, data: data}
      rescue StandardError => e
        render json: {success: false, error: e.message}, status: 422
      end

      private

      def publish_params
        params.require(:payload).permit(
          ids: []
        )
      end

      def model_params
        params.require(:payload).permit(
          :registration_type,
          :export_declaration_type,
          :participant_constellation,
          :mode_of_transport_type,
          :type_of_identification,
          :destination_country,
          :containerized,
          :additional_identifier,
          :packaging_type,
          :export_customs_office,
          :customs_office_of_exit,
          :mode_of_transport,
          :mode_of_transport_at_border,
          :delivery_term_code,
          :nationality,
          :mode_of_transport_nationality,
          :mrn,
          :office_number,
          :quantity,
          :characters_numbers,
          :closure_mark1,
          :closure_mark2,
          :closure_mark3,
          :closure_mark4,
          :closure_mark5,
          :sales_order_id,
          transportation_route: %i[order route value]
        )
      end
    end
  end
end

Version data entries

59 entries across 59 versions & 1 rubygems

Version Path
comee_core-0.3.62 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.61 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.60 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.59 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.58 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.57 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.56 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.55 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.54 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.53 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.51 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.50 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.49 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.48 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.47 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.46 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.45 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.44 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.43 app/controllers/comee/core/customs_details_controller.rb
comee_core-0.3.42 app/controllers/comee/core/customs_details_controller.rb