class Sepa::OpResponse

Handles OP specific response logic. Mainly certificate specific stuff.

Constants

BYPASS_COMMANDS

Public Instance Methods

certificate_is_trusted?() click to toggle source

Checks whether the certificate embedded in the response soap has been signed with OP's root certificate. The check is skipped in test environment, because a different root certificate is used. The check is also skipped for certificate requests because they are not signed

@return [true] if certificate is trusted @return [false] if certificate fails to verify @see DanskeResponse#certificate_is_trusted?

# File lib/sepa/banks/op/op_response.rb, line 49
def certificate_is_trusted?
  return true if environment == :test || BYPASS_COMMANDS.include?(command)

  verify_certificate_against_root_certificate(certificate, OP_ROOT_CERTIFICATE)
end
own_signing_certificate() click to toggle source

Extracts own signing certificate from the response.

@return [String] own signing certificate as string it it is found @return [nil] if the certificate cannot be found

# File lib/sepa/banks/op/op_response.rb, line 15
def own_signing_certificate
  application_response = extract_application_response(OP_PKI)
  at                   = 'xmlns|Certificate > xmlns|Certificate'
  node                 = Nokogiri::XML(application_response).at(at, xmlns: OP_XML_DATA)

  return unless node

  cert_value = process_cert_value node.content
  cert       = x509_certificate cert_value
  cert.to_s
end
response_code() click to toggle source

@see Response#response_code

Calls superclass method
# File lib/sepa/banks/op/op_response.rb, line 28
def response_code
  return super unless [:get_certificate, :get_service_certificates].include? command

  super(namespace: OP_PKI)
end
response_text() click to toggle source

@see Response#response_text

Calls superclass method
# File lib/sepa/banks/op/op_response.rb, line 35
def response_text
  return super unless [:get_certificate, :get_service_certificates].include? command

  super(namespace: OP_PKI)
end
validate_hashes() click to toggle source

Some OP's certificate responses aren't signed

Calls superclass method
# File lib/sepa/banks/op/op_response.rb, line 56
def validate_hashes
  super unless BYPASS_COMMANDS.include?(command)
end
verify_signature() click to toggle source

Some OP's certificate responses aren't signed

Calls superclass method
# File lib/sepa/banks/op/op_response.rb, line 61
def verify_signature
  super unless BYPASS_COMMANDS.include?(command)
end