lib/pack_material/services/complete_purchase_invoice.rb
def format_response(response)
      resp = Nokogiri::XML(response)
      message = resp.xpath('//error').text
      instance = {
        purchase_order_number: resp.xpath('//purchase_order_number').text,
        purchase_invoice_number: resp.xpath('//purchase_invoice_number').text
      }
      if message.empty?
        success_response('ok', instance)
      else
        failed_response(message, instance)
      end
    end
# rubocop:disable Metrics/ClassLength
# Complete a purchase invoice 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 opts [Hash] { delivery_id [integer], mr_goods_returned_note_id [integer] }
# @param just_show_xml [bool] set to true to just return XML from the call without updating the db.
disable Metrics/ClassLength
Complete a purchase invoice 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 purchase invoice 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('//error').text
      instance = {
        purchase_order_number: resp.xpath('//purchase_order_number').text,
        purchase_invoice_number: resp.xpath('//purchase_invoice_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 ( '//error' ) . text instance = { purchase_order_number : resp . xpath ( '//purchase_order_number' ) . text , purchase_invoice_number : resp . xpath ( '//purchase_invoice_number' ) . text } if message . empty? success_response ( 'ok' , instance ) else failed_response ( message , instance ) end end
rubocop:disable Metrics/ClassLength
Complete a purchase invoice and send XML representation to accounting system.
rubocop : disable Metrics / ClassLength Complete a purchase invoice and send XML representation to accounting system .
response
user_name
the user who initiated this task.
the user who initiated this task .
opts
{ delivery_id [integer], mr_goods_returned_note_id [integer] }
{ delivery_id [ integer ] mr_goods_returned_note_id [ integer ] }
just_show_xml
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 .