Class: Payzilla::Gateways::Webmoney

Inherits:
Gateway
  • Object
show all
Defined in:
lib/payzilla/gateways/webmoney.rb

Defined Under Namespace

Classes: Signer

Instance Attribute Summary

Attributes inherited from Gateway

#config, #logger, #revision_page_size

Instance Method Summary collapse

Methods inherited from Gateway

available_attachments, available_settings, available_switches, can_list_providers, #can_list_providers?, can_list_providers?, #initialize, register_attachments, register_settings, register_switches, require_payment_fields, required_payment_fields, requires_revision, requires_revision?, #requires_revision?, #revise

Constructor Details

This class inherits a constructor from Payzilla::Gateways::Gateway

Instance Method Details

#check(payment) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/payzilla/gateways/webmoney.rb', line 18

def check(payment)
  begin 
    result = send 'XMLBankGatewaysInputAccess1',
      :sign => signer.sign("#{@config.setting_wmid}100#{payment.fields['purse']}#{payment.fields['phone']}#{@config.setting_kiosk_id}"),
      :'attributes!' => {
        :sign => {
          :type => 1
        }
      },
      :payment => {
        :price => 100,
        :purse => payment.fields['purse'],
        :phone => payment.fields['phone']
      }

    return retval(result['retval'])
  rescue Errno::ECONNRESET
    return retval(-1000)
  end
end

#pay(payment) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/payzilla/gateways/webmoney.rb', line 39

def pay(payment)
  begin 
    result = send 'XMLBankGatewaysInput',
      :sign => signer.sign("#{payment.id}#{payment.enrolled_amount}#{payment.id}#{payment.fields['purse']}#{payment.fields['phone']}"),
      :attributes! => {
        :sign => {
          :type => 1
        },
        :payment => {
          :id => payment.id,
          :test => @config.switch_test_mode
        }
      },
      :payment => {
        :name => payment.fields['name'],
        :passport_serie => payment.fields['passport_serie'],
        :passport_number => payment.fields['passport_number'],
        :passport_date => payment.fields['passport_date'],
        :price => payment.enrolled_amount,
        :purse => payment.fields['purse'],
        :cheque => payment.id,
        :date => payment.created_at,
        :kiosk_id => @config.setting_kiosk_id,
        :phone => payment.fields['phone']
      }

    return retval(result['retval'], result['payment']['wmtranid'])
  rescue Errno::ECONNRESET
    return retval(-1000)
  end
end