def convert(remove_ns = false)
      organization = @gateway.fetch_organization['organization']

      builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8')
      builder[:ofx].OFX('xmlns:ofx' => 'http://ofx.net/types/2003/04') do |xml|
        add_signonmsgsrsv1_block xml

        xml.BANKMSGSRSV1 do
          xml.parent.namespace = nil
          organization['bank_accounts'].each do |bank_account|
            xml.STMTTRNRS do
              xml.TRNUID 1
              add_status_block xml

              xml.STMTRS do
                xml.CURDEF 'EUR'
                add_bankacctfrom_block xml, bank_account

                xml.BANKTRANLIST do
                  process_transactions xml, bank_account
                end

                xml.LEDGERBAL do
                  xml.BALAMT bank_account['balance']
                  xml.DTASOF Time.now.strftime('%Y%m%d%H%M%S')
                end
              end
            end
          end
        end
      end

      move_to_first_position(builder, '//DTEND')
      move_to_first_position(builder, '//DTSTART')


      result = builder.to_xml
      raise 'generation failed (invalid OFX)' unless @ofx_validator.valid? result
      result = result.gsub(
        'ofx:OFX',
        'OFX'
      ).gsub(' xmlns:ofx="http://ofx.net/types/2003/04"', '') if remove_ns
      result
    end
def convert(remove_ns = false)
      organization = @gateway.fetch_organization['organization']

      builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8')
      builder[:ofx].OFX('xmlns:ofx' => 'http://ofx.net/types/2003/04') do |xml|
        add_signonmsgsrsv1_block xml

        xml.BANKMSGSRSV1 do
          xml.parent.namespace = nil
          organization['bank_accounts'].each do |bank_account|
            xml.STMTTRNRS do
              xml.TRNUID 1
              add_status_block xml

              xml.STMTRS do
                xml.CURDEF 'EUR'
                add_bankacctfrom_block xml, bank_account

                xml.BANKTRANLIST do
                  process_transactions xml, bank_account
                end

                xml.LEDGERBAL do
                  xml.BALAMT bank_account['balance']
                  xml.DTASOF Time.now.strftime('%Y%m%d%H%M%S')
                end
              end
            end
          end
        end
      end

      move_to_first_position(builder, '//DTEND')
      move_to_first_position(builder, '//DTSTART')


      result = builder.to_xml
      raise 'generation failed (invalid OFX)' unless @ofx_validator.valid? result
      result = result.gsub(
        'ofx:OFX',
        'OFX'
      ).gsub(' xmlns:ofx="http://ofx.net/types/2003/04"', '') if remove_ns
      result
    end
valid_ofx = false removes the namespaces