Class: OmniKassa::Response
- Inherits:
-
Object
- Object
- OmniKassa::Response
- Defined in:
- lib/omni_kassa/response.rb
Defined Under Namespace
Classes: ResponseCodeError, SealMismatchError
Constant Summary collapse
- RESPONSE_CODES =
{ 0 => :success, 17 => :cancelled, 60 => :pending, 90 => :pending, 97 => :expired }
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#data ⇒ Object
Returns the value of attribute data.
-
#order_id ⇒ Object
Returns the value of attribute order_id.
-
#response_code ⇒ Object
Returns the value of attribute response_code.
-
#seal ⇒ Object
Returns the value of attribute seal.
Instance Method Summary collapse
-
#initialize(params) ⇒ Response
constructor
A new instance of Response.
- #pending? ⇒ Boolean
- #response ⇒ Object
- #successful? ⇒ Boolean
Constructor Details
#initialize(params) ⇒ Response
Returns a new instance of Response.
13 14 15 16 17 18 |
# File 'lib/omni_kassa/response.rb', line 13 def initialize(params) self.data = params[:Data] self.seal = params[:Seal] verify_seal! end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
11 12 13 |
# File 'lib/omni_kassa/response.rb', line 11 def amount @amount end |
#data ⇒ Object
Returns the value of attribute data.
11 12 13 |
# File 'lib/omni_kassa/response.rb', line 11 def data @data end |
#order_id ⇒ Object
Returns the value of attribute order_id.
11 12 13 |
# File 'lib/omni_kassa/response.rb', line 11 def order_id @order_id end |
#response_code ⇒ Object
Returns the value of attribute response_code.
11 12 13 |
# File 'lib/omni_kassa/response.rb', line 11 def response_code @response_code end |
#seal ⇒ Object
Returns the value of attribute seal.
11 12 13 |
# File 'lib/omni_kassa/response.rb', line 11 def seal @seal end |
Instance Method Details
#pending? ⇒ Boolean
20 21 22 |
# File 'lib/omni_kassa/response.rb', line 20 def pending? response == :pending end |
#response ⇒ Object
28 29 30 |
# File 'lib/omni_kassa/response.rb', line 28 def response RESPONSE_CODES[response_code] || :unknown_failure end |
#successful? ⇒ Boolean
24 25 26 |
# File 'lib/omni_kassa/response.rb', line 24 def successful? response == :success end |