Class: VisaAcceptanceMergedSpec::LineItem7
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- VisaAcceptanceMergedSpec::LineItem7
- Defined in:
- lib/visa_acceptance_merged_spec/models/line_item7.rb
Overview
List of the line items from the order, which are included in an invoice.
Instance Attribute Summary collapse
-
#discount_amount ⇒ String
Discount applied to the item.
-
#discount_rate ⇒ String
Rate the item is discounted.
-
#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.
-
#tax_amount ⇒ String
Total tax to apply to the product.
-
#tax_rate ⇒ String
Tax rate applied to the item.
-
#total_amount ⇒ String
Total amount for the item.
-
#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_sku: SKIP, product_name: SKIP, quantity: 1, unit_price: SKIP, discount_amount: SKIP, discount_rate: SKIP, tax_amount: SKIP, tax_rate: SKIP, total_amount: SKIP, product_code: SKIP, product_description: SKIP, additional_properties: nil) ⇒ LineItem7
constructor
A new instance of LineItem7.
-
#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_sku: SKIP, product_name: SKIP, quantity: 1, unit_price: SKIP, discount_amount: SKIP, discount_rate: SKIP, tax_amount: SKIP, tax_rate: SKIP, total_amount: SKIP, product_code: SKIP, product_description: SKIP, additional_properties: nil) ⇒ LineItem7
Returns a new instance of LineItem7.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 191 def initialize(product_sku: SKIP, product_name: SKIP, quantity: 1, unit_price: SKIP, discount_amount: SKIP, discount_rate: SKIP, tax_amount: SKIP, tax_rate: SKIP, total_amount: SKIP, product_code: SKIP, product_description: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @product_sku = product_sku unless product_sku == SKIP @product_name = product_name unless product_name == SKIP @quantity = quantity unless quantity == SKIP @unit_price = unit_price unless unit_price == SKIP @discount_amount = discount_amount unless discount_amount == SKIP @discount_rate = discount_rate unless discount_rate == SKIP @tax_amount = tax_amount unless tax_amount == SKIP @tax_rate = tax_rate unless tax_rate == SKIP @total_amount = total_amount unless total_amount == SKIP @product_code = product_code unless product_code == SKIP @product_description = product_description unless product_description == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#discount_amount ⇒ String
Discount applied to the item.
77 78 79 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 77 def discount_amount @discount_amount end |
#discount_rate ⇒ String
Rate the item is discounted. Maximum of 2 decimal places. Example 5.25 (=5.25%)
82 83 84 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 82 def discount_rate @discount_rate 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 Visa Acceptance Tax Codes guide. Contact Customer Support to request the guide. If you don’t send a tax service Product Code in your tax request, product-based rules or exemptions will not be applied and the transaction will default to fully taxable in the locations where you’ve indicated you need to collect tax [by way of nexus, no nexus, or seller registration number fields].
146 147 148 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 146 def product_code @product_code end |
#product_description ⇒ String
Brief description of item.
150 151 152 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 150 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.
37 38 39 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 37 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.
26 27 28 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 26 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.
49 50 51 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 49 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
105 106 107 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 105 def tax_amount @tax_amount 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%).
113 114 115 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 113 def tax_rate @tax_rate 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
122 123 124 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 122 def total_amount @total_amount 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)
73 74 75 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 73 def unit_price @unit_price end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 214 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. product_sku = hash.key?('productSku') ? hash['productSku'] : SKIP product_name = hash.key?('productName') ? hash['productName'] : SKIP quantity = hash['quantity'] ||= 1 unit_price = hash.key?('unitPrice') ? hash['unitPrice'] : SKIP discount_amount = hash.key?('discountAmount') ? hash['discountAmount'] : SKIP discount_rate = hash.key?('discountRate') ? hash['discountRate'] : SKIP tax_amount = hash.key?('taxAmount') ? hash['taxAmount'] : SKIP tax_rate = hash.key?('taxRate') ? hash['taxRate'] : SKIP total_amount = hash.key?('totalAmount') ? hash['totalAmount'] : SKIP product_code = hash.key?('productCode') ? hash['productCode'] : SKIP product_description = hash.key?('productDescription') ? hash['productDescription'] : 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. LineItem7.new(product_sku: product_sku, product_name: product_name, quantity: quantity, unit_price: unit_price, discount_amount: discount_amount, discount_rate: discount_rate, tax_amount: tax_amount, tax_rate: tax_rate, total_amount: total_amount, product_code: product_code, product_description: product_description, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 153 def self.names @_hash = {} if @_hash.nil? @_hash['product_sku'] = 'productSku' @_hash['product_name'] = 'productName' @_hash['quantity'] = 'quantity' @_hash['unit_price'] = 'unitPrice' @_hash['discount_amount'] = 'discountAmount' @_hash['discount_rate'] = 'discountRate' @_hash['tax_amount'] = 'taxAmount' @_hash['tax_rate'] = 'taxRate' @_hash['total_amount'] = 'totalAmount' @_hash['product_code'] = 'productCode' @_hash['product_description'] = 'productDescription' @_hash end |
.nullables ⇒ Object
An array for nullable fields
187 188 189 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 187 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 170 def self.optionals %w[ product_sku product_name quantity unit_price discount_amount discount_rate tax_amount tax_rate total_amount product_code product_description ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
265 266 267 268 269 270 271 272 273 274 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 265 def inspect class_name = self.class.name.split('::').last "<#{class_name} product_sku: #{@product_sku.inspect}, product_name:"\ " #{@product_name.inspect}, quantity: #{@quantity.inspect}, unit_price:"\ " #{@unit_price.inspect}, discount_amount: #{@discount_amount.inspect}, discount_rate:"\ " #{@discount_rate.inspect}, tax_amount: #{@tax_amount.inspect}, tax_rate:"\ " #{@tax_rate.inspect}, total_amount: #{@total_amount.inspect}, product_code:"\ " #{@product_code.inspect}, product_description: #{@product_description.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
255 256 257 258 259 260 261 262 |
# File 'lib/visa_acceptance_merged_spec/models/line_item7.rb', line 255 def to_s class_name = self.class.name.split('::').last "<#{class_name} product_sku: #{@product_sku}, product_name: #{@product_name}, quantity:"\ " #{@quantity}, unit_price: #{@unit_price}, discount_amount: #{@discount_amount},"\ " discount_rate: #{@discount_rate}, tax_amount: #{@tax_amount}, tax_rate: #{@tax_rate},"\ " total_amount: #{@total_amount}, product_code: #{@product_code}, product_description:"\ " #{@product_description}, additional_properties: #{@additional_properties}>" end |