Class: CyberSourceMergedSpec::LineItem4

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

Overview

LineItem4 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, additional_properties: nil) ⇒ LineItem4

Returns a new instance of LineItem4.



294
295
296
297
298
299
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
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 294

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,
               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
  @additional_properties = additional_properties
end

Instance Attribute Details

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


187
188
189
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 187

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)


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

def commodity_code
  @commodity_code
end

#discount_amountString

Discount applied to the item.

Returns:

  • (String)


204
205
206
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 204

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 CyberSource sets this field to true. Possible values:

  • true
  • false

Returns:

  • (TrueClass | FalseClass)


214
215
216
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 214

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)


219
220
221
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 219

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


227
228
229
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 227

def invoice_number
  @invoice_number
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 Cybersource 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)


33
34
35
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 33

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


44
45
46
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 44

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)


60
61
62
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 60

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)


72
73
74
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 72

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


132
133
134
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 132

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)


150
151
152
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 150

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:



235
236
237
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 235

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)


140
141
142
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 140

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)


157
158
159
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 157

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)


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

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)


109
110
111
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 109

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)


194
195
196
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 194

def type_of_supply
  @type_of_supply
end

#unit_of_measureString

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

Returns:

  • (String)


100
101
102
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 100

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)


96
97
98
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 96

def unit_price
  @unit_price
end

Class Method Details

.from_element(root) ⇒ Object



404
405
406
407
408
409
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
449
450
451
452
453
454
455
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 404

def self.from_element(root)
  product_code = XmlUtilities.from_element(root, 'productCode', String)
  product_name = XmlUtilities.from_element(root, 'productName', String)
  product_sku = XmlUtilities.from_element(root, 'productSku', String)
  quantity = XmlUtilities.from_element(root, 'quantity', Integer)
  unit_price = XmlUtilities.from_element(root, 'unitPrice', String)
  unit_of_measure = XmlUtilities.from_element(root, 'unitOfMeasure', String)
  total_amount = XmlUtilities.from_element(root, 'totalAmount', String)
  tax_amount = XmlUtilities.from_element(root, 'taxAmount', String)
  tax_rate = XmlUtilities.from_element(root, 'taxRate', String)
  tax_applied_after_discount = XmlUtilities.from_element(
    root, 'taxAppliedAfterDiscount', String
  )
  tax_status_indicator = XmlUtilities.from_element(root,
                                                   'taxStatusIndicator',
                                                   String)
  tax_type_code = XmlUtilities.from_element(root, 'taxTypeCode', String)
  amount_includes_tax = XmlUtilities.from_element(root, 'amountIncludesTax',
                                                  TrueClass)
  type_of_supply = XmlUtilities.from_element(root, 'typeOfSupply', String)
  commodity_code = XmlUtilities.from_element(root, 'commodityCode', String)
  discount_amount = XmlUtilities.from_element(root, 'discountAmount',
                                              String)
  discount_applied = XmlUtilities.from_element(root, 'discountApplied',
                                               TrueClass)
  discount_rate = XmlUtilities.from_element(root, 'discountRate', String)
  invoice_number = XmlUtilities.from_element(root, 'invoiceNumber', String)
  tax_details = XmlUtilities.from_element_to_array(root, 'TaxDetails1',
                                                   TaxDetails1)

  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,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 333

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

  # 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.
  LineItem4.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,
                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 238

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
end

.nullablesObject

An array for nullable fields



290
291
292
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 290

def self.nullables
  []
end

.optionalsObject

An array for optional fields



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 264

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
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 509

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}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



494
495
496
497
498
499
500
501
502
503
504
505
506
# File 'lib/cyber_source_merged_spec/models/line_item4.rb', line 494

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},"\
  " additional_properties: #{@additional_properties}>"
end

#to_xml_element(doc, root_name) ⇒ Object



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

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

  XmlUtilities.add_as_subelement(doc, root, 'productCode', product_code)
  XmlUtilities.add_as_subelement(doc, root, 'productName', product_name)
  XmlUtilities.add_as_subelement(doc, root, 'productSku', product_sku)
  XmlUtilities.add_as_subelement(doc, root, 'quantity', quantity)
  XmlUtilities.add_as_subelement(doc, root, 'unitPrice', unit_price)
  XmlUtilities.add_as_subelement(doc, root, 'unitOfMeasure',
                                 unit_of_measure)
  XmlUtilities.add_as_subelement(doc, root, 'totalAmount', total_amount)
  XmlUtilities.add_as_subelement(doc, root, 'taxAmount', tax_amount)
  XmlUtilities.add_as_subelement(doc, root, 'taxRate', tax_rate)
  XmlUtilities.add_as_subelement(doc, root, 'taxAppliedAfterDiscount',
                                 tax_applied_after_discount)
  XmlUtilities.add_as_subelement(doc, root, 'taxStatusIndicator',
                                 tax_status_indicator)
  XmlUtilities.add_as_subelement(doc, root, 'taxTypeCode', tax_type_code)
  XmlUtilities.add_as_subelement(doc, root, 'amountIncludesTax',
                                 amount_includes_tax)
  XmlUtilities.add_as_subelement(doc, root, 'typeOfSupply', type_of_supply)
  XmlUtilities.add_as_subelement(doc, root, 'commodityCode', commodity_code)
  XmlUtilities.add_as_subelement(doc, root, 'discountAmount',
                                 discount_amount)
  XmlUtilities.add_as_subelement(doc, root, 'discountApplied',
                                 discount_applied)
  XmlUtilities.add_as_subelement(doc, root, 'discountRate', discount_rate)
  XmlUtilities.add_as_subelement(doc, root, 'invoiceNumber', invoice_number)
  XmlUtilities.add_array_as_subelement(doc, root, 'TaxDetails1',
                                       tax_details)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end