Class: VisaAcceptanceMergedSpec::LineItem3

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

Overview

LineItem3 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(product_code: SKIP, product_name: SKIP, product_sku: SKIP, quantity: 1, unit_price: SKIP, unit_of_measure: SKIP, total_amount: SKIP, tax_amount: SKIP, tax_rate: SKIP, tax_applied_after_discount: SKIP, tax_status_indicator: SKIP, tax_type_code: SKIP, amount_includes_tax: SKIP, type_of_supply: SKIP, commodity_code: SKIP, discount_amount: SKIP, discount_applied: SKIP, discount_rate: SKIP, invoice_number: SKIP, tax_details: SKIP, fulfillment_type: SKIP, weight: SKIP, weight_identifier: SKIP, weight_unit: SKIP, reference_data_code: SKIP, reference_data_number: SKIP, unit_tax_amount: SKIP, measurement: SKIP, product_description: SKIP, gift_card_currency: SKIP, shipping_destination_types: SKIP, gift: SKIP, passenger: SKIP, allowed_export_countries: SKIP, restricted_export_countries: SKIP, additional_properties: nil) ⇒ LineItem3

Returns a new instance of LineItem3.



455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
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
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 455

def initialize(product_code: SKIP, product_name: SKIP, product_sku: SKIP,
               quantity: 1, unit_price: SKIP, unit_of_measure: SKIP,
               total_amount: SKIP, tax_amount: SKIP, tax_rate: SKIP,
               tax_applied_after_discount: SKIP, tax_status_indicator: SKIP,
               tax_type_code: SKIP, amount_includes_tax: SKIP,
               type_of_supply: SKIP, commodity_code: SKIP,
               discount_amount: SKIP, discount_applied: SKIP,
               discount_rate: SKIP, invoice_number: SKIP, tax_details: SKIP,
               fulfillment_type: SKIP, weight: SKIP,
               weight_identifier: SKIP, weight_unit: SKIP,
               reference_data_code: SKIP, reference_data_number: SKIP,
               unit_tax_amount: SKIP, measurement: SKIP,
               product_description: SKIP, gift_card_currency: SKIP,
               shipping_destination_types: SKIP, gift: SKIP,
               passenger: SKIP, allowed_export_countries: SKIP,
               restricted_export_countries: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @product_code = product_code unless product_code == SKIP
  @product_name = product_name unless product_name == SKIP
  @product_sku = product_sku unless product_sku == SKIP
  @quantity = quantity unless quantity == SKIP
  @unit_price = unit_price unless unit_price == SKIP
  @unit_of_measure = unit_of_measure unless unit_of_measure == SKIP
  @total_amount = total_amount unless total_amount == SKIP
  @tax_amount = tax_amount unless tax_amount == SKIP
  @tax_rate = tax_rate unless tax_rate == SKIP
  unless tax_applied_after_discount == SKIP
    @tax_applied_after_discount =
      tax_applied_after_discount
  end
  @tax_status_indicator = tax_status_indicator unless tax_status_indicator == SKIP
  @tax_type_code = tax_type_code unless tax_type_code == SKIP
  @amount_includes_tax = amount_includes_tax unless amount_includes_tax == SKIP
  @type_of_supply = type_of_supply unless type_of_supply == SKIP
  @commodity_code = commodity_code unless commodity_code == SKIP
  @discount_amount = discount_amount unless discount_amount == SKIP
  @discount_applied = discount_applied unless discount_applied == SKIP
  @discount_rate = discount_rate unless discount_rate == SKIP
  @invoice_number = invoice_number unless invoice_number == SKIP
  @tax_details = tax_details unless tax_details == SKIP
  @fulfillment_type = fulfillment_type unless fulfillment_type == SKIP
  @weight = weight unless weight == SKIP
  @weight_identifier = weight_identifier unless weight_identifier == SKIP
  @weight_unit = weight_unit unless weight_unit == SKIP
  @reference_data_code = reference_data_code unless reference_data_code == SKIP
  @reference_data_number = reference_data_number unless reference_data_number == SKIP
  @unit_tax_amount = unit_tax_amount unless unit_tax_amount == SKIP
  @measurement = measurement unless measurement == SKIP
  @product_description = product_description unless product_description == SKIP
  @gift_card_currency = gift_card_currency unless gift_card_currency == SKIP
  unless shipping_destination_types == SKIP
    @shipping_destination_types =
      shipping_destination_types
  end
  @gift = gift unless gift == SKIP
  @passenger = passenger unless passenger == SKIP
  @allowed_export_countries = allowed_export_countries unless allowed_export_countries == SKIP
  unless restricted_export_countries == SKIP
    @restricted_export_countries =
      restricted_export_countries
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#allowed_export_countriesArray[String]

This field is only used in DM service. Determines whether to assign risk to the order if the billing and shipping addresses specify different cities, states, or countries. This field can contain one of the following values:

  • true: Orders are assigned only slight additional risk if billing and shipping addresses are different.
  • false: Orders are assigned higher additional risk if billing and shipping addresses are different.

Returns:

  • (Array[String])


355
356
357
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 355

def allowed_export_countries
  @allowed_export_countries
end

#amount_includes_taxTrueClass | FalseClass

Flag that indicates whether the tax amount is included in the Line Item Total. Possible values:

  • true
  • false

Returns:

  • (TrueClass | FalseClass)


188
189
190
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 188

def amount_includes_tax
  @amount_includes_tax
end

#commodity_codeString

Commodity code or International description code used to classify the item. Contact your acquirer for a list of codes.

Returns:

  • (String)


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

def commodity_code
  @commodity_code
end

#discount_amountString

Discount applied to the item.

Returns:

  • (String)


205
206
207
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 205

def discount_amount
  @discount_amount
end

#discount_appliedTrueClass | FalseClass

Flag that indicates whether the amount is discounted. If you do not provide a value but you set Discount Amount to a value greater than zero, then Visa Acceptance sets this field to true. Possible values:

  • true
  • false

Returns:

  • (TrueClass | FalseClass)


215
216
217
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 215

def discount_applied
  @discount_applied
end

#discount_rateString

Rate the item is discounted. Maximum of 2 decimal places. Example 5.25 (=5.25%)

Returns:

  • (String)


220
221
222
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 220

def discount_rate
  @discount_rate
end

#fulfillment_typeString

Information about the product code used for the line item. Possible values:

  • E: The product code is electronic_software.
  • P: The product code is not electronic_software. For details, see the fulfillmentType field description in [Business Center Reporting User Guide.] (

Returns:

  • (String)


246
247
248
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 246

def fulfillment_type
  @fulfillment_type
end

#giftTrueClass | FalseClass

This field is only used in DM service. Determines whether to assign risk to the order if the billing and shipping addresses specify different cities, states, or countries. This field can contain one of the following values:

  • true: Orders are assigned only slight additional risk if billing and shipping addresses are different.
  • false: Orders are assigned higher additional risk if billing and shipping addresses are different.

Returns:

  • (TrueClass | FalseClass)


333
334
335
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 333

def gift
  @gift
end

#gift_card_currencyInteger

When orderInformation.lineItems[].productCode is "gift_card", this is the currency used for the gift card purchase. For the possible values, see the [ISO Standard Currency Codes.](

Returns:

  • (Integer)


317
318
319
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 317

def gift_card_currency
  @gift_card_currency
end

#invoice_numberString

Field to support an invoice number for a transaction. You must specify the number of line items that will include an invoice number. By default, the first line item will include an invoice number field. The invoice number field can be included for up to 10 line items.

Returns:

  • (String)


228
229
230
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 228

def invoice_number
  @invoice_number
end

#measurementString

This field would contain measurement of a line item.

Returns:

  • (String)


306
307
308
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 306

def measurement
  @measurement
end

#passengerPassenger2

This field is only used in DM service. Determines whether to assign risk to the order if the billing and shipping addresses specify different cities, states, or countries. This field can contain one of the following values:

  • true: Orders are assigned only slight additional risk if billing and shipping addresses are different.
  • false: Orders are assigned higher additional risk if billing and shipping addresses are different.

Returns:



344
345
346
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 344

def passenger
  @passenger
end

#product_codeString

Type of product. The value for this field is used to identify the product category (electronic, handling, physical, service, or shipping). The default value is default. If you are performing an authorization transaction (processingOptions.capture is set to false), and you set this field to a value other than default or one of the values related to shipping and/or handling, then orderInformation.lineItems[].quantity, orderInformation.lineItems[].productName, and orderInformation.lineItems[].productSku fields are required. Optional field.

Tax Calculation

Optional field for U.S., Canadian, international tax, and value added taxes. The Product Codes for the tax service are located in the Visa Acceptance Tax Codes guide. Contact Customer Support to request the guide. If you don’t send a tax service Product Code in your tax request, product-based rules or exemptions will not be applied and the transaction will default to fully taxable in the locations where you’ve indicated you need to collect tax [by way of nexus, no nexus, or seller registration number fields].

Returns:

  • (String)


34
35
36
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 34

def product_code
  @product_code
end

#product_descriptionString

Brief description of item.

Returns:

  • (String)


310
311
312
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 310

def product_description
  @product_description
end

#product_nameString

For an authorization or capture transaction (processingOptions.capture is true or false), this field is required when orderInformation.lineItems[].productCode is not default or one of the other values that are related to shipping and/or handling.

Tax Calculation

Optional field for U.S., Canadian, international tax, and value added taxes.

Returns:

  • (String)


45
46
47
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 45

def product_name
  @product_name
end

#product_skuString

Product identifier code. Also known as the Stock Keeping Unit (SKU) code for the product. For an authorization or capture transaction (processingOptions.capture is set to true or false), this field is required when orderInformation.lineItems[].productCode is not set to default or one of the other values that are related to shipping and/or handling.

Tax Calculation

Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. For an authorization or capture transaction (processingOptions.capture is set to true or false), this field is required when orderInformation.lineItems[].productCode is not default or one of the values related to shipping and/or handling.

Returns:

  • (String)


61
62
63
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 61

def product_sku
  @product_sku
end

#quantityInteger

Number of units for this order. Must be a non-negative integer. The default is 1. For an authorization or capture transaction (processingOptions.capture is set to true or false), this field is required when orderInformation.lineItems[].productCode is not default or one of the other values related to shipping and/or handling.

Tax Calculation

Optional field for U.S., Canadian, international tax, and value added taxes.

Returns:

  • (Integer)


73
74
75
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 73

def quantity
  @quantity
end

#reference_data_codeString

Code that identifies the value of the corresponding orderInformation.lineItems[].referenceDataNumber field. Possible values:

  • AN: Client-defined asset code
  • MG: Manufacturer's part number
  • PO: Purchase order number
  • SK: Supplier stock keeping unit number
  • UP: Universal product code
  • VC: Supplier catalog number
  • VP: Vendor part number This field is a pass-through, which means that Visa Acceptance does not verify the value or modify it in any way before sending it to the processor.

Returns:

  • (String)


279
280
281
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 279

def reference_data_code
  @reference_data_code
end

#reference_data_numberString

Reference number. The meaning of this value is identified by the value of the corresponding referenceDataCode field. See Numbered Elements. The maximum length for this field depends on the value of the corresponding referenceDataCode field:

  • When the code is PO, the maximum length for the reference number is
  • When the code is VC, the maximum length for the reference number is
  • For all other codes, the maximum length for the reference number is 30. This field is a pass-through, which means that Visa Acceptance does not verify the value or modify it in any way before sending it to the processor.

Returns:

  • (String)


296
297
298
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 296

def reference_data_number
  @reference_data_number
end

#restricted_export_countriesArray[String]

This field is only used in DM service. Determines whether to assign risk to the order if the billing and shipping addresses specify different cities, states, or countries. This field can contain one of the following values:

  • true: Orders are assigned only slight additional risk if billing and shipping addresses are different.
  • false: Orders are assigned higher additional risk if billing and shipping addresses are different.

Returns:

  • (Array[String])


366
367
368
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 366

def restricted_export_countries
  @restricted_export_countries
end

#shipping_destination_typesString

Destination to where the item will be shipped. Example: Commercial, Residential, Store

Returns:

  • (String)


322
323
324
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 322

def shipping_destination_types
  @shipping_destination_types
end

#tax_amountString

Total tax to apply to the product. This value cannot be negative. The tax amount and the offer amount must be in the same currency. The tax amount field is additive. The following example uses a two-exponent currency such as USD:

  1. You include each line item in your request. ..- 1st line item has amount=10.00, quantity=1, and taxAmount=0.80 ..- 2nd line item has amount=20.00, quantity=1, and taxAmount=1.60
  2. The total amount authorized will be 32.40, not 30.00 with 2.40 of tax included. Optional field.

Airlines processing

Tax portion of the order amount. This value cannot exceed 99999999999999 (fourteen 9s). Format: English characters only. Optional request field for a line item.

Tax Calculation

Optional field for U.S., Canadian, international tax, and value added taxes. Note if you send this field in your tax request, the value in the field will override the tax engine

Returns:

  • (String)


133
134
135
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 133

def tax_amount
  @tax_amount
end

#tax_applied_after_discountString

Flag to indicate how you handle discount at the line item level.

  • 0: no line level discount provided
  • 1: tax was calculated on the post-discount line item total
  • 2: tax was calculated on the pre-discount line item total Note Visa will inset 0 (zero) if an invalid value is included in this field. This field relates to the value in the lineItems.discountAmount field.

Returns:

  • (String)


151
152
153
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 151

def tax_applied_after_discount
  @tax_applied_after_discount
end

#tax_detailsArray[TaxDetails1]

Field to support an invoice number for a transaction. You must specify the number of line items that will include an invoice number. By default, the first line item will include an invoice number field. The invoice number field can be included for up to 10 line items.

Returns:



236
237
238
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 236

def tax_details
  @tax_details
end

#tax_rateString

Tax rate applied to the item. Visa: Valid range is 0.01 to 0.99 (1% to 99%, with only whole percentage values accepted; values with additional decimal places will be truncated). Mastercard: Valid range is 0.00001 to 0.99999 (0.001% to 99.999%).

Returns:

  • (String)


141
142
143
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 141

def tax_rate
  @tax_rate
end

#tax_status_indicatorString

Flag to indicate whether tax is exempted or not included.

  • 0: tax not included
  • 1: tax included
  • 2: transaction is not subject to tax

Returns:

  • (String)


158
159
160
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 158

def tax_status_indicator
  @tax_status_indicator
end

#tax_type_codeString

Type of tax being applied to the item.

FDC Nashville Global

  • alternate_tax_type_applied
  • alternate_tax_type_identifier

Worldpay VAP

  • alternate_tax_type_identifier

RBS WorldPay Atlanta

  • tax_type_applied

TSYS Acquiring Solutions

  • tax_type_applied
  • local_tax_indicator

Chase Paymentech Solutions

  • tax_type_applied

Elavon Americas

  • local_tax_indicator

FDC Compass

  • tax_type_applied

OmniPay Direct

  • local_tax_indicator

Returns:

  • (String)


180
181
182
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 180

def tax_type_code
  @tax_type_code
end

#total_amountString

Total amount for the item. Normally calculated as the unit price times quantity. When orderInformation.lineItems[].productCode is "gift_card", this is the purchase amount total for prepaid gift cards in major units. Example: 123.45 USD = 123

Returns:

  • (String)


110
111
112
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 110

def total_amount
  @total_amount
end

#type_of_supplyString

Flag to indicate whether the purchase is categorized as goods or services. Possible values:

  • 00: goods
  • 01: services

Returns:

  • (String)


195
196
197
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 195

def type_of_supply
  @type_of_supply
end

#unit_of_measureString

Unit of measure, or unit of measure code, for the item.

Returns:

  • (String)


101
102
103
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 101

def unit_of_measure
  @unit_of_measure
end

#unit_priceString

Per-item price of the product. This value for this field cannot be negative. You must include either this field or the request-level field orderInformation.amountDetails.totalAmount in your request. You can include a decimal point (.), but you cannot include any other special characters. The value is truncated to the correct number of decimal places.

DCC with a Third-Party Provider

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

Tax Calculation

Required field for U.S., Canadian, international and value added taxes.

Zero Amount Authorizations

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.

Maximum Field Lengths

For GPN and JCN Gateway: Decimal (10) All other processors: Decimal (15)

Returns:

  • (String)


97
98
99
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 97

def unit_price
  @unit_price
end

#unit_tax_amountString

Per-item tax amount of the product. Note The amount value must be a non-negative number containing 2 decimal places and limited to 7 digits before the decimal point.

Returns:

  • (String)


302
303
304
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 302

def unit_tax_amount
  @unit_tax_amount
end

#weightString

Weight of the item.

Returns:

  • (String)


250
251
252
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 250

def weight
  @weight
end

#weight_identifierString

Type of weight. Possible values:

  • B: Billed weight
  • N: Actual net weight

Returns:

  • (String)


257
258
259
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 257

def weight_identifier
  @weight_identifier
end

#weight_unitString

Code that specifies the unit of measurement for the weight amount. For example, OZ specifies ounce and LB specifies pound. The possible values are defined by the ANSI Accredited Standards Committee (ASC).

Returns:

  • (String)


263
264
265
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 263

def weight_unit
  @weight_unit
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
584
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
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 523

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  product_code = hash.key?('productCode') ? hash['productCode'] : SKIP
  product_name = hash.key?('productName') ? hash['productName'] : SKIP
  product_sku = hash.key?('productSku') ? hash['productSku'] : SKIP
  quantity = hash['quantity'] ||= 1
  unit_price = hash.key?('unitPrice') ? hash['unitPrice'] : SKIP
  unit_of_measure =
    hash.key?('unitOfMeasure') ? hash['unitOfMeasure'] : SKIP
  total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : SKIP
  tax_amount = hash.key?('taxAmount') ? hash['taxAmount'] : SKIP
  tax_rate = hash.key?('taxRate') ? hash['taxRate'] : SKIP
  tax_applied_after_discount =
    hash.key?('taxAppliedAfterDiscount') ? hash['taxAppliedAfterDiscount'] : SKIP
  tax_status_indicator =
    hash.key?('taxStatusIndicator') ? hash['taxStatusIndicator'] : SKIP
  tax_type_code = hash.key?('taxTypeCode') ? hash['taxTypeCode'] : SKIP
  amount_includes_tax =
    hash.key?('amountIncludesTax') ? hash['amountIncludesTax'] : SKIP
  type_of_supply = hash.key?('typeOfSupply') ? hash['typeOfSupply'] : SKIP
  commodity_code = hash.key?('commodityCode') ? hash['commodityCode'] : SKIP
  discount_amount =
    hash.key?('discountAmount') ? hash['discountAmount'] : SKIP
  discount_applied =
    hash.key?('discountApplied') ? hash['discountApplied'] : SKIP
  discount_rate = hash.key?('discountRate') ? hash['discountRate'] : SKIP
  invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : SKIP
  # 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')
  fulfillment_type =
    hash.key?('fulfillmentType') ? hash['fulfillmentType'] : SKIP
  weight = hash.key?('weight') ? hash['weight'] : SKIP
  weight_identifier =
    hash.key?('weightIdentifier') ? hash['weightIdentifier'] : SKIP
  weight_unit = hash.key?('weightUnit') ? hash['weightUnit'] : SKIP
  reference_data_code =
    hash.key?('referenceDataCode') ? hash['referenceDataCode'] : SKIP
  reference_data_number =
    hash.key?('referenceDataNumber') ? hash['referenceDataNumber'] : SKIP
  unit_tax_amount =
    hash.key?('unitTaxAmount') ? hash['unitTaxAmount'] : SKIP
  measurement = hash.key?('measurement') ? hash['measurement'] : SKIP
  product_description =
    hash.key?('productDescription') ? hash['productDescription'] : SKIP
  gift_card_currency =
    hash.key?('giftCardCurrency') ? hash['giftCardCurrency'] : SKIP
  shipping_destination_types =
    hash.key?('shippingDestinationTypes') ? hash['shippingDestinationTypes'] : SKIP
  gift = hash.key?('gift') ? hash['gift'] : SKIP
  passenger = Passenger2.from_hash(hash['passenger']) if hash['passenger']
  allowed_export_countries =
    hash.key?('allowedExportCountries') ? hash['allowedExportCountries'] : SKIP
  restricted_export_countries =
    hash.key?('restrictedExportCountries') ? hash['restrictedExportCountries'] : 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.
  LineItem3.new(product_code: product_code,
                product_name: product_name,
                product_sku: product_sku,
                quantity: quantity,
                unit_price: unit_price,
                unit_of_measure: unit_of_measure,
                total_amount: total_amount,
                tax_amount: tax_amount,
                tax_rate: tax_rate,
                tax_applied_after_discount: tax_applied_after_discount,
                tax_status_indicator: tax_status_indicator,
                tax_type_code: tax_type_code,
                amount_includes_tax: amount_includes_tax,
                type_of_supply: type_of_supply,
                commodity_code: commodity_code,
                discount_amount: discount_amount,
                discount_applied: discount_applied,
                discount_rate: discount_rate,
                invoice_number: invoice_number,
                tax_details: tax_details,
                fulfillment_type: fulfillment_type,
                weight: weight,
                weight_identifier: weight_identifier,
                weight_unit: weight_unit,
                reference_data_code: reference_data_code,
                reference_data_number: reference_data_number,
                unit_tax_amount: unit_tax_amount,
                measurement: measurement,
                product_description: product_description,
                gift_card_currency: gift_card_currency,
                shipping_destination_types: shipping_destination_types,
                gift: gift,
                passenger: passenger,
                allowed_export_countries: allowed_export_countries,
                restricted_export_countries: restricted_export_countries,
                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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
405
406
407
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 369

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['product_code'] = 'productCode'
  @_hash['product_name'] = 'productName'
  @_hash['product_sku'] = 'productSku'
  @_hash['quantity'] = 'quantity'
  @_hash['unit_price'] = 'unitPrice'
  @_hash['unit_of_measure'] = 'unitOfMeasure'
  @_hash['total_amount'] = 'totalAmount'
  @_hash['tax_amount'] = 'taxAmount'
  @_hash['tax_rate'] = 'taxRate'
  @_hash['tax_applied_after_discount'] = 'taxAppliedAfterDiscount'
  @_hash['tax_status_indicator'] = 'taxStatusIndicator'
  @_hash['tax_type_code'] = 'taxTypeCode'
  @_hash['amount_includes_tax'] = 'amountIncludesTax'
  @_hash['type_of_supply'] = 'typeOfSupply'
  @_hash['commodity_code'] = 'commodityCode'
  @_hash['discount_amount'] = 'discountAmount'
  @_hash['discount_applied'] = 'discountApplied'
  @_hash['discount_rate'] = 'discountRate'
  @_hash['invoice_number'] = 'invoiceNumber'
  @_hash['tax_details'] = 'taxDetails'
  @_hash['fulfillment_type'] = 'fulfillmentType'
  @_hash['weight'] = 'weight'
  @_hash['weight_identifier'] = 'weightIdentifier'
  @_hash['weight_unit'] = 'weightUnit'
  @_hash['reference_data_code'] = 'referenceDataCode'
  @_hash['reference_data_number'] = 'referenceDataNumber'
  @_hash['unit_tax_amount'] = 'unitTaxAmount'
  @_hash['measurement'] = 'measurement'
  @_hash['product_description'] = 'productDescription'
  @_hash['gift_card_currency'] = 'giftCardCurrency'
  @_hash['shipping_destination_types'] = 'shippingDestinationTypes'
  @_hash['gift'] = 'gift'
  @_hash['passenger'] = 'passenger'
  @_hash['allowed_export_countries'] = 'allowedExportCountries'
  @_hash['restricted_export_countries'] = 'restrictedExportCountries'
  @_hash
end

.nullablesObject

An array for nullable fields



451
452
453
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 451

def self.nullables
  []
end

.optionalsObject

An array for optional fields



410
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
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 410

def self.optionals
  %w[
    product_code
    product_name
    product_sku
    quantity
    unit_price
    unit_of_measure
    total_amount
    tax_amount
    tax_rate
    tax_applied_after_discount
    tax_status_indicator
    tax_type_code
    amount_includes_tax
    type_of_supply
    commodity_code
    discount_amount
    discount_applied
    discount_rate
    invoice_number
    tax_details
    fulfillment_type
    weight
    weight_identifier
    weight_unit
    reference_data_code
    reference_data_number
    unit_tax_amount
    measurement
    product_description
    gift_card_currency
    shipping_destination_types
    gift
    passenger
    allowed_export_countries
    restricted_export_countries
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 658

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} product_code: #{@product_code.inspect}, product_name:"\
  " #{@product_name.inspect}, product_sku: #{@product_sku.inspect}, quantity:"\
  " #{@quantity.inspect}, unit_price: #{@unit_price.inspect}, unit_of_measure:"\
  " #{@unit_of_measure.inspect}, total_amount: #{@total_amount.inspect}, tax_amount:"\
  " #{@tax_amount.inspect}, tax_rate: #{@tax_rate.inspect}, tax_applied_after_discount:"\
  " #{@tax_applied_after_discount.inspect}, tax_status_indicator:"\
  " #{@tax_status_indicator.inspect}, tax_type_code: #{@tax_type_code.inspect},"\
  " amount_includes_tax: #{@amount_includes_tax.inspect}, type_of_supply:"\
  " #{@type_of_supply.inspect}, commodity_code: #{@commodity_code.inspect}, discount_amount:"\
  " #{@discount_amount.inspect}, discount_applied: #{@discount_applied.inspect},"\
  " discount_rate: #{@discount_rate.inspect}, invoice_number: #{@invoice_number.inspect},"\
  " tax_details: #{@tax_details.inspect}, fulfillment_type: #{@fulfillment_type.inspect},"\
  " weight: #{@weight.inspect}, weight_identifier: #{@weight_identifier.inspect}, weight_unit:"\
  " #{@weight_unit.inspect}, reference_data_code: #{@reference_data_code.inspect},"\
  " reference_data_number: #{@reference_data_number.inspect}, unit_tax_amount:"\
  " #{@unit_tax_amount.inspect}, measurement: #{@measurement.inspect}, product_description:"\
  " #{@product_description.inspect}, gift_card_currency: #{@gift_card_currency.inspect},"\
  " shipping_destination_types: #{@shipping_destination_types.inspect}, gift:"\
  " #{@gift.inspect}, passenger: #{@passenger.inspect}, allowed_export_countries:"\
  " #{@allowed_export_countries.inspect}, restricted_export_countries:"\
  " #{@restricted_export_countries.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
# File 'lib/visa_acceptance_merged_spec/models/line_item3.rb', line 635

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} product_code: #{@product_code}, product_name: #{@product_name},"\
  " product_sku: #{@product_sku}, quantity: #{@quantity}, unit_price: #{@unit_price},"\
  " unit_of_measure: #{@unit_of_measure}, total_amount: #{@total_amount}, tax_amount:"\
  " #{@tax_amount}, tax_rate: #{@tax_rate}, tax_applied_after_discount:"\
  " #{@tax_applied_after_discount}, tax_status_indicator: #{@tax_status_indicator},"\
  " tax_type_code: #{@tax_type_code}, amount_includes_tax: #{@amount_includes_tax},"\
  " type_of_supply: #{@type_of_supply}, commodity_code: #{@commodity_code}, discount_amount:"\
  " #{@discount_amount}, discount_applied: #{@discount_applied}, discount_rate:"\
  " #{@discount_rate}, invoice_number: #{@invoice_number}, tax_details: #{@tax_details},"\
  " fulfillment_type: #{@fulfillment_type}, weight: #{@weight}, weight_identifier:"\
  " #{@weight_identifier}, weight_unit: #{@weight_unit}, reference_data_code:"\
  " #{@reference_data_code}, reference_data_number: #{@reference_data_number},"\
  " unit_tax_amount: #{@unit_tax_amount}, measurement: #{@measurement}, product_description:"\
  " #{@product_description}, gift_card_currency: #{@gift_card_currency},"\
  " shipping_destination_types: #{@shipping_destination_types}, gift: #{@gift}, passenger:"\
  " #{@passenger}, allowed_export_countries: #{@allowed_export_countries},"\
  " restricted_export_countries: #{@restricted_export_countries}, additional_properties:"\
  " #{@additional_properties}>"
end