Class: VisaAcceptanceMergedSpec::AmountDetails35

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

Overview

AmountDetails35 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, tax_amount: SKIP, authorized_amount: SKIP, settlement_amount: SKIP, settlement_currency: SKIP, surcharge: SKIP, additional_properties: nil) ⇒ AmountDetails35

Returns a new instance of AmountDetails35.



142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 142

def initialize(total_amount: SKIP, currency: SKIP, tax_amount: SKIP,
               authorized_amount: SKIP, settlement_amount: SKIP,
               settlement_currency: SKIP, surcharge: 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
  @tax_amount = tax_amount unless tax_amount == SKIP
  @authorized_amount = authorized_amount unless authorized_amount == SKIP
  @settlement_amount = settlement_amount unless settlement_amount == SKIP
  @settlement_currency = settlement_currency unless settlement_currency == SKIP
  @surcharge = surcharge unless surcharge == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#authorized_amountString

Amount that was authorized. Returned by authorization service.

PIN debit

Amount of the purchase. Returned by PIN debit purchase.

Returns:

  • (String)


89
90
91
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 89

def authorized_amount
  @authorized_amount
end

#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)


77
78
79
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 77

def currency
  @currency
end

#settlement_amountString

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.

Returns:

  • (String)


95
96
97
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 95

def settlement_amount
  @settlement_amount
end

#settlement_currencyString

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.

Returns:

  • (String)


102
103
104
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 102

def settlement_currency
  @settlement_currency
end

#surchargeSurcharge1

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.

Returns:



109
110
111
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 109

def surcharge
  @surcharge
end

#tax_amountString

Total tax amount for all the items in the order.

Returns:

  • (String)


81
82
83
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 81

def tax_amount
  @tax_amount
end

#total_amountString

Grand total for the order. This value cannot be negative. You can include a decimal point (.), but no other special characters. Visa Acceptance truncates the amount to the correct number of decimal places. Note For CTV, FDCCompass, Paymentech processors, the maximum length for this field is 12. Important Some processors have specific requirements and limitations, such as maximum amounts and maximum field lengths. If your processor supports zero amount authorizations, you can set this field to 0 for the authorization to check if the card is lost or stolen.

Card Present

Required to include either this field or orderInformation.lineItems[].unitPrice for the order.

Required for creating a new invoice or payment link.

PIN Debit

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. 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; however, for all other processors, these fields are required.

DCC with a Third-Party Provider

Set this field to the converted amount that was returned by the DCC provider. You must include either this field or the 1st line item in the order and the specific line-order amount in your request.

DCC for First Data

Not used.

Returns:

  • (String)


44
45
46
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 44

def total_amount
  @total_amount
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 160

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
  tax_amount = hash.key?('taxAmount') ? hash['taxAmount'] : SKIP
  authorized_amount =
    hash.key?('authorizedAmount') ? hash['authorizedAmount'] : SKIP
  settlement_amount =
    hash.key?('settlementAmount') ? hash['settlementAmount'] : SKIP
  settlement_currency =
    hash.key?('settlementCurrency') ? hash['settlementCurrency'] : SKIP
  surcharge = Surcharge1.from_hash(hash['surcharge']) if hash['surcharge']

  # 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.
  AmountDetails35.new(total_amount: total_amount,
                      currency: currency,
                      tax_amount: tax_amount,
                      authorized_amount: authorized_amount,
                      settlement_amount: settlement_amount,
                      settlement_currency: settlement_currency,
                      surcharge: surcharge,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 112

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_amount'] = 'totalAmount'
  @_hash['currency'] = 'currency'
  @_hash['tax_amount'] = 'taxAmount'
  @_hash['authorized_amount'] = 'authorizedAmount'
  @_hash['settlement_amount'] = 'settlementAmount'
  @_hash['settlement_currency'] = 'settlementCurrency'
  @_hash['surcharge'] = 'surcharge'
  @_hash
end

.nullablesObject

An array for nullable fields



138
139
140
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 138

def self.nullables
  []
end

.optionalsObject

An array for optional fields



125
126
127
128
129
130
131
132
133
134
135
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 125

def self.optionals
  %w[
    total_amount
    currency
    tax_amount
    authorized_amount
    settlement_amount
    settlement_currency
    surcharge
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



203
204
205
206
207
208
209
210
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 203

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

#to_sObject

Provides a human-readable string representation of the object.



194
195
196
197
198
199
200
# File 'lib/visa_acceptance_merged_spec/models/amount_details35.rb', line 194

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