module Agris::Api::AccountsPayables::Vouchers

Public Instance Methods

create_voucher(voucher) click to toggle source
# File lib/agris/api/accounts_payables.rb, line 7
def create_voucher(voucher)
  response = @request.process_message(
    Gyoku.xml(xml: context_hash),
    82_320,
    create_post_payload_xml(convert_voucher_to_details(voucher))
  )

  PostResult.new(response)
end

Protected Instance Methods

convert_voucher_to_details(voucher) click to toggle source

NB: We should probably refactor this into a class and write tests

to verify conversion of a sales model to an expected payload.
# File lib/agris/api/accounts_payables.rb, line 21
def convert_voucher_to_details(voucher)
  details = []
  details << voucher.to_xml_hash
  details << voucher.details.map(&:to_xml_hash)
  details
end