Class: Transbank::Onepay::RefundCreateResponse

Inherits:
Object
  • Object
show all
Includes:
Response
Defined in:
lib/transbank/sdk/onepay/responses/refund_create_response.rb

Overview

Serializes the response to a RefundCreateRequest

Instance Attribute Summary collapse

Attributes included from Response

#description, #response_code

Instance Method Summary collapse

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) ⇒ RefundCreateResponse

Returns a new instance of RefundCreateResponse.

Raises:

  • ]RefundCreateError

    if the responseCode from the service is not ‘OK’



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/transbank/sdk/onepay/responses/refund_create_response.rb', line 9

def initialize(json)
  unless json.fetch('responseCode').downcase == 'ok'
    raise Errors::RefundCreateError, "#{json.fetch('responseCode')} : #{json.fetch('description')}"
  end
  result = json.fetch('result')
  @response_code = json.fetch('responseCode')
  @description = json.fetch('description')
  @occ = result.fetch('occ')
  @external_unique_number = result.fetch('externalUniqueNumber')
  @reverse_code = result.fetch('reverseCode')
  @issued_at = result.fetch('issuedAt')
  @signature = result.fetch('signature')
end

Instance Attribute Details

#external_unique_numberObject

Returns the value of attribute external_unique_number.



6
7
8
# File 'lib/transbank/sdk/onepay/responses/refund_create_response.rb', line 6

def external_unique_number
  @external_unique_number
end

#issued_atObject

Returns the value of attribute issued_at.



6
7
8
# File 'lib/transbank/sdk/onepay/responses/refund_create_response.rb', line 6

def issued_at
  @issued_at
end

#occObject

Returns the value of attribute occ.



6
7
8
# File 'lib/transbank/sdk/onepay/responses/refund_create_response.rb', line 6

def occ
  @occ
end

#reverse_codeObject

Returns the value of attribute reverse_code.



6
7
8
# File 'lib/transbank/sdk/onepay/responses/refund_create_response.rb', line 6

def reverse_code
  @reverse_code
end

#signatureObject

Returns the value of attribute signature.



6
7
8
# File 'lib/transbank/sdk/onepay/responses/refund_create_response.rb', line 6

def signature
  @signature
end