Class: Rubykassa::XmlInterface

Inherits:
Object
  • Object
show all
Defined in:
lib/rubykassa/xml_interface.rb

Constant Summary collapse

BASE_URL =
'https://auth.robokassa.ru/Merchant/WebService/Service.asmx/'.freeze
INVALID_RESPONSE_ERROR_MESSAGE =
'Invalid response from the service'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ XmlInterface

Returns a new instance of XmlInterface.

Yields:

  • (_self)

Yield Parameters:



15
16
17
# File 'lib/rubykassa/xml_interface.rb', line 15

def initialize(&block)
  yield self if block_given?
end

Instance Attribute Details

#invoice_idObject

Returns the value of attribute invoice_id.



13
14
15
# File 'lib/rubykassa/xml_interface.rb', line 13

def invoice_id
  @invoice_id
end

#languageObject

Returns the value of attribute language.



13
14
15
# File 'lib/rubykassa/xml_interface.rb', line 13

def language
  @language
end

#totalObject

Returns the value of attribute total.



13
14
15
# File 'lib/rubykassa/xml_interface.rb', line 13

def total
  @total
end

Instance Method Details

#get_currenciesObject



19
20
21
22
23
24
# File 'lib/rubykassa/xml_interface.rb', line 19

def get_currencies
  request transform_method_name(__method__),
          'MerchantLogin' => Rubykassa.,
          'Language' => @language,
          'isTest' => test_mode_param
end

#get_payment_methodsObject



26
27
28
29
30
31
# File 'lib/rubykassa/xml_interface.rb', line 26

def get_payment_methods
  request transform_method_name(__method__),
          'MerchantLogin' => Rubykassa.,
          'Language' => @language,
          'isTest' => test_mode_param
end

#get_ratesObject



33
34
35
36
37
38
39
40
# File 'lib/rubykassa/xml_interface.rb', line 33

def get_rates
  request transform_method_name(__method__),
          'MerchantLogin' => Rubykassa.,
          'IncCurrLabel' => '',
          'OutSum' => @total.to_s,
          'Language' => @language,
          'isTest' => test_mode_param
end

#op_state(additional_params = {}) ⇒ Object



42
43
44
45
46
47
48
49
# File 'lib/rubykassa/xml_interface.rb', line 42

def op_state(additional_params = {})
  params = { 'MerchantLogin' => Rubykassa.,
             'InvoiceID' => @invoice_id.to_s,
             'Signature' => generate_signature,
             'isTest' => test_mode_param }
  params.merge! additional_params if test_mode?
  request transform_method_name(__method__), params
end