#encoding: utf-8 module Webmoney::RequestResult # :nodoc:all def result_check_sign(doc) doc.at('//testsign/res').inner_html == 'yes' ? true : false end def result_get_passport(doc) Webmoney::Passport.parse_result(doc) end def result_bussines_level(doc) doc.at('//level').inner_html.to_i end def result_send_message(doc) time = doc.at('//message/datecrt').inner_html m = time.match(/(\d{4})(\d{2})(\d{2}) (\d{2}):(\d{2}):(\d{2})/) time = Time.mktime(*m[1..6]) { :id => doc.at('//message')['id'], :date => time } end def result_find_wm(doc) { :retval => doc.at('//retval').inner_html.to_i, :wmid => (doc.at('//testwmpurse/wmid').inner_html rescue nil), :purse => (doc.at('//testwmpurse/purse').inner_html rescue nil) } end def result_create_transaction(doc) op = doc.at('//operation') { :operation_id => op['id'], :operation_ts => op['ts'] }.merge( op.children.inject({}) do |memo, elm| memo.merge!(elm.name.to_sym => elm.text) end ) end end