Module: Transbank::Webpay::Validations

Included in:
Response
Defined in:
lib/transbank/webpay/validations.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/transbank/webpay/validations.rb', line 4

def errors
  @errors
end

Instance Method Details

#errors_displayObject



6
7
8
# File 'lib/transbank/webpay/validations.rb', line 6

def errors_display
  errors.join ', '
end

#valid?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/transbank/webpay/validations.rb', line 10

def valid?
  errors.empty?
end

#validate_response!Object



14
15
16
17
18
19
20
21
# File 'lib/transbank/webpay/validations.rb', line 14

def validate_response!
  validate_response_code!
  validate_http_response!

  return if errors.any? || validate_document

  raise Transbank::Webpay::Exceptions::InvalidSignature, 'Invalid signature'
end