Class: Wirecard::Elastic::Request::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/wirecard/elastic/request/base.rb

Direct Known Subclasses

Refund, Transaction

Constant Summary collapse

VALID_STATUS_LIST =
[:success, :failed].freeze

Instance Method Summary collapse

Instance Method Details

#safeObject Also known as: raise_response_issues

calling #safe will check if the transaction was successful or/and valid and raise an error if not ; this is a useful shortcut when manipulating the datas at a upper level



11
12
13
14
15
16
17
18
19
# File 'lib/wirecard/elastic/request/base.rb', line 11

def safe
  unless valid_status?
    raise Wirecard::Elastic::Error, "The status of the transaction is not correct (#{response.request_status})"
  end
  if negative_response?
    raise Wirecard::Elastic::Error, "The transaction could not be verified. API access refused."
  end
  self
end