Sha256: 7cb57a2afd606d9b3c06e9b5c39551810fec8a0f1e3eddb51c115d445b254ac4

Contents?: true

Size: 615 Bytes

Versions: 4

Compression:

Stored size: 615 Bytes

Contents

module PensioAPI
  class ChargebackEvent
    attr_reader :type
    attr_reader :reason_code
    attr_reader :reason
    attr_reader :amount
    attr_reader :currency
    attr_reader :acquirer_transaction_id

    def initialize(chargeback_body)
      @raw = chargeback_body

      @type = @raw['Type']
      @reason_code = @raw['ReasonCode'].to_i
      @reason = @raw['Reason']
      @amount = BigDecimal.new(@raw['Amount'])
      @currency = @raw['Currency']
      @acquirer_transaction_id = @raw['AcquirerTransactionId']
    end

    def created_at
      @created_at ||= Time.parse(@raw['Date'])
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pensio_api-0.3.3 lib/pensio_api/chargeback_event.rb
pensio_api-0.3.2 lib/pensio_api/chargeback_event.rb
pensio_api-0.3.1 lib/pensio_api/chargeback_event.rb
pensio_api-0.3.0 lib/pensio_api/chargeback_event.rb