module Transbank::Webpay::Reader

Constants

RESPONSE_CODE

Attributes

action[R]
content[R]

Public Instance Methods

attributes?() click to toggle source
# File lib/transbank/webpay/reader.rb, line 41
def attributes?
  xml_return != ""
end
body() click to toggle source
# File lib/transbank/webpay/reader.rb, line 33
def body
  content.body
end
doc() click to toggle source
# File lib/transbank/webpay/reader.rb, line 25
def doc
  @doc ||= Nokogiri::XML body
end
response_code_display() click to toggle source
# File lib/transbank/webpay/reader.rb, line 29
def response_code_display
  RESPONSE_CODE.fetch(action, RESPONSE_CODE[:default]).fetch(xml_response_code, xml_response_code)
end
xml_error_display() click to toggle source
# File lib/transbank/webpay/reader.rb, line 37
def xml_error_display
  xml_error.map { |e| e.text.gsub(/<!--|-->/, '').strip }
end

Private Instance Methods

digest() click to toggle source
# File lib/transbank/webpay/reader.rb, line 67
def digest
  doc.at_xpath("//ds:DigestValue", ds: 'http://www.w3.org/2000/09/xmldsig#').text
end
signature_decode() click to toggle source
# File lib/transbank/webpay/reader.rb, line 51
def signature_decode
  Base64.decode64(signature_node.content)
end
signature_node() click to toggle source
# File lib/transbank/webpay/reader.rb, line 63
def signature_node
  doc.at_xpath('//ds:SignatureValue', ds: 'http://www.w3.org/2000/09/xmldsig#')
end
signed_node() click to toggle source
# File lib/transbank/webpay/reader.rb, line 71
def signed_node
  doc.at_xpath '//ds:SignedInfo', ds: 'http://www.w3.org/2000/09/xmldsig#'
end
xml_error() click to toggle source
# File lib/transbank/webpay/reader.rb, line 55
def xml_error
  doc.xpath("//faultstring")
end
xml_response_code() click to toggle source
# File lib/transbank/webpay/reader.rb, line 59
def xml_response_code
  doc.xpath("//responseCode").text
end
xml_return() click to toggle source
# File lib/transbank/webpay/reader.rb, line 47
def xml_return
  @xml_return ||= doc.at_xpath("//return").to_s
end