lib/pack_material/services/complete_sales_order.rb
# rubocop:disable Metrics/ClassLength
# Complete a sales order and send XML representation to accounting system.
# - use the `just_show_xml` flag to check the XML output without modifying the db.
#
# @param user_name [string] the user who initiated this task.
# @param [Integer] mr_sales_order_id
# @param just_show_xml [bool] set to true to just return XML from the call without updating the db.
disable Metrics/ClassLength
Complete a sales order and send XML representation to accounting system.
use the `just_show_xml` flag to check the XML output without modifying the db.
disable Metrics / ClassLength Complete a sales order and send XML representation to accounting system . use the ` just_show_xml ` flag to check the XML output without modifying the db .
def call  
      return failed_response('Sales Order does not exist') unless @sales_order
      return failed_response('Sales Return does not exist') if @sales_return_id && !sales_return_exists?
      request_xml = @sales_return_id ? build_sor_xml : build_xml
      return request_xml if @just_show_xml
      log_string = @sales_return_id ? '_sor_xml' : '_so_xml'
      @log_repo.log_infodump('complete_sales_order', @id, 'sending' + log_string, request_xml)
      res = make_http_call(request_xml)
      @log_repo.log_infodump('complete_sales_order', @id, 'response' + log_string, res.instance.body)
      formatted_res = format_response(res.instance.body)
      @sales_return_id ? apply_sales_return_changes(formatted_res) : apply_changes(formatted_res)
    end
def call return failed_response ( 'Sales Order does not exist' ) unless @sales_order return failed_response ( 'Sales Return does not exist' ) if @sales_return_id && ! sales_return_exists? request_xml = @sales_return_id ? build_sor_xml : build_xml return request_xml if @just_show_xml log_string = @sales_return_id ? '_sor_xml' : '_so_xml' @log_repo . log_infodump ( 'complete_sales_order' , @id , 'sending' + log_string , request_xml ) res = make_http_call ( request_xml ) @log_repo . log_infodump ( 'complete_sales_order' , @id , 'response' + log_string , res . instance . body ) formatted_res = format_response ( res . instance . body ) @sales_return_id ? apply_sales_return_changes ( formatted_res ) : apply_changes ( formatted_res ) end
rubocop:disable Metrics/ClassLength
Complete a sales order and send XML representation to accounting system.
rubocop : disable Metrics / ClassLength Complete a sales order and send XML representation to accounting system .
# rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
user_name
<not_specific>
the user who initiated this task.
the user who initiated this task .
<not_specific>
None
just_show_xml
<not_specific>
set to true to just return XML from the call without updating the db.
set to true to just return XML from the call without updating the db .