Sha256: 1a60e024ab042ef2433d45d41546b5f6fbbf59c6d451d512d3c76f9bbec9c333
Contents?: true
Size: 1.42 KB
Versions: 27
Compression:
Stored size: 1.42 KB
Contents
module Comee module Core class CustomerOrdersController < ApplicationController include Common before_action :set_service, only: %i[submit submit_for_confirmation accept cancel] def submit order = @service.submit(params[:id]) render json: {success: true, data: serialize(order)} rescue StandardError => e render json: {success: false, error: e.message} end def submit_for_confirmation order = @service.submit_for_confirmation(params[:id]) render json: {success: true, data: serialize(order)} rescue StandardError => e render json: {success: false, error: e.message} end def accept order = @service.accept(params[:id]) render json: {success: true, data: serialize(order)} rescue StandardError => e render json: {success: false, error: e.message} end def cancel order = @service.cancel(params[:id]) render json: {success: true, data: serialize(order)} rescue StandardError => e render json: {success: false, error: e.message} end private def model_params params.require(:payload).permit(:order_number, :order_date, :order_terms, :delivery_address, :invoice_address, :status, :client_id, :file) end def set_service @service = CustomerOrderService.new end end end end
Version data entries
27 entries across 27 versions & 1 rubygems