Class: CyberSourceMergedSpec::AmountDetails

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/amount_details.rb

Overview

AmountDetails 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(refund_balance: SKIP, gift_wrap_amount: SKIP, invoice_amount: SKIP, total_amount: SKIP, sub_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, surcharge: SKIP, settlement_amount: SKIP, settlement_currency: SKIP, amex_additional_amounts: SKIP, tax_details: SKIP, service_fee_amount: SKIP, original_amount: SKIP, original_currency: SKIP, cashback_amount: SKIP, currency_conversion: SKIP, oct_surcharge: SKIP, order: SKIP, anticipated_amount: SKIP, additional_properties: nil) ⇒ AmountDetails

Returns a new instance of AmountDetails.



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 411

def initialize(refund_balance: SKIP, gift_wrap_amount: SKIP,
               invoice_amount: SKIP, total_amount: SKIP,
               sub_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,
               surcharge: SKIP, settlement_amount: SKIP,
               settlement_currency: SKIP, amex_additional_amounts: SKIP,
               tax_details: SKIP, service_fee_amount: SKIP,
               original_amount: SKIP, original_currency: SKIP,
               cashback_amount: SKIP, currency_conversion: SKIP,
               oct_surcharge: SKIP, order: SKIP, anticipated_amount: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @refund_balance = refund_balance unless refund_balance == SKIP
  @gift_wrap_amount = gift_wrap_amount unless gift_wrap_amount == SKIP
  @invoice_amount = invoice_amount unless invoice_amount == SKIP
  @total_amount = total_amount unless total_amount == SKIP
  @sub_total_amount = sub_total_amount unless sub_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
  @surcharge = surcharge unless surcharge == SKIP
  @settlement_amount = settlement_amount unless settlement_amount == SKIP
  @settlement_currency = settlement_currency unless settlement_currency == 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_amount = original_amount unless original_amount == SKIP
  @original_currency = original_currency unless original_currency == SKIP
  @cashback_amount = cashback_amount unless cashback_amount == SKIP
  @currency_conversion = currency_conversion unless currency_conversion == SKIP
  @oct_surcharge = oct_surcharge unless oct_surcharge == SKIP
  @order = order unless order == SKIP
  @anticipated_amount = anticipated_amount unless anticipated_amount == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amex_additional_amountsArray[AmexAdditionalAmount]

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:



232
233
234
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 232

def amex_additional_amounts
  @amex_additional_amounts
end

#anticipated_amountString

This API Field contains the anticipated amount details. This supports use cases where the Merchant does not wish to have funds held against the account, but needs to confirm an amount prior to authorization, such as for a trial subscription, reservation service, or loyalty program. In an account verification, the anticipated amount is used to confirm the account has availability to accept purchases.

Returns:

  • (String)


328
329
330
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 328

def anticipated_amount
  @anticipated_amount
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 CyberSource 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)


274
275
276
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 274

def cashback_amount
  @cashback_amount
end

#currencyString

Currency used for the order. Use the three-character [ISO Standard Currency Codes.](http://apps.cybersource.com/library/documentation/sbc/quickref/cur rencies.pdf)

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](https://developer.cybersource.com/library/documentation/sbc/quickre f/currencies.pdf). 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](https://developer.cybersource.com/library/documentation/sbc/quickre f/currencies.pdf). 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)


118
119
120
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 118

def currency
  @currency
end

#currency_conversionCurrencyConversion

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 CyberSource 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:



289
290
291
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 289

def currency_conversion
  @currency_conversion
end

#discount_amountString

Total discount amount applied to the order.

Returns:

  • (String)


122
123
124
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 122

def discount_amount
  @discount_amount
end

#duty_amountString

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

Returns:

  • (String)


126
127
128
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 126

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)


200
201
202
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 200

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)


206
207
208
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 206

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)


190
191
192
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 190

def foreign_amount
  @foreign_amount
end

#foreign_currencyString

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

Returns:

  • (String)


195
196
197
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 195

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)


185
186
187
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 185

def freight_amount
  @freight_amount
end

#gift_wrap_amountString

Amount being charged as gift wrap fee.

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 18

def gift_wrap_amount
  @gift_wrap_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.

