def invoice_paid?(invoicenumber)
      # Find invoice
      invoice = Twinfield::Process.new(@session).
        request(:process_xml_document, get_dimension_xml(@company, { invoicenumber: invoicenumber })).
        body[:process_xml_document_response][:process_xml_document_result]

      # Find corresponding transaction
      transaction = find_transaction(invoice[:salesinvoice][:financials][:number])

      begin
        if transaction && transaction[:transaction][:lines][:line].first[:matchstatus] == 'matched'
          true
        else
          false
        end
      rescue
        false
      end
    end
def invoice_paid?(invoicenumber)
      # Find invoice
      invoice = Twinfield::Process.new(@session).
        request(:process_xml_document, get_dimension_xml(@company, { invoicenumber: invoicenumber })).
        body[:process_xml_document_response][:process_xml_document_result]

      # Find corresponding transaction
      transaction = find_transaction(invoice[:salesinvoice][:financials][:number])

      begin
        if transaction && transaction[:transaction][:lines][:line].first[:matchstatus] == 'matched'
          true
        else
          false
        end
      rescue
        false
      end
    end
Check if invoices are paid
 TODO: Check if this works for partial payments