Class: OnlinePayments::SDK::Domain::DccProposal

Inherits:
OnlinePayments::SDK::DataObject show all
Defined in:
lib/onlinepayments/sdk/domain/dcc_proposal.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from OnlinePayments::SDK::DataObject

new_from_hash

Instance Attribute Details

#base_amountOnlinePayments::SDK::Domain::AmountOfMoney

Returns the current value of base_amount.

Returns:



16
17
18
# File 'lib/onlinepayments/sdk/domain/dcc_proposal.rb', line 16

def base_amount
  @base_amount
end

#disclaimer_displayString

Returns the current value of disclaimer_display.

Returns:

  • (String)

    the current value of disclaimer_display



16
17
18
# File 'lib/onlinepayments/sdk/domain/dcc_proposal.rb', line 16

def disclaimer_display
  @disclaimer_display
end

#disclaimer_receiptString

Returns the current value of disclaimer_receipt.

Returns:

  • (String)

    the current value of disclaimer_receipt



16
17
18
# File 'lib/onlinepayments/sdk/domain/dcc_proposal.rb', line 16

def disclaimer_receipt
  @disclaimer_receipt
end

#rateOnlinePayments::SDK::Domain::RateDetails

Returns the current value of rate.

Returns:



16
17
18
# File 'lib/onlinepayments/sdk/domain/dcc_proposal.rb', line 16

def rate
  @rate
end

#target_amountOnlinePayments::SDK::Domain::AmountOfMoney

Returns the current value of target_amount.

Returns:



16
17
18
# File 'lib/onlinepayments/sdk/domain/dcc_proposal.rb', line 16

def target_amount
  @target_amount
end

Instance Method Details

#from_hash(hash) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/onlinepayments/sdk/domain/dcc_proposal.rb', line 34

def from_hash(hash)
  super
  if hash.key? 'baseAmount'
    raise TypeError, "value '%s' is not a Hash" % [hash['baseAmount']] unless hash['baseAmount'].is_a? Hash
    @base_amount = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['baseAmount'])
  end
  @disclaimer_display = hash['disclaimerDisplay'] if hash.key? 'disclaimerDisplay'
  @disclaimer_receipt = hash['disclaimerReceipt'] if hash.key? 'disclaimerReceipt'
  if hash.key? 'rate'
    raise TypeError, "value '%s' is not a Hash" % [hash['rate']] unless hash['rate'].is_a? Hash
    @rate = OnlinePayments::SDK::Domain::RateDetails.new_from_hash(hash['rate'])
  end
  if hash.key? 'targetAmount'
    raise TypeError, "value '%s' is not a Hash" % [hash['targetAmount']] unless hash['targetAmount'].is_a? Hash
    @target_amount = OnlinePayments::SDK::Domain::AmountOfMoney.new_from_hash(hash['targetAmount'])
  end
end

#to_hHash

Returns:

  • (Hash)


24
25
26
27
28
29
30
31
32
# File 'lib/onlinepayments/sdk/domain/dcc_proposal.rb', line 24

def to_h
  hash = super
  hash['baseAmount'] = @base_amount.to_h if @base_amount
  hash['disclaimerDisplay'] = @disclaimer_display unless @disclaimer_display.nil?
  hash['disclaimerReceipt'] = @disclaimer_receipt unless @disclaimer_receipt.nil?
  hash['rate'] = @rate.to_h if @rate
  hash['targetAmount'] = @target_amount.to_h if @target_amount
  hash
end