CyberSource through VisaNet

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

Returns:

  • (String)


141
142
143
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 141

def gratuity_amount
  @gratuity_amount
end

#invoice_amountString

Invoice amount. The invoice amount issued by the Merchant to the Cardholder, which includes VAT (excluding items such as TIPS or CASHBACK). For transactions that do not have applicable Benefit Laws, the field may be entered as zeros. This field is only applicable for Uruguay market. Example: 100.00 Uruguay The value for this field corresponds to the following data in the TC 33 capture file:

  • Record: CP01 TCR9
  • Position: 7-18
  • Field: Invoice Amount

Returns:

  • (String)


34
35
36
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 34

def invoice_amount
  @invoice_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)


152
153
154
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 152

def national_tax_included
  @national_tax_included
end

#oct_surchargeOctSurcharge

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 CyberSource 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:



304
305
306
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 304

def oct_surcharge
  @oct_surcharge
end

#orderOrder

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 CyberSource 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:



319
320
321
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 319

def order
  @order
end

#original_amountString

Amount in your original local pricing currency. This value cannot be negative. You can include a decimal point (.) in this field to denote the currency exponent, but you cannot include any other special characters. If needed, CyberSource truncates the amount to the correct number of decimal places.

Returns:

  • (String)


252
253
254
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 252

def original_amount
  @original_amount
end

#original_currencyString

Your local pricing currency code. For the possible values, see the [ISO Standard Currency Codes.](http://apps.cybersource.com/library/documentation/sbc/quickref/cur rencies.pdf)

Returns:

  • (String)


259
260
261
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 259

def original_currency
  @original_currency
end

#refund_balanceString

The remaining amount which can be refunded.

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 14

def refund_balance
  @refund_balance
end

#service_fee_amountString

Service fee. Required for service fee transactions.

Returns:

  • (String)


243
244
245
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 243

def service_fee_amount
  @service_fee_amount
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)


218
219
220
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 218

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)


225
226
227
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 225

def settlement_currency
  @settlement_currency
end

#sub_total_amountString

Subtotal amount of all the items.This amount (which is the value of all items in the cart, not including the additional amounts such as tax, shipping, etc.) cannot change after a sessions request. When there is a change to any of the additional amounts, this field should be resent in the order request. When the sub total amount changes, you must initiate a new transaction starting with a sessions request. Note The amount value must be a non-negative number containing 2 decimal places and limited to 7 digits before the decimal point. This value can not be changed after a sessions request.

Returns:

  • (String)


79
80
81
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 79

def sub_total_amount
  @sub_total_amount
end

#surchargeSurcharge

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

Returns:



212
213
214
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 212

def surcharge
  @surcharge
end

#tax_amountString

Total tax amount for all the items in the order.

Returns:

  • (String)


145
146
147
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 145

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)


160
161
162
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 160

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)


170
171
172
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 170

def tax_applied_level
  @tax_applied_level
end

#tax_detailsArray[TaxDetail]

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:



239
240
241
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 239

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)


179
180
181
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 179

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. CyberSource 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)


67
68
69
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 67

def total_amount
  @total_amount
end

Class Method Details

.from_element(root) ⇒ Object



585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 585

