Class: VisaAcceptanceMergedSpec::AmountDetails9

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

Overview

AmountDetails9 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, discount_amount: SKIP, duty_amount: SKIP, gratuity_amount: SKIP, tax_amount: SKIP, national_tax_included: SKIP, tax_applied_after_discount: SKIP, tax_applied_level: SKIP, tax_type_code: SKIP, freight_amount: SKIP, foreign_amount: SKIP, foreign_currency: SKIP, exchange_rate: SKIP, exchange_rate_time_stamp: SKIP, amex_additional_amounts: SKIP, tax_details: SKIP, service_fee_amount: SKIP, original_currency: SKIP, cashback_amount: SKIP, additional_properties: nil) ⇒ AmountDetails9

Returns a new instance of AmountDetails9.



260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 260

def initialize(total_amount: SKIP, currency: SKIP, discount_amount: SKIP,
               duty_amount: SKIP, gratuity_amount: SKIP, tax_amount: SKIP,
               national_tax_included: SKIP,
               tax_applied_after_discount: SKIP, tax_applied_level: SKIP,
               tax_type_code: SKIP, freight_amount: SKIP,
               foreign_amount: SKIP, foreign_currency: SKIP,
               exchange_rate: SKIP, exchange_rate_time_stamp: SKIP,
               amex_additional_amounts: SKIP, tax_details: SKIP,
               service_fee_amount: SKIP, original_currency: SKIP,
               cashback_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
  @duty_amount = duty_amount unless duty_amount == SKIP
  @gratuity_amount = gratuity_amount unless gratuity_amount == SKIP
  @tax_amount = tax_amount unless tax_amount == SKIP
  @national_tax_included = national_tax_included unless national_tax_included == SKIP
  unless tax_applied_after_discount == SKIP
    @tax_applied_after_discount =
      tax_applied_after_discount
  end
  @tax_applied_level = tax_applied_level unless tax_applied_level == SKIP
  @tax_type_code = tax_type_code unless tax_type_code == SKIP
  @freight_amount = freight_amount unless freight_amount == SKIP
  @foreign_amount = foreign_amount unless foreign_amount == SKIP
  @foreign_currency = foreign_currency unless foreign_currency == SKIP
  @exchange_rate = exchange_rate unless exchange_rate == SKIP
  @exchange_rate_time_stamp = exchange_rate_time_stamp unless exchange_rate_time_stamp == SKIP
  @amex_additional_amounts = amex_additional_amounts unless amex_additional_amounts == SKIP
  @tax_details = tax_details unless tax_details == SKIP
  @service_fee_amount = service_fee_amount unless service_fee_amount == SKIP
  @original_currency = original_currency unless original_currency == SKIP
  @cashback_amount = cashback_amount unless cashback_amount == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amex_additional_amountsArray[AmexAdditionalAmount]

Time stamp for the exchange rate. This value is returned by the DCC service. Format: YYYYMMDD~HH:MM where ~ denotes a space.

Returns:



171
172
173
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 171

def amex_additional_amounts
  @amex_additional_amounts
end

#cashback_amountString

Cashback amount in the acquirer’s currency. If a cashback amount is included in the request, it must be included in the orderInformation.amountDetails.totalAmount value. This field is supported only on Visa Acceptance through VisaNet.

Used by

Authorization Optional. Authorization Reversal Optional.

PIN debit

Optional field for PIN debit purchase, PIN debit credit or PIN debit reversal.

Returns:

  • (String)


201
202
203
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 201

def cashback_amount
  @cashback_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_details9.rb', line 77

def currency
  @currency
end

#discount_amountString

Total discount amount applied to the order.

Returns:

  • (String)


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

def discount_amount
  @discount_amount
end

#duty_amountString

Total charges for any import or export duties included in the order.

Returns:

  • (String)


85
86
87
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 85

def duty_amount
  @duty_amount
end

#exchange_rateString

Exchange rate returned by the DCC service. Includes a decimal point and a maximum of 4 decimal places.

Returns:

  • (String)


159
160
161
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 159

def exchange_rate
  @exchange_rate
end

#exchange_rate_time_stampString

Time stamp for the exchange rate. This value is returned by the DCC service. Format: YYYYMMDD~HH:MM where ~ denotes a space.

Returns:

  • (String)


165
166
167
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 165

def exchange_rate_time_stamp
  @exchange_rate_time_stamp
end

#foreign_amountString

Set this field to the converted amount that was returned by the DCC provider.

Returns:

  • (String)


149
150
151
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 149

def foreign_amount
  @foreign_amount
end

#foreign_currencyString

Set this field to the converted amount that was returned by the DCC provider.

Returns:

  • (String)


154
155
156
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 154

def foreign_currency
  @foreign_currency
end

#freight_amountString

Total freight or shipping and handling charges for the order. When you include this field in your request, you must also include the totalAmount field.

Returns:

  • (String)


144
145
146
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 144

def freight_amount
  @freight_amount
end

#gratuity_amountString

Gratuity or tip amount for restaurants. Allowed only when industryDatatype=restaurant. When your customer uses a debit card or prepaid card, and you receive a partial authorization, the payment networks recommend that you do not submit a capture amount that is higher than the authorized amount. When the capture amount exceeds the partial amount that was approved, the issuer has chargeback rights for the excess amount. Used by Capture Optional field.

Visa Acceptance through VisaNet

Restaurant data is supported only on Visa Acceptance through VisaNet when card is present.

Returns:

  • (String)


100
101
102
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 100

def gratuity_amount
  @gratuity_amount
end

#national_tax_includedString

Flag that indicates whether a national tax is included in the order total. Possible values:

  • 0: national tax not included
  • 1: national tax included

Returns:

  • (String)


111
112
113
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 111

def national_tax_included
  @national_tax_included
end

#original_currencyString

Your local pricing currency code. For the possible values, see the [ISO Standard Currency Codes.](

Returns:

  • (String)


186
187
188
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 186

def original_currency
  @original_currency
end

#service_fee_amountString

Service fee. Required for service fee transactions.

Returns:

  • (String)


181
182
183
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 181

def service_fee_amount
  @service_fee_amount
end

#tax_amountString

Total tax amount for all the items in the order.

Returns:

  • (String)


104
105
106
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 104

def tax_amount
  @tax_amount
end

#tax_applied_after_discountString

Flag that indicates how the merchant manages discounts. Possible values:

  • 0: no invoice level discount included
  • 1: tax calculated on the postdiscount invoice total
  • 2: tax calculated on the prediscount invoice total

Returns:

  • (String)


119
120
121
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 119

def tax_applied_after_discount
  @tax_applied_after_discount
end

#tax_applied_levelString

Flag that indicates how you calculate tax. Possible values:

  • 0: net prices with tax calculated at line item level
  • 1: net prices with tax calculated at invoice level
  • 2: gross prices with tax provided at line item level
  • 3: gross prices with tax provided at invoice level
  • 4: no tax applies on the invoice for the transaction

Returns:

  • (String)


129
130
131
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 129

def tax_applied_level
  @tax_applied_level
end

#tax_detailsArray[TaxDetails1]

Time stamp for the exchange rate. This value is returned by the DCC service. Format: YYYYMMDD~HH:MM where ~ denotes a space.

Returns:



177
178
179
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 177

def tax_details
  @tax_details
end

#tax_type_codeString

For tax amounts that can be categorized as one tax type. This field contains the tax type code that corresponds to the entry in the lineItems.taxAmount field. Possible values:

  • 056: sales tax (U.S only)
  • TX~: all taxes (Canada only) Note ~ = space.

Returns:

  • (String)


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

def tax_type_code
  @tax_type_code
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_details9.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.



300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 300

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
  duty_amount = hash.key?('dutyAmount') ? hash['dutyAmount'] : SKIP
  gratuity_amount =
    hash.key?('gratuityAmount') ? hash['gratuityAmount'] : SKIP
  tax_amount = hash.key?('taxAmount') ? hash['taxAmount'] : SKIP
  national_tax_included =
    hash.key?('nationalTaxIncluded') ? hash['nationalTaxIncluded'] : SKIP
  tax_applied_after_discount =
    hash.key?('taxAppliedAfterDiscount') ? hash['taxAppliedAfterDiscount'] : SKIP
  tax_applied_level =
    hash.key?('taxAppliedLevel') ? hash['taxAppliedLevel'] : SKIP
  tax_type_code = hash.key?('taxTypeCode') ? hash['taxTypeCode'] : SKIP
  freight_amount = hash.key?('freightAmount') ? hash['freightAmount'] : SKIP
  foreign_amount = hash.key?('foreignAmount') ? hash['foreignAmount'] : SKIP
  foreign_currency =
    hash.key?('foreignCurrency') ? hash['foreignCurrency'] : SKIP
  exchange_rate = hash.key?('exchangeRate') ? hash['exchangeRate'] : SKIP
  exchange_rate_time_stamp =
    hash.key?('exchangeRateTimeStamp') ? hash['exchangeRateTimeStamp'] : SKIP
  # Parameter is an array, so we need to iterate through it
  amex_additional_amounts = nil
  unless hash['amexAdditionalAmounts'].nil?
    amex_additional_amounts = []
    hash['amexAdditionalAmounts'].each do |structure|
      amex_additional_amounts << (AmexAdditionalAmount.from_hash(structure) if structure)
    end
  end

  amex_additional_amounts = SKIP unless hash.key?('amexAdditionalAmounts')
  # Parameter is an array, so we need to iterate through it
  tax_details = nil
  unless hash['taxDetails'].nil?
    tax_details = []
    hash['taxDetails'].each do |structure|
      tax_details << (TaxDetails1.from_hash(structure) if structure)
    end
  end

  tax_details = SKIP unless hash.key?('taxDetails')
  service_fee_amount =
    hash.key?('serviceFeeAmount') ? hash['serviceFeeAmount'] : SKIP
  original_currency =
    hash.key?('originalCurrency') ? hash['originalCurrency'] : SKIP
  cashback_amount =
    hash.key?('cashbackAmount') ? hash['cashbackAmount'] : 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.
  AmountDetails9.new(total_amount: total_amount,
                     currency: currency,
                     discount_amount: discount_amount,
                     duty_amount: duty_amount,
                     gratuity_amount: gratuity_amount,
                     tax_amount: tax_amount,
                     national_tax_included: national_tax_included,
                     tax_applied_after_discount: tax_applied_after_discount,
                     tax_applied_level: tax_applied_level,
                     tax_type_code: tax_type_code,
                     freight_amount: freight_amount,
                     foreign_amount: foreign_amount,
                     foreign_currency: foreign_currency,
                     exchange_rate: exchange_rate,
                     exchange_rate_time_stamp: exchange_rate_time_stamp,
                     amex_additional_amounts: amex_additional_amounts,
                     tax_details: tax_details,
                     service_fee_amount: service_fee_amount,
                     original_currency: original_currency,
                     cashback_amount: cashback_amount,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 204

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_amount'] = 'totalAmount'
  @_hash['currency'] = 'currency'
  @_hash['discount_amount'] = 'discountAmount'
  @_hash['duty_amount'] = 'dutyAmount'
  @_hash['gratuity_amount'] = 'gratuityAmount'
  @_hash['tax_amount'] = 'taxAmount'
  @_hash['national_tax_included'] = 'nationalTaxIncluded'
  @_hash['tax_applied_after_discount'] = 'taxAppliedAfterDiscount'
  @_hash['tax_applied_level'] = 'taxAppliedLevel'
  @_hash['tax_type_code'] = 'taxTypeCode'
  @_hash['freight_amount'] = 'freightAmount'
  @_hash['foreign_amount'] = 'foreignAmount'
  @_hash['foreign_currency'] = 'foreignCurrency'
  @_hash['exchange_rate'] = 'exchangeRate'
  @_hash['exchange_rate_time_stamp'] = 'exchangeRateTimeStamp'
  @_hash['amex_additional_amounts'] = 'amexAdditionalAmounts'
  @_hash['tax_details'] = 'taxDetails'
  @_hash['service_fee_amount'] = 'serviceFeeAmount'
  @_hash['original_currency'] = 'originalCurrency'
  @_hash['cashback_amount'] = 'cashbackAmount'
  @_hash
end

.nullablesObject

An array for nullable fields



256
257
258
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 256

def self.nullables
  []
end

.optionalsObject

An array for optional fields



230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 230

def self.optionals
  %w[
    total_amount
    currency
    discount_amount
    duty_amount
    gratuity_amount
    tax_amount
    national_tax_included
    tax_applied_after_discount
    tax_applied_level
    tax_type_code
    freight_amount
    foreign_amount
    foreign_currency
    exchange_rate
    exchange_rate_time_stamp
    amex_additional_amounts
    tax_details
    service_fee_amount
    original_currency
    cashback_amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 401

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} total_amount: #{@total_amount.inspect}, currency: #{@currency.inspect},"\
  " discount_amount: #{@discount_amount.inspect}, duty_amount: #{@duty_amount.inspect},"\
  " gratuity_amount: #{@gratuity_amount.inspect}, tax_amount: #{@tax_amount.inspect},"\
  " national_tax_included: #{@national_tax_included.inspect}, tax_applied_after_discount:"\
  " #{@tax_applied_after_discount.inspect}, tax_applied_level: #{@tax_applied_level.inspect},"\
  " tax_type_code: #{@tax_type_code.inspect}, freight_amount: #{@freight_amount.inspect},"\
  " foreign_amount: #{@foreign_amount.inspect}, foreign_currency:"\
  " #{@foreign_currency.inspect}, exchange_rate: #{@exchange_rate.inspect},"\
  " exchange_rate_time_stamp: #{@exchange_rate_time_stamp.inspect}, amex_additional_amounts:"\
  " #{@amex_additional_amounts.inspect}, tax_details: #{@tax_details.inspect},"\
  " service_fee_amount: #{@service_fee_amount.inspect}, original_currency:"\
  " #{@original_currency.inspect}, cashback_amount: #{@cashback_amount.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



385
386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'lib/visa_acceptance_merged_spec/models/amount_details9.rb', line 385

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} total_amount: #{@total_amount}, currency: #{@currency}, discount_amount:"\
  " #{@discount_amount}, duty_amount: #{@duty_amount}, gratuity_amount: #{@gratuity_amount},"\
  " tax_amount: #{@tax_amount}, national_tax_included: #{@national_tax_included},"\
  " tax_applied_after_discount: #{@tax_applied_after_discount}, tax_applied_level:"\
  " #{@tax_applied_level}, tax_type_code: #{@tax_type_code}, freight_amount:"\
  " #{@freight_amount}, foreign_amount: #{@foreign_amount}, foreign_currency:"\
  " #{@foreign_currency}, exchange_rate: #{@exchange_rate}, exchange_rate_time_stamp:"\
  " #{@exchange_rate_time_stamp}, amex_additional_amounts: #{@amex_additional_amounts},"\
  " tax_details: #{@tax_details}, service_fee_amount: #{@service_fee_amount},"\
  " original_currency: #{@original_currency}, cashback_amount: #{@cashback_amount},"\
  " additional_properties: #{@additional_properties}>"
end