Class: CCBill::Postback

Inherits:
Object
  • Object
show all
Defined in:
lib/ccbill_ruby/postback.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response_params = {}) ⇒ Postback

Returns a new instance of Postback.



5
6
7
# File 'lib/ccbill_ruby/postback.rb', line 5

def initialize(response_params = {})
  self.response_params = response_params
end

Instance Attribute Details

#response_paramsObject

Returns the value of attribute response_params.



3
4
5
# File 'lib/ccbill_ruby/postback.rb', line 3

def response_params
  @response_params
end

Instance Method Details

#approval?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/ccbill_ruby/postback.rb', line 9

def approval?
  !denial?
end

#denial?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
# File 'lib/ccbill_ruby/postback.rb', line 13

def denial?
  [:reasonForDeclineCode, :reasonForDecline, :denialId].any? do |key|
    !response_params[key].to_s.strip.empty?
  end
end

#verified?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/ccbill_ruby/postback.rb', line 19

def verified?
  fail 'NOTE: Does not work on test env - Did not check for production.'
  response_params[:responseDigest] == encode_digest_response
end