def self.from_element(root)
  refund_balance = XmlUtilities.from_element(root, 'refundBalance', String)
  gift_wrap_amount = XmlUtilities.from_element(root, 'giftWrapAmount',
                                               String)
  invoice_amount = XmlUtilities.from_element(root, 'invoiceAmount', String)
  total_amount = XmlUtilities.from_element(root, 'totalAmount', String)
  sub_total_amount = XmlUtilities.from_element(root, 'subTotalAmount',
                                               String)
  currency = XmlUtilities.from_element(root, 'currency', String)
  discount_amount = XmlUtilities.from_element(root, 'discountAmount',
                                              String)
  duty_amount = XmlUtilities.from_element(root, 'dutyAmount', String)
  gratuity_amount = XmlUtilities.from_element(root, 'gratuityAmount',
                                              String)
  tax_amount = XmlUtilities.from_element(root, 'taxAmount', String)
  national_tax_included = XmlUtilities.from_element(root,
                                                    'nationalTaxIncluded',
                                                    String)
  tax_applied_after_discount = XmlUtilities.from_element(
    root, 'taxAppliedAfterDiscount', String
  )
  tax_applied_level = XmlUtilities.from_element(root, 'taxAppliedLevel',
                                                String)
  tax_type_code = XmlUtilities.from_element(root, 'taxTypeCode', String)
  freight_amount = XmlUtilities.from_element(root, 'freightAmount', String)
  foreign_amount = XmlUtilities.from_element(root, 'foreignAmount', String)
  foreign_currency = XmlUtilities.from_element(root, 'foreignCurrency',
                                               String)
  exchange_rate = XmlUtilities.from_element(root, 'exchangeRate', String)
  exchange_rate_time_stamp = XmlUtilities.from_element(
    root, 'exchangeRateTimeStamp', String
  )
  surcharge = XmlUtilities.from_element(root, 'Surcharge', Surcharge)
  settlement_amount = XmlUtilities.from_element(root, 'settlementAmount',
                                                String)
  settlement_currency = XmlUtilities.from_element(root,
                                                  'settlementCurrency',
                                                  String)
  amex_additional_amounts = XmlUtilities.from_element_to_array(
    root, 'AmexAdditionalAmount', AmexAdditionalAmount
  )
  tax_details = XmlUtilities.from_element_to_array(root, 'TaxDetail',
                                                   TaxDetail)
  service_fee_amount = XmlUtilities.from_element(root, 'serviceFeeAmount',
                                                 String)
  original_amount = XmlUtilities.from_element(root, 'originalAmount',
                                              String)
  original_currency = XmlUtilities.from_element(root, 'originalCurrency',
                                                String)
  cashback_amount = XmlUtilities.from_element(root, 'cashbackAmount',
                                              String)
  currency_conversion = XmlUtilities.from_element(root,
                                                  'CurrencyConversion',
                                                  CurrencyConversion)
  oct_surcharge = XmlUtilities.from_element(root, 'OctSurcharge',
                                            OctSurcharge)
  order = XmlUtilities.from_element(root, 'Order', Order)
  anticipated_amount = XmlUtilities.from_element(root, 'anticipatedAmount',
                                                 String)

  new(refund_balance: refund_balance,
      gift_wrap_amount: gift_wrap_amount,
      invoice_amount: invoice_amount,
      total_amount: total_amount,
      sub_total_amount: sub_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,
      surcharge: surcharge,
      settlement_amount: settlement_amount,
      settlement_currency: settlement_currency,
      amex_additional_amounts: amex_additional_amounts,
      tax_details: tax_details,
      service_fee_amount: service_fee_amount,
      original_amount: original_amount,
      original_currency: original_currency,
      cashback_amount: cashback_amount,
      currency_conversion: currency_conversion,
      oct_surcharge: oct_surcharge,
      order: order,
      anticipated_amount: anticipated_amount,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 470

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  refund_balance = hash.key?('refundBalance') ? hash['refundBalance'] : SKIP
  gift_wrap_amount =
    hash.key?('giftWrapAmount') ? hash['giftWrapAmount'] : SKIP
  invoice_amount = hash.key?('invoiceAmount') ? hash['invoiceAmount'] : SKIP
  total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : SKIP
  sub_total_amount =
    hash.key?('subTotalAmount') ? hash['subTotalAmount'] : 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
  surcharge = Surcharge.from_hash(hash['surcharge']) if hash['surcharge']
  settlement_amount =
    hash.key?('settlementAmount') ? hash['settlementAmount'] : SKIP
  settlement_currency =
    hash.key?('settlementCurrency') ? hash['settlementCurrency'] : 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 << (TaxDetail.from_hash(structure) if structure)
    end
  end

  tax_details = SKIP unless hash.key?('taxDetails')
  service_fee_amount =
    hash.key?('serviceFeeAmount') ? hash['serviceFeeAmount'] : SKIP
  original_amount =
    hash.key?('originalAmount') ? hash['originalAmount'] : SKIP
  original_currency =
    hash.key?('originalCurrency') ? hash['originalCurrency'] : SKIP
  cashback_amount =
    hash.key?('cashbackAmount') ? hash['cashbackAmount'] : SKIP
  currency_conversion = CurrencyConversion.from_hash(hash['currencyConversion']) if
    hash['currencyConversion']
  oct_surcharge = OctSurcharge.from_hash(hash['oct-surcharge']) if hash['oct-surcharge']
  order = Order.from_hash(hash['order']) if hash['order']
  anticipated_amount =
    hash.key?('anticipatedAmount') ? hash['anticipatedAmount'] : 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.
  AmountDetails.new(refund_balance: refund_balance,
                    gift_wrap_amount: gift_wrap_amount,
                    invoice_amount: invoice_amount,
                    total_amount: total_amount,
                    sub_total_amount: sub_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,
                    surcharge: surcharge,
                    settlement_amount: settlement_amount,
                    settlement_currency: settlement_currency,
                    amex_additional_amounts: amex_additional_amounts,
                    tax_details: tax_details,
                    service_fee_amount: service_fee_amount,
                    original_amount: original_amount,
                    original_currency: original_currency,
                    cashback_amount: cashback_amount,
                    currency_conversion: currency_conversion,
                    oct_surcharge: oct_surcharge,
                    order: order,
                    anticipated_amount: anticipated_amount,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 331

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['refund_balance'] = 'refundBalance'
  @_hash['gift_wrap_amount'] = 'giftWrapAmount'
  @_hash['invoice_amount'] = 'invoiceAmount'
  @_hash['total_amount'] = 'totalAmount'
  @_hash['sub_total_amount'] = 'subTotalAmount'
  @_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['surcharge'] = 'surcharge'
  @_hash['settlement_amount'] = 'settlementAmount'
  @_hash['settlement_currency'] = 'settlementCurrency'
  @_hash['amex_additional_amounts'] = 'amexAdditionalAmounts'
  @_hash['tax_details'] = 'taxDetails'
  @_hash['service_fee_amount'] = 'serviceFeeAmount'
  @_hash['original_amount'] = 'originalAmount'
  @_hash['original_currency'] = 'originalCurrency'
  @_hash['cashback_amount'] = 'cashbackAmount'
  @_hash['currency_conversion'] = 'currencyConversion'
  @_hash['oct_surcharge'] = 'oct-surcharge'
  @_hash['order'] = 'order'
  @_hash['anticipated_amount'] = 'anticipatedAmount'
  @_hash
end

.nullablesObject

An array for nullable fields



407
408
409
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 407

def self.nullables
  []
end

.optionalsObject

An array for optional fields



369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 369

def self.optionals
  %w[
    refund_balance
    gift_wrap_amount
    invoice_amount
    total_amount
    sub_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
    surcharge
    settlement_amount
    settlement_currency
    amex_additional_amounts
    tax_details
    service_fee_amount
    original_amount
    original_currency
    cashback_amount
    currency_conversion
    oct_surcharge
    order
    anticipated_amount
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 762

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} refund_balance: #{@refund_balance.inspect}, gift_wrap_amount:"\
  " #{@gift_wrap_amount.inspect}, invoice_amount: #{@invoice_amount.inspect}, total_amount:"\
  " #{@total_amount.inspect}, sub_total_amount: #{@sub_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}, surcharge:"\
  " #{@surcharge.inspect}, settlement_amount: #{@settlement_amount.inspect},"\
  " settlement_currency: #{@settlement_currency.inspect}, amex_additional_amounts:"\
  " #{@amex_additional_amounts.inspect}, tax_details: #{@tax_details.inspect},"\
  " service_fee_amount: #{@service_fee_amount.inspect}, original_amount:"\
  " #{@original_amount.inspect}, original_currency: #{@original_currency.inspect},"\
  " cashback_amount: #{@cashback_amount.inspect}, currency_conversion:"\
  " #{@currency_conversion.inspect}, oct_surcharge: #{@oct_surcharge.inspect}, order:"\
  " #{@order.inspect}, anticipated_amount: #{@anticipated_amount.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 740

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} refund_balance: #{@refund_balance}, gift_wrap_amount: #{@gift_wrap_amount},"\
  " invoice_amount: #{@invoice_amount}, total_amount: #{@total_amount}, sub_total_amount:"\
  " #{@sub_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}, surcharge: #{@surcharge}, settlement_amount:"\
  " #{@settlement_amount}, settlement_currency: #{@settlement_currency},"\
  " amex_additional_amounts: #{@amex_additional_amounts}, tax_details: #{@tax_details},"\
  " service_fee_amount: #{@service_fee_amount}, original_amount: #{@original_amount},"\
  " original_currency: #{@original_currency}, cashback_amount: #{@cashback_amount},"\
  " currency_conversion: #{@currency_conversion}, oct_surcharge: #{@oct_surcharge}, order:"\
  " #{@order}, anticipated_amount: #{@anticipated_amount}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
# File 'lib/cyber_source_merged_spec/models/amount_details.rb', line 680

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'refundBalance', refund_balance)
  XmlUtilities.add_as_subelement(doc, root, 'giftWrapAmount',
                                 gift_wrap_amount)
  XmlUtilities.add_as_subelement(doc, root, 'invoiceAmount', invoice_amount)
  XmlUtilities.add_as_subelement(doc, root, 'totalAmount', total_amount)
  XmlUtilities.add_as_subelement(doc, root, 'subTotalAmount',
                                 sub_total_amount)
  XmlUtilities.add_as_subelement(doc, root, 'currency', currency)
  XmlUtilities.add_as_subelement(doc, root, 'discountAmount',
                                 discount_amount)
  XmlUtilities.add_as_subelement(doc, root, 'dutyAmount', duty_amount)
  XmlUtilities.add_as_subelement(doc, root, 'gratuityAmount',
                                 gratuity_amount)
  XmlUtilities.add_as_subelement(doc, root, 'taxAmount', tax_amount)
  XmlUtilities.add_as_subelement(doc, root, 'nationalTaxIncluded',
                                 national_tax_included)
  XmlUtilities.add_as_subelement(doc, root, 'taxAppliedAfterDiscount',
                                 tax_applied_after_discount)
  XmlUtilities.add_as_subelement(doc, root, 'taxAppliedLevel',
                                 tax_applied_level)
  XmlUtilities.add_as_subelement(doc, root, 'taxTypeCode', tax_type_code)
  XmlUtilities.add_as_subelement(doc, root, 'freightAmount', freight_amount)
  XmlUtilities.add_as_subelement(doc, root, 'foreignAmount', foreign_amount)
  XmlUtilities.add_as_subelement(doc, root, 'foreignCurrency',
                                 foreign_currency)
  XmlUtilities.add_as_subelement(doc, root, 'exchangeRate', exchange_rate)
  XmlUtilities.add_as_subelement(doc, root, 'exchangeRateTimeStamp',
                                 exchange_rate_time_stamp)
  XmlUtilities.add_as_subelement(doc, root, 'Surcharge', surcharge)
  XmlUtilities.add_as_subelement(doc, root, 'settlementAmount',
                                 settlement_amount)
  XmlUtilities.add_as_subelement(doc, root, 'settlementCurrency',
                                 settlement_currency)
  XmlUtilities.add_array_as_subelement(doc, root, 'AmexAdditionalAmount',
                                       amex_additional_amounts)
  XmlUtilities.add_array_as_subelement(doc, root, 'TaxDetail', tax_details)
  XmlUtilities.add_as_subelement(doc, root, 'serviceFeeAmount',
                                 service_fee_amount)
  XmlUtilities.add_as_subelement(doc, root, 'originalAmount',
                                 original_amount)
  XmlUtilities.add_as_subelement(doc, root, 'originalCurrency',
                                 original_currency)
  XmlUtilities.add_as_subelement(doc, root, 'cashbackAmount',
                                 cashback_amount)
  XmlUtilities.add_as_subelement(doc, root, 'CurrencyConversion',
                                 currency_conversion)
  XmlUtilities.add_as_subelement(doc, root, 'OctSurcharge', oct_surcharge)
  XmlUtilities.add_as_subelement(doc, root, 'Order', order)
  XmlUtilities.add_as_subelement(doc, root, 'anticipatedAmount',
                                 anticipated_amount)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end