Module: Webmoney::RequestXML
- Included in:
- Webmoney
- Defined in:
- lib/request_xml.rb
Overview
:nodoc:all
Instance Method Summary collapse
- #xml_bussines_level(opt) ⇒ Object
- #xml_check_sign(opt) ⇒ Object
- #xml_create_transaction(opt) ⇒ Object
- #xml_find_wm(opt) ⇒ Object
- #xml_get_passport(opt) ⇒ Object
- #xml_send_message(opt) ⇒ Object
Instance Method Details
#xml_bussines_level(opt) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/request_xml.rb', line 19 def xml_bussines_level(opt) Nokogiri::XML::Builder.new { |x| x.send('WMIDLevel.request') { x.signerwmid @wmid x.wmid opt[:wmid] } } end |
#xml_check_sign(opt) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/request_xml.rb', line 28 def xml_check_sign(opt) plan_out = @ic_out.iconv(opt[:plan]) Nokogiri::XML::Builder.new( :encoding => 'windows-1251' ) { |x| x.send('w3s.request') { x.wmid @wmid x.testsign { x.wmid opt[:wmid] x.plan { x.cdata opt[:plan] } x.sign opt[:sign] } if classic? plan = @wmid + opt[:wmid] + plan_out + opt[:sign] x.sign sign(plan) end } } end |
#xml_create_transaction(opt) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/request_xml.rb', line 85 def xml_create_transaction(opt) req = reqn() desc = @ic_out.iconv(opt[:desc]) # description Nokogiri::XML::Builder.new( :encoding => 'windows-1251' ) { |x| x.send('w3s.request') { x.reqn req x.wmid(@wmid) if classic? x.sign sign(@plan) if classic? x.trans { x.tranid opt[:transid] # transaction id - unique x.pursesrc opt[:pursesrc] # sender purse x.pursedest opt[:pursedest] # recipient purse x.amount opt[:amount] x.period( opt[:period] || 0 ) # protection period (0 - no protection) x.pcode( opt[:pcode].strip ) if opt[:period] > 0 && opt[:pcode] # protection code x.desc desc x.wminvid( opt[:wminvid] || 0 ) # invoice number (0 - without invoice) } } } end |
#xml_find_wm(opt) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/request_xml.rb', line 67 def xml_find_wm(opt) req = reqn() Nokogiri::XML::Builder.new { |x| x.send('w3s.request') { x.wmid @wmid x.reqn req x.testwmpurse do x.wmid( opt[:wmid] || '' ) x.purse( opt[:purse] || '' ) end if classic? @plan = "#{opt[:wmid]}#{opt[:purse]}" x.sign sign(@plan) end } } end |
#xml_get_passport(opt) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/request_xml.rb', line 3 def xml_get_passport(opt) Nokogiri::XML::Builder.new { |x| x.request { x.wmid @wmid x.passportwmid opt[:wmid] x.params { x.dict opt[:dict] || 0 x.info opt[:info] || 1 x.mode opt[:mode] || 0 } # unless mode == 1, signed data need'nt x.sign( (classic? && opt[:mode]) ? sign(@wmid + opt[:wmid]) : nil ) } } end |
#xml_send_message(opt) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/request_xml.rb', line 46 def (opt) req = reqn() msgsubj = @ic_out.iconv(opt[:subj]) msgtext = @ic_out.iconv(opt[:text]) Nokogiri::XML::Builder.new( :encoding => 'windows-1251' ) { |x| x.send('w3s.request') { x.wmid @wmid x.reqn req x. do x.receiverwmid opt[:wmid] x.msgsubj { x.cdata opt[:subj] } x.msgtext { x.cdata opt[:text] } end if classic? @plan = opt[:wmid] + req + msgtext + msgsubj x.sign sign(@plan) end } } end |