Sha256: e98aeac9fc60a8883e39a4fd5bd4901c1295ee9772aec61273c841d762f6d2c9

Contents?: true

Size: 716 Bytes

Versions: 5

Compression:

Stored size: 716 Bytes

Contents

# frozen_string_literal: true

require 'time'
require 'credit_gateway/base_model'
require 'credit_gateway/amount'

module CreditGateway
  class Transaction < BaseModel
    attributes :account_id, :transaction_id, :transaction_reference,
               :amount, :credit_debit_indicator, :status, :transaction_information,
               :booking_date_time, :value_date_time

    def self.build(json:)
      super.tap do |record|
        record.amount = Amount.build(json: (record.amount || {}))
        record.booking_date_time = Time.parse(record.booking_date_time) if record.booking_date_time
        record.value_date_time = Time.parse(record.value_date_time) if record.value_date_time
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
credit_gateway-0.3.2 lib/credit_gateway/transaction.rb
credit_gateway-0.3.1 lib/credit_gateway/transaction.rb
credit_gateway-0.3.0 lib/credit_gateway/transaction.rb
credit_gateway-0.1.1 lib/credit_gateway/transaction.rb
credit_gateway-0.1.0 lib/credit_gateway/transaction.rb