Class: Worldline::Acquiring::SDK::V1::Domain::DccProposal

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Domain::DataObject

new_from_hash

Instance Attribute Details

#original_amountWorldline::Acquiring::SDK::V1::Domain::AmountData

Returns the current value of original_amount.

Returns:



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

def original_amount
  @original_amount
end

#rateWorldline::Acquiring::SDK::V1::Domain::RateData

Returns the current value of rate.

Returns:



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

def rate
  @rate
end

#rate_reference_idString

Returns the current value of rate_reference_id.

Returns:

  • (String)

    the current value of rate_reference_id



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

def rate_reference_id
  @rate_reference_id
end

#resulting_amountWorldline::Acquiring::SDK::V1::Domain::AmountData

Returns the current value of resulting_amount.

Returns:



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

def resulting_amount
  @resulting_amount
end

Instance Method Details

#from_hash(hash) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/worldline/acquiring/sdk/v1/domain/dcc_proposal.rb', line 37

def from_hash(hash)
  super
  if hash.has_key? 'originalAmount'
    raise TypeError, "value '%s' is not a Hash" % [hash['originalAmount']] unless hash['originalAmount'].is_a? Hash
    @original_amount = Worldline::Acquiring::SDK::V1::Domain::AmountData.new_from_hash(hash['originalAmount'])
  end
  if hash.has_key? 'rate'
    raise TypeError, "value '%s' is not a Hash" % [hash['rate']] unless hash['rate'].is_a? Hash
    @rate = Worldline::Acquiring::SDK::V1::Domain::RateData.new_from_hash(hash['rate'])
  end
  if hash.has_key? 'rateReferenceId'
    @rate_reference_id = hash['rateReferenceId']
  end
  if hash.has_key? 'resultingAmount'
    raise TypeError, "value '%s' is not a Hash" % [hash['resultingAmount']] unless hash['resultingAmount'].is_a? Hash
    @resulting_amount = Worldline::Acquiring::SDK::V1::Domain::AmountData.new_from_hash(hash['resultingAmount'])
  end
end

#to_hHash

Returns:

  • (Hash)


28
29
30
31
32
33
34
35
# File 'lib/worldline/acquiring/sdk/v1/domain/dcc_proposal.rb', line 28

def to_h
  hash = super
  hash['originalAmount'] = @original_amount.to_h unless @original_amount.nil?
  hash['rate'] = @rate.to_h unless @rate.nil?
  hash['rateReferenceId'] = @rate_reference_id unless @rate_reference_id.nil?
  hash['resultingAmount'] = @resulting_amount.to_h unless @resulting_amount.nil?
  hash
end