Class: VisaAcceptanceMergedSpec::AmountDetails10

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

Overview

AmountDetails10 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(total_amount: SKIP, currency: SKIP, processor_transaction_fee: SKIP, additional_properties: nil) ⇒ AmountDetails10

Returns a new instance of AmountDetails10.



76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/visa_acceptance_merged_spec/models/amount_details10.rb', line 76

def initialize(total_amount: SKIP, currency: SKIP,
               processor_transaction_fee: 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
  unless processor_transaction_fee == SKIP
    @processor_transaction_fee =
      processor_transaction_fee
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#currencyString

Currency used for the order. Use the three-character [ISO Standard Currency Codes.](

Used by

Authorization Required field. Authorization Reversal For an authorization reversal (reversalInformation) or a capture (processingOptions.capture is set to true), you must use the same currency that you used in your payment authorization request.

PIN Debit

Currency for the amount you requested for the PIN debit purchase. This value is returned for partial authorizations. The issuing bank can approve a partial amount if the balance on the debit card is less than the requested transaction amount. For the possible values, see the [ISO Standard Currency Codes]( Returned by PIN debit purchase. For PIN debit reversal requests, you must use the same currency that was used for the PIN debit purchase or PIN debit credit that you are reversing. For the possible values, see the [ISO Standard Currency Codes]( Required field for PIN Debit purchase and PIN Debit credit requests. Optional field for PIN Debit reversal requests.

GPX

This field is optional for reversing an authorization or credit.

DCC for First Data

Your local currency.

Tax Calculation

Required for international tax and value added tax only. Optional for U.S. and Canadian taxes. Your local currency.

Returns:

  • (String)


47
48
49
# File 'lib/visa_acceptance_merged_spec/models/amount_details10.rb', line 47

def currency
  @currency
end

#processor_transaction_feeString

The fee decided by the PSP/Processor per transaction.

Returns:

  • (String)


51
52
53
# File 'lib/visa_acceptance_merged_spec/models/amount_details10.rb', line 51

def processor_transaction_fee
  @processor_transaction_fee
end

#total_amountString

Amount you requested for the capture.

Returns:

  • (String)


14
15
16
# File 'lib/visa_acceptance_merged_spec/models/amount_details10.rb', line 14

def total_amount
  @total_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/visa_acceptance_merged_spec/models/amount_details10.rb', line 91

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
  processor_transaction_fee =
    hash.key?('processorTransactionFee') ? hash['processorTransactionFee'] : 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.
  AmountDetails10.new(total_amount: total_amount,
                      currency: currency,
                      processor_transaction_fee: processor_transaction_fee,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



54
55
56
57
58
59
60
# File 'lib/visa_acceptance_merged_spec/models/amount_details10.rb', line 54

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_amount'] = 'totalAmount'
  @_hash['currency'] = 'currency'
  @_hash['processor_transaction_fee'] = 'processorTransactionFee'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
# File 'lib/visa_acceptance_merged_spec/models/amount_details10.rb', line 72

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    total_amount
    currency
    processor_transaction_fee
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



123
124
125
126
127
128
# File 'lib/visa_acceptance_merged_spec/models/amount_details10.rb', line 123

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

#to_sObject

Provides a human-readable string representation of the object.



115
116
117
118
119
120
# File 'lib/visa_acceptance_merged_spec/models/amount_details10.rb', line 115

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