Exception: Rubykassa::ConfigurationError

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

Constant Summary collapse

ENV_MESSAGE =
'Invalid mode: only :test or :production are allowed'.freeze
HTTP_METHOD_MESSAGE =
'Invalid http method: only :get or :post are allowed'.freeze
HASH_ALGORITHM_MESSAGE =
<<-MESSAGE.squish.freeze
  Invalid hash algorithm: only
  #{Configuration::HASH_ALGORITHMS.map(&:upcase).join ', '} are allowed
MESSAGE

Class Method Summary collapse

Class Method Details

.raise_errors_for(configuration) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/rubykassa/client.rb', line 14

def self.raise_errors_for(configuration)
  if !configuration.correct_mode?
    raise ConfigurationError, ENV_MESSAGE
  end
  if !configuration.correct_http_method? ||
      !configuration.correct_xml_http_method?
    raise ConfigurationError, HTTP_METHOD_MESSAGE
  end
  if !configuration.correct_hash_algorithm?
    raise ConfigurationError, HASH_ALGORITHM_MESSAGE
  end
end