Class: VisaAcceptanceMergedSpec::AmountDetails32
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::AmountDetails32
- Defined in:
- lib/visa_acceptance_merged_spec/models/amount_details32.rb
Overview
AmountDetails32 Model.
Instance Attribute Summary collapse
-
#currency ⇒ String
Currency used for the order.
-
#discount_amount ⇒ String
Discount amount for the transaction.
-
#duty_amount ⇒ String
Amount being charged as duty amount.
-
#insurance_amount ⇒ String
Amount being charged for the insurance fee.
-
#shipping_amount ⇒ String
Aggregate shipping charges for the transactions.
-
#shipping_discount_amount ⇒ String
Shipping discount amount for the transaction.
-
#tax_amount ⇒ String
Total tax amount.
-
#total_amount ⇒ String
Grand total for the order.
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(total_amount: SKIP, currency: SKIP, discount_amount: SKIP, shipping_amount: SKIP, shipping_discount_amount: SKIP, tax_amount: SKIP, insurance_amount: SKIP, duty_amount: SKIP, additional_properties: nil) ⇒ AmountDetails32
constructor
A new instance of AmountDetails32.
-
#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(total_amount: SKIP, currency: SKIP, discount_amount: SKIP, shipping_amount: SKIP, shipping_discount_amount: SKIP, tax_amount: SKIP, insurance_amount: SKIP, duty_amount: SKIP, additional_properties: nil) ⇒ AmountDetails32
Returns a new instance of AmountDetails32.
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 80 def initialize(total_amount: SKIP, currency: SKIP, discount_amount: SKIP, shipping_amount: SKIP, shipping_discount_amount: SKIP, tax_amount: SKIP, insurance_amount: SKIP, duty_amount: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @total_amount = total_amount unless total_amount == SKIP @currency = currency unless currency == SKIP @discount_amount = discount_amount unless discount_amount == SKIP @shipping_amount = shipping_amount unless shipping_amount == SKIP @shipping_discount_amount = shipping_discount_amount unless shipping_discount_amount == SKIP @tax_amount = tax_amount unless tax_amount == SKIP @insurance_amount = insurance_amount unless insurance_amount == SKIP @duty_amount = duty_amount unless duty_amount == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#currency ⇒ String
Currency used for the order
21 22 23 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 21 def currency @currency end |
#discount_amount ⇒ String
Discount amount for the transaction.
25 26 27 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 25 def discount_amount @discount_amount end |
#duty_amount ⇒ String
Amount being charged as duty amount.
45 46 47 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 45 def duty_amount @duty_amount end |
#insurance_amount ⇒ String
Amount being charged for the insurance fee.
41 42 43 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 41 def insurance_amount @insurance_amount end |
#shipping_amount ⇒ String
Aggregate shipping charges for the transactions.
29 30 31 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 29 def shipping_amount @shipping_amount end |
#shipping_discount_amount ⇒ String
Shipping discount amount for the transaction.
33 34 35 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 33 def shipping_discount_amount @shipping_discount_amount end |
#tax_amount ⇒ String
Total tax amount.
37 38 39 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 37 def tax_amount @tax_amount end |
#total_amount ⇒ String
Grand total for the order. This value cannot be negative. You can include a decimal point (.), but you cannot include any other special characters. Visa Acceptance truncates the amount to the correct number of decimal places
17 18 19 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 17 def total_amount @total_amount end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 99 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : SKIP currency = hash.key?('currency') ? hash['currency'] : SKIP discount_amount = hash.key?('discountAmount') ? hash['discountAmount'] : SKIP shipping_amount = hash.key?('shippingAmount') ? hash['shippingAmount'] : SKIP shipping_discount_amount = hash.key?('shippingDiscountAmount') ? hash['shippingDiscountAmount'] : SKIP tax_amount = hash.key?('taxAmount') ? hash['taxAmount'] : SKIP insurance_amount = hash.key?('insuranceAmount') ? hash['insuranceAmount'] : SKIP duty_amount = hash.key?('dutyAmount') ? hash['dutyAmount'] : 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. AmountDetails32.new(total_amount: total_amount, currency: currency, discount_amount: discount_amount, shipping_amount: shipping_amount, shipping_discount_amount: shipping_discount_amount, tax_amount: tax_amount, insurance_amount: insurance_amount, duty_amount: duty_amount, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 48 def self.names @_hash = {} if @_hash.nil? @_hash['total_amount'] = 'totalAmount' @_hash['currency'] = 'currency' @_hash['discount_amount'] = 'discountAmount' @_hash['shipping_amount'] = 'shippingAmount' @_hash['shipping_discount_amount'] = 'shippingDiscountAmount' @_hash['tax_amount'] = 'taxAmount' @_hash['insurance_amount'] = 'insuranceAmount' @_hash['duty_amount'] = 'dutyAmount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
76 77 78 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 76 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 62 def self.optionals %w[ total_amount currency discount_amount shipping_amount shipping_discount_amount tax_amount insurance_amount duty_amount ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
146 147 148 149 150 151 152 153 154 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 146 def inspect class_name = self.class.name.split('::').last "<#{class_name} total_amount: #{@total_amount.inspect}, currency: #{@currency.inspect},"\ " discount_amount: #{@discount_amount.inspect}, shipping_amount:"\ " #{@shipping_amount.inspect}, shipping_discount_amount:"\ " #{@shipping_discount_amount.inspect}, tax_amount: #{@tax_amount.inspect},"\ " insurance_amount: #{@insurance_amount.inspect}, duty_amount: #{@duty_amount.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
136 137 138 139 140 141 142 143 |
# File 'lib/visa_acceptance_merged_spec/models/amount_details32.rb', line 136 def to_s class_name = self.class.name.split('::').last "<#{class_name} total_amount: #{@total_amount}, currency: #{@currency}, discount_amount:"\ " #{@discount_amount}, shipping_amount: #{@shipping_amount}, shipping_discount_amount:"\ " #{@shipping_discount_amount}, tax_amount: #{@tax_amount}, insurance_amount:"\ " #{@insurance_amount}, duty_amount: #{@duty_amount}, additional_properties:"\ " #{@additional_properties}>" end |