Class: VisaAcceptanceMergedSpec::AmountDetails1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/amount_details1.rb

Overview

AmountDetails1 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(amount_type: SKIP, amount: SKIP, additional_properties: nil) ⇒ AmountDetails1

Returns a new instance of AmountDetails1.



62
63
64
65
66
67
68
69
# File 'lib/visa_acceptance_merged_spec/models/amount_details1.rb', line 62

def initialize(amount_type: SKIP, amount: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @amount_type = amount_type unless amount_type == SKIP
  @amount = amount unless amount == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amountString

Total Amount that has been spent on the corresponding amountType. This is 13 byte field including sign. If the amount is positive, then it is a debit for the customer. If the amount is negative, then it is a credit for the customer.

Returns:

  • (String)


39
40
41
# File 'lib/visa_acceptance_merged_spec/models/amount_details1.rb', line 39

def amount
  @amount
end

#amount_typeString

Total amount that has been spent on healthcare in a transaction. Valid Values for Visa:

  • healthcare - Total Amount Healthcare
  • healthcare-transit - Amount Transit
  • vision - Amount Vision/Optical
  • prescription - Amount Prescription/RX
  • clinic - Amount Clinic/Other Qualified Medical
  • dental - Amount Dental Note: - Prescription, Clinic and dental amounts must be preceded with the total healthcare amount and cannot occur individually. Vision and Transit must be sent individually and cannot be combined with total healthcare amount or any other amounts. Total Healthcare amount can be sent individually. Valid Values for MasterCard:
  • prescription - Amount Prescription/RX
  • eligible-total - Total Amount Healthcare Note: - Prescription must be preceded with the total healthcare amount and cannot occur individually. Total Healthcare amount can be sent individually.

Returns:

  • (String)


32
33
34
# File 'lib/visa_acceptance_merged_spec/models/amount_details1.rb', line 32

def amount_type
  @amount_type
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/visa_acceptance_merged_spec/models/amount_details1.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount_type = hash.key?('amountType') ? hash['amountType'] : SKIP
  amount = hash.key?('amount') ? hash['amount'] : 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.
  AmountDetails1.new(amount_type: amount_type,
                     amount: amount,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
# File 'lib/visa_acceptance_merged_spec/models/amount_details1.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount_type'] = 'amountType'
  @_hash['amount'] = 'amount'
  @_hash
end

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/visa_acceptance_merged_spec/models/amount_details1.rb', line 58

def self.nullables
  []
end

.optionalsObject

An array for optional fields



50
51
52
53
54
55
# File 'lib/visa_acceptance_merged_spec/models/amount_details1.rb', line 50

def self.optionals
  %w[
    amount_type
    amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



100
101
102
103
104
# File 'lib/visa_acceptance_merged_spec/models/amount_details1.rb', line 100

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} amount_type: #{@amount_type.inspect}, amount: #{@amount.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



93
94
95
96
97
# File 'lib/visa_acceptance_merged_spec/models/amount_details1.rb', line 93

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} amount_type: #{@amount_type}, amount: #{@amount}, additional_properties:"\
  " #{@additional_properties}>"
end