Class: CyberSourceMergedSpec::LineItem11
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::LineItem11
- Defined in:
- lib/cyber_source_merged_spec/models/line_item11.rb
Overview
LineItem11 Model.
Instance Attribute Summary collapse
-
#allowed_export_countries ⇒ Array[String]
Total tax to apply to the product.
-
#distributor_product_sku ⇒ String
Product’s identifier code.
-
#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. -
#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_risk ⇒ String
Indicates the level of risk for the product.
-
#product_sku ⇒ String
Product identifier code.
-
#quantity ⇒ Integer
Number of units for this order.
-
#restricted_export_countries ⇒ Array[String]
Total tax to apply to the product.
-
#shipping_destination_types ⇒ String
Destination to where the item will be shipped.
-
#tax_amount ⇒ String
Total tax to apply to the product.
-
#total_amount ⇒ String
Total amount for the item.
-
#unit_price ⇒ String
Per-item price of the product.
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(total_amount: SKIP, unit_price: SKIP, quantity: 1, gift_card_currency: SKIP, product_sku: SKIP, product_risk: SKIP, product_description: SKIP, product_name: SKIP, product_code: SKIP, gift: SKIP, distributor_product_sku: SKIP, passenger: SKIP, shipping_destination_types: SKIP, tax_amount: SKIP, allowed_export_countries: SKIP, restricted_export_countries: SKIP, additional_properties: nil) ⇒ LineItem11
constructor
A new instance of LineItem11.
-
#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(total_amount: SKIP, unit_price: SKIP, quantity: 1, gift_card_currency: SKIP, product_sku: SKIP, product_risk: SKIP, product_description: SKIP, product_name: SKIP, product_code: SKIP, gift: SKIP, distributor_product_sku: SKIP, passenger: SKIP, shipping_destination_types: SKIP, tax_amount: SKIP, allowed_export_countries: SKIP, restricted_export_countries: SKIP, additional_properties: nil) ⇒ LineItem11
Returns a new instance of LineItem11.
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 255 def initialize(total_amount: SKIP, unit_price: SKIP, quantity: 1, gift_card_currency: SKIP, product_sku: SKIP, product_risk: SKIP, product_description: SKIP, product_name: SKIP, product_code: SKIP, gift: SKIP, distributor_product_sku: SKIP, passenger: SKIP, shipping_destination_types: SKIP, tax_amount: 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? @total_amount = total_amount unless total_amount == SKIP @unit_price = unit_price unless unit_price == SKIP @quantity = quantity unless quantity == SKIP @gift_card_currency = gift_card_currency unless gift_card_currency == SKIP @product_sku = product_sku unless product_sku == SKIP @product_risk = product_risk unless product_risk == SKIP @product_description = product_description unless product_description == SKIP @product_name = product_name unless product_name == SKIP @product_code = product_code unless product_code == SKIP @gift = gift unless gift == SKIP @distributor_product_sku = distributor_product_sku unless distributor_product_sku == SKIP @passenger = passenger unless passenger == SKIP unless shipping_destination_types == SKIP @shipping_destination_types = shipping_destination_types end @tax_amount = tax_amount unless tax_amount == 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]
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
181 182 183 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 181 def allowed_export_countries @allowed_export_countries end |
#distributor_product_sku ⇒ String
Product’s identifier code. This field is inserted into the outgoing message without being parsed or formatted. This field is included as Distributor product SKU (Offer) in the list of API fields with which you can create custom rules.
126 127 128 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 126 def distributor_product_sku @distributor_product_sku 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.
118 119 120 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 118 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)
45 46 47 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 45 def gift_card_currency @gift_card_currency end |
#passenger ⇒ Passenger
Contains travel-related passenger details used by DM service only.
130 131 132 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 130 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].
107 108 109 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 107 def product_code @product_code end |
#product_description ⇒ String
Brief description of item.
73 74 75 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 73 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.
84 85 86 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 84 def product_name @product_name end |
#product_risk ⇒ String
Indicates the level of risk for the product. This field can contain one of the following values:
low: The product is associated with few chargebacks.normal: The product is associated with a normal number of chargebacks.high: The product is associated with many chargebacks.
69 70 71 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 69 def product_risk @product_risk 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.
61 62 63 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 61 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.
36 37 38 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 36 def quantity @quantity end |
#restricted_export_countries ⇒ Array[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
204 205 206 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 204 def restricted_export_countries @restricted_export_countries end |
#shipping_destination_types ⇒ String
Destination to where the item will be shipped. Example: Commercial, Residential, Store
135 136 137 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 135 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
158 159 160 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 158 def tax_amount @tax_amount 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
19 20 21 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 19 def total_amount @total_amount end |
#unit_price ⇒ String
Per-item price of the product. If line items are present in the request, the unit price is a mandatory field.
24 25 26 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 24 def unit_price @unit_price end |
Class Method Details
.from_element(root) ⇒ Object
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 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 347 def self.from_element(root) total_amount = XmlUtilities.from_element(root, 'totalAmount', String) unit_price = XmlUtilities.from_element(root, 'unitPrice', String) quantity = XmlUtilities.from_element(root, 'quantity', Integer) gift_card_currency = XmlUtilities.from_element(root, 'giftCardCurrency', Integer) product_sku = XmlUtilities.from_element(root, 'productSKU', String) product_risk = XmlUtilities.from_element(root, 'productRisk', String) product_description = XmlUtilities.from_element(root, 'productDescription', String) product_name = XmlUtilities.from_element(root, 'productName', String) product_code = XmlUtilities.from_element(root, 'productCode', String) gift = XmlUtilities.from_element(root, 'gift', TrueClass) distributor_product_sku = XmlUtilities.from_element( root, 'distributorProductSku', String ) passenger = XmlUtilities.from_element(root, 'Passenger', Passenger) shipping_destination_types = XmlUtilities.from_element( root, 'shippingDestinationTypes', String ) tax_amount = XmlUtilities.from_element(root, 'taxAmount', String) allowed_export_countries = XmlUtilities.from_element_to_array( root, 'allowedExportCountries', String ) restricted_export_countries = XmlUtilities.from_element_to_array( root, 'restrictedExportCountries', String ) new(total_amount: total_amount, unit_price: unit_price, quantity: quantity, gift_card_currency: gift_card_currency, product_sku: product_sku, product_risk: product_risk, product_description: product_description, product_name: product_name, product_code: product_code, gift: gift, distributor_product_sku: distributor_product_sku, passenger: passenger, shipping_destination_types: shipping_destination_types, tax_amount: tax_amount, 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.
293 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 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 293 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : SKIP unit_price = hash.key?('unitPrice') ? hash['unitPrice'] : SKIP quantity = hash['quantity'] ||= 1 gift_card_currency = hash.key?('giftCardCurrency') ? hash['giftCardCurrency'] : SKIP product_sku = hash.key?('productSKU') ? hash['productSKU'] : SKIP product_risk = hash.key?('productRisk') ? hash['productRisk'] : SKIP product_description = hash.key?('productDescription') ? hash['productDescription'] : SKIP product_name = hash.key?('productName') ? hash['productName'] : SKIP product_code = hash.key?('productCode') ? hash['productCode'] : SKIP gift = hash.key?('gift') ? hash['gift'] : SKIP distributor_product_sku = hash.key?('distributorProductSku') ? hash['distributorProductSku'] : SKIP passenger = Passenger.from_hash(hash['passenger']) if hash['passenger'] shipping_destination_types = hash.key?('shippingDestinationTypes') ? hash['shippingDestinationTypes'] : SKIP tax_amount = hash.key?('taxAmount') ? hash['taxAmount'] : SKIP 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. LineItem11.new(total_amount: total_amount, unit_price: unit_price, quantity: quantity, gift_card_currency: gift_card_currency, product_sku: product_sku, product_risk: product_risk, product_description: product_description, product_name: product_name, product_code: product_code, gift: gift, distributor_product_sku: distributor_product_sku, passenger: passenger, shipping_destination_types: shipping_destination_types, tax_amount: tax_amount, 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.
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 207 def self.names @_hash = {} if @_hash.nil? @_hash['total_amount'] = 'totalAmount' @_hash['unit_price'] = 'unitPrice' @_hash['quantity'] = 'quantity' @_hash['gift_card_currency'] = 'giftCardCurrency' @_hash['product_sku'] = 'productSKU' @_hash['product_risk'] = 'productRisk' @_hash['product_description'] = 'productDescription' @_hash['product_name'] = 'productName' @_hash['product_code'] = 'productCode' @_hash['gift'] = 'gift' @_hash['distributor_product_sku'] = 'distributorProductSku' @_hash['passenger'] = 'passenger' @_hash['shipping_destination_types'] = 'shippingDestinationTypes' @_hash['tax_amount'] = 'taxAmount' @_hash['allowed_export_countries'] = 'allowedExportCountries' @_hash['restricted_export_countries'] = 'restrictedExportCountries' @_hash end |
.nullables ⇒ Object
An array for nullable fields
251 252 253 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 251 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 229 def self.optionals %w[ total_amount unit_price quantity gift_card_currency product_sku product_risk product_description product_name product_code gift distributor_product_sku passenger shipping_destination_types tax_amount allowed_export_countries restricted_export_countries ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 441 def inspect class_name = self.class.name.split('::').last "<#{class_name} total_amount: #{@total_amount.inspect}, unit_price: #{@unit_price.inspect},"\ " quantity: #{@quantity.inspect}, gift_card_currency: #{@gift_card_currency.inspect},"\ " product_sku: #{@product_sku.inspect}, product_risk: #{@product_risk.inspect},"\ " product_description: #{@product_description.inspect}, product_name:"\ " #{@product_name.inspect}, product_code: #{@product_code.inspect}, gift: #{@gift.inspect},"\ " distributor_product_sku: #{@distributor_product_sku.inspect}, passenger:"\ " #{@passenger.inspect}, shipping_destination_types: #{@shipping_destination_types.inspect},"\ " tax_amount: #{@tax_amount.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.
428 429 430 431 432 433 434 435 436 437 438 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 428 def to_s class_name = self.class.name.split('::').last "<#{class_name} total_amount: #{@total_amount}, unit_price: #{@unit_price}, quantity:"\ " #{@quantity}, gift_card_currency: #{@gift_card_currency}, product_sku: #{@product_sku},"\ " product_risk: #{@product_risk}, product_description: #{@product_description},"\ " product_name: #{@product_name}, product_code: #{@product_code}, gift: #{@gift},"\ " distributor_product_sku: #{@distributor_product_sku}, passenger: #{@passenger},"\ " shipping_destination_types: #{@shipping_destination_types}, tax_amount: #{@tax_amount},"\ " allowed_export_countries: #{@allowed_export_countries}, restricted_export_countries:"\ " #{@restricted_export_countries}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
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 |
# File 'lib/cyber_source_merged_spec/models/line_item11.rb', line 395 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'totalAmount', total_amount) XmlUtilities.add_as_subelement(doc, root, 'unitPrice', unit_price) XmlUtilities.add_as_subelement(doc, root, 'quantity', quantity) XmlUtilities.add_as_subelement(doc, root, 'giftCardCurrency', gift_card_currency) XmlUtilities.add_as_subelement(doc, root, 'productSKU', product_sku) XmlUtilities.add_as_subelement(doc, root, 'productRisk', product_risk) XmlUtilities.add_as_subelement(doc, root, 'productDescription', product_description) XmlUtilities.add_as_subelement(doc, root, 'productName', product_name) XmlUtilities.add_as_subelement(doc, root, 'productCode', product_code) XmlUtilities.add_as_subelement(doc, root, 'gift', gift) XmlUtilities.add_as_subelement(doc, root, 'distributorProductSku', distributor_product_sku) XmlUtilities.add_as_subelement(doc, root, 'Passenger', passenger) XmlUtilities.add_as_subelement(doc, root, 'shippingDestinationTypes', shipping_destination_types) XmlUtilities.add_as_subelement(doc, root, 'taxAmount', tax_amount) 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 |