Class: VisaAcceptanceMergedSpec::LineItem9

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/line_item9.rb

Overview

LineItem9 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(product_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_descriptionString

Brief description of item.

Returns:

  • (String)


25
26
27
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 25

def product_description
  @product_description
end

#product_nameString

For an authorization or capture transaction (processingOptions.capture is true or false), this field is required when orderInformation.lineItems[].productCode is not default or one of the other values that are related to shipping and/or handling.

Tax Calculation

Optional field for U.S., Canadian, international tax, and value added taxes.

Returns:

  • (String)


21
22
23
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 21

def product_name
  @product_name
end

#product_skuString

Product identifier code. Also known as the Stock Keeping Unit (SKU) code for the product. For an authorization or capture transaction (processingOptions.capture is set to true or false), this field is required when orderInformation.lineItems[].productCode is not set to default or one of the other values that are related to shipping and/or handling.

Tax Calculation

Optional field for U.S. and Canadian taxes. Not applicable to international and value added taxes. For an authorization or capture transaction (processingOptions.capture is set to true or false), this field is required when orderInformation.lineItems[].productCode is not default or one of the values related to shipping and/or handling.

Returns:

  • (String)


41
42
43
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 41

def product_sku
  @product_sku
end

#quantityInteger

Number of units for this order. Must be a non-negative integer. The default is 1. For an authorization or capture transaction (processingOptions.capture is set to true or false), this field is required when orderInformation.lineItems[].productCode is not default or one of the other values related to shipping and/or handling.

Tax Calculation

Optional field for U.S., Canadian, international tax, and value added taxes.

Returns:

  • (Integer)


53
54
55
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 53

def quantity
  @quantity
end

#tax_amountString

Total tax to apply to the product. This value cannot be negative. The tax amount and the offer amount must be in the same currency. The tax amount field is additive. The following example uses a two-exponent currency such as USD:

  1. You include each line item in your request. ..- 1st line item has amount=10.00, quantity=1, and taxAmount=0.80 ..- 2nd line item has amount=20.00, quantity=1, and taxAmount=1.60
  2. The total amount authorized will be 32.40, not 30.00 with 2.40 of tax included. Optional field.

Airlines processing

Tax portion of the order amount. This value cannot exceed 99999999999999 (fourteen 9s). Format: English characters only. Optional request field for a line item.

Tax Calculation

Optional field for U.S., Canadian, international tax, and value added taxes. Note if you send this field in your tax request, the value in the field will override the tax engine

Returns:

  • (String)


116
117
118
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 116

def tax_amount
  @tax_amount
end

#total_amountString

Total amount for the item. Normally calculated as the unit price times quantity. When orderInformation.lineItems[].productCode is "gift_card", this is the purchase amount total for prepaid gift cards in major units. Example: 123.45 USD = 123

Returns:

  • (String)


93
94
95
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 93

def total_amount
  @total_amount
end

#type_of_supplyString

Flag to indicate whether the purchase is categorized as goods or services. Possible values:

  • 00: goods
  • 01: services

Returns:

  • (String)


60
61
62
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 60

def type_of_supply
  @type_of_supply
end

#unit_priceString

Per-item price of the product. This value for this field cannot be negative. You must include either this field or the request-level field orderInformation.amountDetails.totalAmount in your request. You can include a decimal point (.), but you cannot include any other special characters. The value is truncated to the correct number of decimal places.

DCC with a Third-Party Provider

Set this field to the converted amount that was returned by the DCC provider. You must include either the 1st line item in the order and this field, or the request-level field orderInformation.amountDetails.totalAmount in your request.

Tax Calculation

Required field for U.S., Canadian, international and value added taxes.

Zero Amount Authorizations

If your processor supports zero amount authorizations, you can set this field to 0 for the authorization to check if the card is lost or stolen.

Maximum Field Lengths

For GPN and JCN Gateway: Decimal (10) All other processors: Decimal (15)

Returns:

  • (String)


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

.namesObject

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

.nullablesObject

An array for nullable fields



147
148
149
# File 'lib/visa_acceptance_merged_spec/models/line_item9.rb', line 147

def self.nullables
  []
end

.optionalsObject

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

#inspectObject

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_sObject

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