Class: VisaAcceptanceMergedSpec::AmountDetails12
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::AmountDetails12
- Defined in:
- lib/visa_acceptance_merged_spec/models/amount_details12.rb
Overview
AmountDetails12 Model.
Instance Attribute Summary collapse
-
#exchange_rate ⇒ String
Exchange rate returned by the DCC service.
-
#foreign_amount ⇒ String
Set this field to the converted amount that was returned by the DCC provider.
-
#foreign_currency ⇒ String
Set this field to the converted amount that was returned by the DCC provider.
-
#settlement_amount ⇒ String
This is a multicurrency field.
-
#settlement_currency ⇒ String
This is a multicurrency-only field.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(settlement_amount: SKIP, settlement_currency: SKIP, exchange_rate: SKIP, foreign_amount: SKIP, foreign_currency: SKIP, additional_properties: nil) ⇒ AmountDetails12
constructor
A new instance of AmountDetails12.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(settlement_amount: SKIP, settlement_currency: SKIP, exchange_rate: SKIP, foreign_amount: SKIP, foreign_currency: SKIP, additional_properties: nil) ⇒ AmountDetails12
Returns a new instance of AmountDetails12.
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 67 def initialize(settlement_amount: SKIP, settlement_currency: SKIP, exchange_rate: SKIP, foreign_amount: SKIP, foreign_currency: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @settlement_amount = settlement_amount unless settlement_amount == SKIP @settlement_currency = settlement_currency unless settlement_currency == SKIP @exchange_rate = exchange_rate unless exchange_rate == SKIP @foreign_amount = foreign_amount unless foreign_amount == SKIP @foreign_currency = foreign_currency unless foreign_currency == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#exchange_rate ⇒ String
Exchange rate returned by the DCC service. Includes a decimal point and a maximum of 4 decimal places.
28 29 30 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 28 def exchange_rate @exchange_rate end |
#foreign_amount ⇒ String
Set this field to the converted amount that was returned by the DCC provider.
33 34 35 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 33 def foreign_amount @foreign_amount end |
#foreign_currency ⇒ String
Set this field to the converted amount that was returned by the DCC provider.
38 39 40 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 38 def foreign_currency @foreign_currency end |
#settlement_amount ⇒ String
This is a multicurrency field. It contains the transaction amount (field 4), converted to the Currency used to bill the cardholder’s account. This field is returned for OCT transactions.
16 17 18 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 16 def settlement_amount @settlement_amount end |
#settlement_currency ⇒ String
This is a multicurrency-only field. It contains a 3-digit numeric code that identifies the currency used by the issuer to bill the cardholder's account. This field is returned for OCT transactions.
23 24 25 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 23 def settlement_currency @settlement_currency end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 82 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. settlement_amount = hash.key?('settlementAmount') ? hash['settlementAmount'] : SKIP settlement_currency = hash.key?('settlementCurrency') ? hash['settlementCurrency'] : SKIP exchange_rate = hash.key?('exchangeRate') ? hash['exchangeRate'] : SKIP foreign_amount = hash.key?('foreignAmount') ? hash['foreignAmount'] : SKIP foreign_currency = hash.key?('foreignCurrency') ? hash['foreignCurrency'] : SKIP # Create a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. AmountDetails12.new(settlement_amount: settlement_amount, settlement_currency: settlement_currency, exchange_rate: exchange_rate, foreign_amount: foreign_amount, foreign_currency: foreign_currency, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['settlement_amount'] = 'settlementAmount' @_hash['settlement_currency'] = 'settlementCurrency' @_hash['exchange_rate'] = 'exchangeRate' @_hash['foreign_amount'] = 'foreignAmount' @_hash['foreign_currency'] = 'foreignCurrency' @_hash end |
.nullables ⇒ Object
An array for nullable fields
63 64 65 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 63 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
52 53 54 55 56 57 58 59 60 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 52 def self.optionals %w[ settlement_amount settlement_currency exchange_rate foreign_amount foreign_currency ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
121 122 123 124 125 126 127 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 121 def inspect class_name = self.class.name.split('::').last "<#{class_name} settlement_amount: #{@settlement_amount.inspect}, settlement_currency:"\ " #{@settlement_currency.inspect}, exchange_rate: #{@exchange_rate.inspect}, foreign_amount:"\ " #{@foreign_amount.inspect}, foreign_currency: #{@foreign_currency.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
112 113 114 115 116 117 118 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details12.rb', line 112 def to_s class_name = self.class.name.split('::').last "<#{class_name} settlement_amount: #{@settlement_amount}, settlement_currency:"\ " #{@settlement_currency}, exchange_rate: #{@exchange_rate}, foreign_amount:"\ " #{@foreign_amount}, foreign_currency: #{@foreign_currency}, additional_properties:"\ " #{@additional_properties}>" end |