Class: CyberSourceMergedSpec::LineItem
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::LineItem
- Defined in:
- lib/cyber_source_merged_spec/models/line_item.rb
Overview
LineItem Model.
Instance Attribute Summary collapse
-
#allowed_export_countries ⇒ Array[String]
Contains travel-related passenger details used by DM service only.
-
#amount_includes_tax ⇒ TrueClass | FalseClass
Flag that indicates whether the tax amount is included in the Line Item Total.
-
#commodity_code ⇒ String
Commodity code or International description code used to classify the item.
-
#discount_amount ⇒ String
Discount applied to the item.
-
#discount_applied ⇒ TrueClass | FalseClass
Flag that indicates whether the amount is discounted.
-
#discount_rate ⇒ String
Rate the item is discounted.
-
#fulfillment_type ⇒ String
Information about the product code used for the line item.
-
#gift ⇒ TrueClass | FalseClass
This field is only used in DM service.
-
#gift_card_currency ⇒ Integer
When
orderInformation.lineItems[].productCodeis "gift_card", this is the currency used for the gift card purchase. -
#invoice_number ⇒ String
Field to support an invoice number for a transaction.
-
#measurement ⇒ String
This field would contain measurement of a line item.
-
#passenger ⇒ Passenger
Contains travel-related passenger details used by DM service only.
-
#product_code ⇒ String
Type of product.
-
#product_description ⇒ String
Brief description of item.
-
#product_name ⇒ String
For an authorization or capture transaction (
processingOptions.captureistrueorfalse), this field is required whenorderInformation.lineItems[].productCodeis notdefaultor one of the other values that are related to shipping and/or handling. -
#product_sku ⇒ String
Product identifier code.
-
#quantity ⇒ Integer
Number of units for this order.
-
#reference_data_code ⇒ String
Code that identifies the value of the corresponding
orderInformation.lineItems[].referenceDataNumberfield. -
#reference_data_number ⇒ String
Reference number.
-
#restricted_export_countries ⇒ Array[String]
Contains travel-related passenger details used by DM service only.
-
#shipping_destination_types ⇒ String
Destination to where the item will be shipped.
-
#tax_amount ⇒ String
Total tax to apply to the product.
-
#tax_applied_after_discount ⇒ String
Flag to indicate how you handle discount at the line item level.
-
#tax_details ⇒ Array[TaxDetail]
Field to support an invoice number for a transaction.
-
#tax_rate ⇒ String
Tax rate applied to the item.
-
#tax_status_indicator ⇒ String
Flag to indicate whether tax is exempted or not included.
-
#tax_type_code ⇒ String
Type of tax being applied to the item.
-
#total_amount ⇒ String
Total amount for the item.
-
#type_of_supply ⇒ String
Flag to indicate whether the purchase is categorized as goods or services.
-
#unit_of_measure ⇒ String
Unit of measure, or unit of measure code, for the item.
-
#unit_price ⇒ String
Per-item price of the product.
-
#unit_tax_amount ⇒ String
Per-item tax amount of the product.
-
#weight ⇒ String
Weight of the item.
-
#weight_identifier ⇒ String
Type of weight.
-
#weight_unit ⇒ String
Code that specifies the unit of measurement for the weight amount.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#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) ⇒ LineItem
constructor
A new instance of LineItem.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ Object
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) ⇒ LineItem
Returns a new instance of LineItem.
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 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 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 436 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_countries ⇒ Array[String]
Contains travel-related passenger details used by DM service only.
343 344 345 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 343 def allowed_export_countries @allowed_export_countries end |
#amount_includes_tax ⇒ TrueClass | FalseClass
Flag that indicates whether the tax amount is included in the Line Item Total. Possible values:
- true
- false
187 188 189 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 187 def amount_includes_tax @amount_includes_tax end |
#commodity_code ⇒ String
Commodity code or International description code used to classify the item. Contact your acquirer for a list of codes.
200 201 202 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 200 def commodity_code @commodity_code end |
#discount_amount ⇒ String
Discount applied to the item.
204 205 206 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 204 def discount_amount @discount_amount end |
#discount_applied ⇒ TrueClass | 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
214 215 216 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 214 def discount_applied @discount_applied end |
#discount_rate ⇒ String
Rate the item is discounted. Maximum of 2 decimal places. Example 5.25 (=5.25%)
219 220 221 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 219 def discount_rate @discount_rate end |
#fulfillment_type ⇒ String
Information about the product code used for the line item. Possible values:
E: The product code iselectronic_software.P: The product code is notelectronic_software. For details, see thefulfillmentTypefield description in [Business Center Reporting User Guide.] (https://apps.cybersource.com/library/documentation/dev_guides/reporting_a nd_reconciliation/Reporting_User/html/)
246 247 248 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 246 def fulfillment_type @fulfillment_type end |
#gift ⇒ TrueClass | 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.
335 336 337 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 335 def gift @gift end |
#gift_card_currency ⇒ Integer
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.](http://apps.cybersource.com/library/documentation/sbc/quickref/cur
rencies.pdf)
319 320 321 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 319 def gift_card_currency @gift_card_currency end |
#invoice_number ⇒ String
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.
227 228 229 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 227 def invoice_number @invoice_number end |
#measurement ⇒ String
This field would contain measurement of a line item.
306 307 308 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 306 def measurement @measurement end |
#passenger ⇒ Passenger
Contains travel-related passenger details used by DM service only.
339 340 341 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 339 def passenger @passenger end |
#product_code ⇒ String
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].
33 34 35 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 33 def product_code @product_code end |
#product_description ⇒ String
Brief description of item.
310 311 312 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 310 def product_description @product_description end |
#product_name ⇒ String
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.
44 45 46 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 44 def product_name @product_name end |
#product_sku ⇒ String
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.
60 61 62 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 60 def product_sku @product_sku end |
#quantity ⇒ Integer
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.
72 73 74 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 72 def quantity @quantity end |
#reference_data_code ⇒ String
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 CyberSource does not verify the value or modify it in any way before sending it to the processor.
279 280 281 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 279 def reference_data_code @reference_data_code end |
#reference_data_number ⇒ String
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 CyberSource does not verify the value or modify it in any way before sending it to the processor.
296 297 298 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 296 def reference_data_number @reference_data_number end |
#restricted_export_countries ⇒ Array[String]
Contains travel-related passenger details used by DM service only.
347 348 349 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 347 def restricted_export_countries @restricted_export_countries end |
#shipping_destination_types ⇒ String
Destination to where the item will be shipped. Example: Commercial, Residential, Store
324 325 326 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 324 def shipping_destination_types @shipping_destination_types end |
#tax_amount ⇒ String
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:
- 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
- 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
132 133 134 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 132 def tax_amount @tax_amount end |
#tax_applied_after_discount ⇒ String
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
NoteVisa will inset 0 (zero) if an invalid value is included in this field. This field relates to the value in the lineItems.discountAmount field.
150 151 152 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 150 def tax_applied_after_discount @tax_applied_after_discount end |
#tax_details ⇒ Array[TaxDetail]
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.
235 236 237 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 235 def tax_details @tax_details end |
#tax_rate ⇒ String
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%).
140 141 142 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 140 def tax_rate @tax_rate end |
#tax_status_indicator ⇒ String
Flag to indicate whether tax is exempted or not included.
- 0: tax not included
- 1: tax included
- 2: transaction is not subject to tax
157 158 159 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 157 def tax_status_indicator @tax_status_indicator end |
#tax_type_code ⇒ String
Type of tax being applied to the item.
FDC Nashville Global
alternate_tax_type_appliedalternate_tax_type_identifier
Worldpay VAP
alternate_tax_type_identifier
RBS WorldPay Atlanta
tax_type_applied
TSYS Acquiring Solutions
tax_type_appliedlocal_tax_indicator
Chase Paymentech Solutions
tax_type_applied
Elavon Americas
local_tax_indicator
FDC Compass
tax_type_applied
OmniPay Direct
local_tax_indicator
179 180 181 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 179 def tax_type_code @tax_type_code end |
#total_amount ⇒ String
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
109 110 111 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 109 def total_amount @total_amount end |
#type_of_supply ⇒ String
Flag to indicate whether the purchase is categorized as goods or services. Possible values:
- 00: goods
- 01: services
194 195 196 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 194 def type_of_supply @type_of_supply end |
#unit_of_measure ⇒ String
Unit of measure, or unit of measure code, for the item.
100 101 102 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 100 def unit_of_measure @unit_of_measure end |
#unit_price ⇒ String
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)
96 97 98 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 96 def unit_price @unit_price end |
#unit_tax_amount ⇒ String
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.
302 303 304 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 302 def unit_tax_amount @unit_tax_amount end |
#weight ⇒ String
Weight of the item.
250 251 252 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 250 def weight @weight end |
#weight_identifier ⇒ String
Type of weight. Possible values:
- B: Billed weight
- N: Actual net weight
257 258 259 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 257 def weight_identifier @weight_identifier end |
#weight_unit ⇒ String
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).
263 264 265 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 263 def weight_unit @weight_unit end |
Class Method Details
.from_element(root) ⇒ Object
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 679 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 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 615 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, 'TaxDetail', TaxDetail) fulfillment_type = XmlUtilities.from_element(root, 'fulfillmentType', String) weight = XmlUtilities.from_element(root, 'weight', String) weight_identifier = XmlUtilities.from_element(root, 'weightIdentifier', String) weight_unit = XmlUtilities.from_element(root, 'weightUnit', String) reference_data_code = XmlUtilities.from_element(root, 'referenceDataCode', String) reference_data_number = XmlUtilities.from_element(root, 'referenceDataNumber', String) unit_tax_amount = XmlUtilities.from_element(root, 'unitTaxAmount', String) measurement = XmlUtilities.from_element(root, 'measurement', String) product_description = XmlUtilities.from_element(root, 'productDescription', String) gift_card_currency = XmlUtilities.from_element(root, 'giftCardCurrency', Integer) shipping_destination_types = XmlUtilities.from_element( root, 'shippingDestinationTypes', String ) gift = XmlUtilities.from_element(root, 'gift', TrueClass) passenger = XmlUtilities.from_element(root, 'Passenger', Passenger) allowed_export_countries = XmlUtilities.from_element_to_array( root, 'allowedExportCountries', String ) restricted_export_countries = XmlUtilities.from_element_to_array( root, 'restrictedExportCountries', String ) 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 |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 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 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 504 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 << (TaxDetail.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 = Passenger.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. LineItem.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 |
.names ⇒ Object
A mapping from model property names to API property names.
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 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 350 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 |
.nullables ⇒ Object
An array for nullable fields
432 433 434 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 432 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
391 392 393 394 395 396 397 398 399 400 401 402 403 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 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 391 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
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 797 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_s ⇒ Object
Provides a human-readable string representation of the object.
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 774 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 |
#to_xml_element(doc, root_name) ⇒ Object
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 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 |
# File 'lib/cyber_source_merged_spec/models/line_item.rb', line 712 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, 'TaxDetail', tax_details) XmlUtilities.add_as_subelement(doc, root, 'fulfillmentType', fulfillment_type) XmlUtilities.add_as_subelement(doc, root, 'weight', weight) XmlUtilities.add_as_subelement(doc, root, 'weightIdentifier', weight_identifier) XmlUtilities.add_as_subelement(doc, root, 'weightUnit', weight_unit) XmlUtilities.add_as_subelement(doc, root, 'referenceDataCode', reference_data_code) XmlUtilities.add_as_subelement(doc, root, 'referenceDataNumber', reference_data_number) XmlUtilities.add_as_subelement(doc, root, 'unitTaxAmount', unit_tax_amount) XmlUtilities.add_as_subelement(doc, root, 'measurement', measurement) XmlUtilities.add_as_subelement(doc, root, 'productDescription', product_description) XmlUtilities.add_as_subelement(doc, root, 'giftCardCurrency', gift_card_currency) XmlUtilities.add_as_subelement(doc, root, 'shippingDestinationTypes', shipping_destination_types) XmlUtilities.add_as_subelement(doc, root, 'gift', gift) XmlUtilities.add_as_subelement(doc, root, 'Passenger', passenger) XmlUtilities.add_array_as_subelement(doc, root, 'allowedExportCountries', allowed_export_countries) XmlUtilities.add_array_as_subelement(doc, root, 'restrictedExportCountries', restricted_export_countries) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |