class ActiveMerchant::Billing::BpointGateway::BPointResponse

Attributes

gateway[R]
params[R]
xml_doc[R]

Public Class Methods

new(xml_doc, gateway) click to toggle source
# File lib/active_merchant/billing/gateways/bpoint.rb, line 206
def initialize(xml_doc, gateway)
  @xml_doc = xml_doc
  @gateway = gateway
  @params = init_params
end

Public Instance Methods

to_response() click to toggle source
# File lib/active_merchant/billing/gateways/bpoint.rb, line 212
def to_response
  Response.new(success?, message, params, options)
end

Private Instance Methods

init_params() click to toggle source
# File lib/active_merchant/billing/gateways/bpoint.rb, line 218
def init_params
  {}.tap do |h|
    xml_doc.xpath(response_node).each do |node|
      if node.elements.empty?
        h[node.name.to_sym] = node.text
      else
        node.elements.each do |childnode|
          name = "#{node.name}_#{childnode.name}"
          h[name.to_sym] = childnode.text
        end
      end
    end
  end
end
options() click to toggle source
# File lib/active_merchant/billing/gateways/bpoint.rb, line 237
def options
  { authorization: params[authorization_key], test: gateway.test? }
end
response_node() click to toggle source
# File lib/active_merchant/billing/gateways/bpoint.rb, line 233
def response_node
  "//#{self.class.name.split('::').last}/*"
end