class Transbank::Onepay::RefundCreateResponse

Serializes the response to a RefundCreateRequest

Attributes

external_unique_number[RW]
issued_at[RW]
occ[RW]
reverse_code[RW]
signature[RW]

Public Class Methods

new(json) click to toggle source

@raise []RefundCreateError] if the responseCode from the service is not 'OK'

# 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