Class: Worldline::Acquiring::SDK::V1::Domain::TransactionDataForDcc

Inherits:
Domain::DataObject show all
Defined in:
lib/worldline/acquiring/sdk/v1/domain/transaction_data_for_dcc.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Domain::DataObject

new_from_hash

Instance Attribute Details

#amountWorldline::Acquiring::SDK::V1::Domain::AmountData

Returns the current value of amount.

Returns:



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/domain/transaction_data_for_dcc.rb', line 17

def amount
  @amount
end

#transaction_timestampDateTime

Returns the current value of transaction_timestamp.

Returns:

  • (DateTime)

    the current value of transaction_timestamp



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/domain/transaction_data_for_dcc.rb', line 17

def transaction_timestamp
  @transaction_timestamp
end

#transaction_typeString

Returns the current value of transaction_type.

Returns:

  • (String)

    the current value of transaction_type



17
18
19
# File 'lib/worldline/acquiring/sdk/v1/domain/transaction_data_for_dcc.rb', line 17

def transaction_type
  @transaction_type
end

Instance Method Details

#from_hash(hash) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/worldline/acquiring/sdk/v1/domain/transaction_data_for_dcc.rb', line 34

def from_hash(hash)
  super
  if hash.has_key? 'amount'
    raise TypeError, "value '%s' is not a Hash" % [hash['amount']] unless hash['amount'].is_a? Hash
    @amount = Worldline::Acquiring::SDK::V1::Domain::AmountData.new_from_hash(hash['amount'])
  end
  if hash.has_key? 'transactionTimestamp'
    @transaction_timestamp = DateTime.parse(hash['transactionTimestamp'])
  end
  if hash.has_key? 'transactionType'
    @transaction_type = hash['transactionType']
  end
end

#to_hHash

Returns:

  • (Hash)


26
27
28
29
30
31
32
# File 'lib/worldline/acquiring/sdk/v1/domain/transaction_data_for_dcc.rb', line 26

def to_h
  hash = super
  hash['amount'] = @amount.to_h unless @amount.nil?
  hash['transactionTimestamp'] = @transaction_timestamp.iso8601(3) unless @transaction_timestamp.nil?
  hash['transactionType'] = @transaction_type unless @transaction_type.nil?
  hash
end