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 format_response(response)
      resp = Nokogiri::XML(response)
      message = resp.xpath('//invoice_error').text
      message ||= resp.xpath('//error').text
      instance = {
        sales_invoice_number: resp.xpath('//sales_invoice_number').text,
        journal_number: resp.xpath('//journal_number').text
      }
      if message.empty?
        success_response('ok', instance)
      else
        failed_response(message, instance)
      end
    end
def format_response ( response ) resp = Nokogiri :: XML ( response ) message = resp . xpath ( '//invoice_error' ) . text message ||= resp . xpath ( '//error' ) . text instance = { sales_invoice_number : resp . xpath ( '//sales_invoice_number' ) . text , journal_number : resp . xpath ( '//journal_number' ) . text } if message . empty? success_response ( 'ok' , instance ) else failed_response ( message , instance ) end 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 .
response
<not_specific>
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 .