Class: Transbank::Onepay::TransactionCreateResponse
- Inherits:
-
Object
- Object
- Transbank::Onepay::TransactionCreateResponse
- Includes:
- Response
- Defined in:
- lib/transbank/sdk/onepay/responses/transaction_create_response.rb
Overview
Serializes the response to a TransactionCreateRequest
Constant Summary collapse
- SIGNATURE_PARAMS =
[:occ, :external_unique_number, :issued_at].freeze
Instance Attribute Summary collapse
-
#external_unique_number ⇒ Object
Returns the value of attribute external_unique_number.
-
#issued_at ⇒ Object
Returns the value of attribute issued_at.
-
#occ ⇒ Object
Returns the value of attribute occ.
-
#ott ⇒ Object
Returns the value of attribute ott.
-
#qr_code_as_base64 ⇒ Object
Returns the value of attribute qr_code_as_base64.
-
#signature ⇒ Object
Returns the value of attribute signature.
Attributes included from Response
Instance Method Summary collapse
-
#initialize(json) ⇒ TransactionCreateResponse
constructor
A new instance of TransactionCreateResponse.
- #sign(secret) ⇒ Object
Methods included from Response
#full_description, #response_ok?
Methods included from Utils::SignatureUtils
#hmac_sha256, #signature_for, #to_data, #valid_signature?
Methods included from Utils::JSONUtils
included, #jsonify, #transform_hash_keys, #underscore
Constructor Details
#initialize(json) ⇒ TransactionCreateResponse
Returns a new instance of TransactionCreateResponse.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/transbank/sdk/onepay/responses/transaction_create_response.rb', line 14 def initialize(json) result = json.fetch('result') @response_code = json.fetch('responseCode') @description = json.fetch('description') @occ = result.fetch('occ') @ott = result.fetch('ott') @external_unique_number = result.fetch('externalUniqueNumber') @qr_code_as_base64 = result.fetch('qrCodeAsBase64') @issued_at = result.fetch('issuedAt') @signature = result.fetch('signature') end |
Instance Attribute Details
#external_unique_number ⇒ Object
Returns the value of attribute external_unique_number.
7 8 9 |
# File 'lib/transbank/sdk/onepay/responses/transaction_create_response.rb', line 7 def external_unique_number @external_unique_number end |
#issued_at ⇒ Object
Returns the value of attribute issued_at.
7 8 9 |
# File 'lib/transbank/sdk/onepay/responses/transaction_create_response.rb', line 7 def issued_at @issued_at end |
#occ ⇒ Object
Returns the value of attribute occ.
7 8 9 |
# File 'lib/transbank/sdk/onepay/responses/transaction_create_response.rb', line 7 def occ @occ end |
#ott ⇒ Object
Returns the value of attribute ott.
7 8 9 |
# File 'lib/transbank/sdk/onepay/responses/transaction_create_response.rb', line 7 def ott @ott end |
#qr_code_as_base64 ⇒ Object
Returns the value of attribute qr_code_as_base64.
7 8 9 |
# File 'lib/transbank/sdk/onepay/responses/transaction_create_response.rb', line 7 def qr_code_as_base64 @qr_code_as_base64 end |
#signature ⇒ Object
Returns the value of attribute signature.
7 8 9 |
# File 'lib/transbank/sdk/onepay/responses/transaction_create_response.rb', line 7 def signature @signature end |
Instance Method Details
#sign(secret) ⇒ Object
26 27 28 29 |
# File 'lib/transbank/sdk/onepay/responses/transaction_create_response.rb', line 26 def sign(secret) @signature = signature_for(to_data, secret) self end |