Class: VisaAcceptanceMergedSpec::LineItem9
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::LineItem9
- Defined in:
- lib/visa_acceptance_merged_spec/models/line_item9.rb
Overview
LineItem9 Model.
Instance Attribute Summary collapse
-
#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.
-
#tax_amount ⇒ String
Total tax to apply to the product.
-
#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_price ⇒ String
Per-item price of the product.
Class Method Summary collapse
-
.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_name: SKIP, product_description: SKIP, product_sku: SKIP, quantity: 1, type_of_supply: SKIP, unit_price: SKIP, total_amount: SKIP, tax_amount: SKIP, additional_properties: nil) ⇒ LineItem9
constructor
A new instance of LineItem9.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the 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_name: SKIP, product_description: SKIP, product_sku: SKIP, quantity: 1, type_of_supply: SKIP, unit_price: SKIP, total_amount: SKIP, tax_amount: SKIP, additional_properties: nil) ⇒ LineItem9
Returns a new instance of LineItem9.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 151 def initialize(product_name: SKIP, product_description: SKIP, product_sku: SKIP, quantity: 1, type_of_supply: SKIP, unit_price: SKIP, total_amount: SKIP, tax_amount: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @product_name = product_name unless product_name == SKIP @product_description = product_description unless product_description == SKIP @product_sku = product_sku unless product_sku == SKIP @quantity = quantity unless quantity == SKIP @type_of_supply = type_of_supply unless type_of_supply == SKIP @unit_price = unit_price unless unit_price == SKIP @total_amount = total_amount unless total_amount == SKIP @tax_amount = tax_amount unless tax_amount == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#product_description ⇒ String
Brief description of item.
25 26 27 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 25 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.
21 22 23 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 21 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.
41 42 43 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 41 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.
53 54 55 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 53 def quantity @quantity 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
116 117 118 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 116 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
93 94 95 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 93 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
60 61 62 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 60 def type_of_supply @type_of_supply 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)
84 85 86 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 84 def unit_price @unit_price end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 170 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_name = hash.key?('productName') ? hash['productName'] : SKIP product_description = hash.key?('productDescription') ? hash['productDescription'] : SKIP product_sku = hash.key?('productSku') ? hash['productSku'] : SKIP quantity = hash['quantity'] ||= 1 type_of_supply = hash.key?('typeOfSupply') ? hash['typeOfSupply'] : SKIP unit_price = hash.key?('unitPrice') ? hash['unitPrice'] : SKIP total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : SKIP tax_amount = hash.key?('taxAmount') ? hash['taxAmount'] : 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. LineItem9.new(product_name: product_name, product_description: product_description, product_sku: product_sku, quantity: quantity, type_of_supply: type_of_supply, unit_price: unit_price, total_amount: total_amount, tax_amount: tax_amount, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 119 def self.names @_hash = {} if @_hash.nil? @_hash['product_name'] = 'productName' @_hash['product_description'] = 'productDescription' @_hash['product_sku'] = 'productSku' @_hash['quantity'] = 'quantity' @_hash['type_of_supply'] = 'typeOfSupply' @_hash['unit_price'] = 'unitPrice' @_hash['total_amount'] = 'totalAmount' @_hash['tax_amount'] = 'taxAmount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
147 148 149 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 147 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 133 def self.optionals %w[ product_name product_description product_sku quantity type_of_supply unit_price total_amount tax_amount ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
214 215 216 217 218 219 220 221 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 214 def inspect class_name = self.class.name.split('::').last "<#{class_name} product_name: #{@product_name.inspect}, product_description:"\ " #{@product_description.inspect}, product_sku: #{@product_sku.inspect}, quantity:"\ " #{@quantity.inspect}, type_of_supply: #{@type_of_supply.inspect}, unit_price:"\ " #{@unit_price.inspect}, total_amount: #{@total_amount.inspect}, tax_amount:"\ " #{@tax_amount.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
204 205 206 207 208 209 210 211 |
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 204 def to_s class_name = self.class.name.split('::').last "<#{class_name} product_name: #{@product_name}, product_description:"\ " #{@product_description}, product_sku: #{@product_sku}, quantity: #{@quantity},"\ " type_of_supply: #{@type_of_supply}, unit_price: #{@unit_price}, total_amount:"\ " #{@total_amount}, tax_amount: #{@tax_amount}, additional_properties:"\ " #{@additional_properties}>" end |