Class: VisaAcceptanceMergedSpec::InvoiceDetails

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

Overview

InvoiceDetails 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(invoice_number: SKIP, barcode_number: SKIP, expiration_date: SKIP, purchase_order_number: SKIP, purchase_order_date: SKIP, purchase_contact_name: SKIP, taxable: SKIP, vat_invoice_reference_number: SKIP, commodity_code: SKIP, merchandise_code: SKIP, transaction_advice_addendum: SKIP, reference_data_code: SKIP, reference_data_number: SKIP, sales_slip_number: SKIP, invoice_date: SKIP, cost_center: SKIP, issuer_message: SKIP, product_description: SKIP, additional_properties: nil) ⇒ InvoiceDetails

Returns a new instance of InvoiceDetails.



203
204
205
206
207
208
209
210
211
212
213
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
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 203

def initialize(invoice_number: SKIP, barcode_number: SKIP,
               expiration_date: SKIP, purchase_order_number: SKIP,
               purchase_order_date: SKIP, purchase_contact_name: SKIP,
               taxable: SKIP, vat_invoice_reference_number: SKIP,
               commodity_code: SKIP, merchandise_code: SKIP,
               transaction_advice_addendum: SKIP, reference_data_code: SKIP,
               reference_data_number: SKIP, sales_slip_number: SKIP,
               invoice_date: SKIP, cost_center: SKIP, issuer_message: SKIP,
               product_description: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @invoice_number = invoice_number unless invoice_number == SKIP
  @barcode_number = barcode_number unless barcode_number == SKIP
  @expiration_date = expiration_date unless expiration_date == SKIP
  @purchase_order_number = purchase_order_number unless purchase_order_number == SKIP
  @purchase_order_date = purchase_order_date unless purchase_order_date == SKIP
  @purchase_contact_name = purchase_contact_name unless purchase_contact_name == SKIP
  @taxable = taxable unless taxable == SKIP
  unless vat_invoice_reference_number == SKIP
    @vat_invoice_reference_number =
      vat_invoice_reference_number
  end
  @commodity_code = commodity_code unless commodity_code == SKIP
  @merchandise_code = merchandise_code unless merchandise_code == SKIP
  unless transaction_advice_addendum == SKIP
    @transaction_advice_addendum =
      transaction_advice_addendum
  end
  @reference_data_code = reference_data_code unless reference_data_code == SKIP
  @reference_data_number = reference_data_number unless reference_data_number == SKIP
  @sales_slip_number = sales_slip_number unless sales_slip_number == SKIP
  @invoice_date = invoice_date unless invoice_date == SKIP
  @cost_center = cost_center unless cost_center == SKIP
  @issuer_message = issuer_message unless issuer_message == SKIP
  @product_description = product_description unless product_description == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#barcode_numberString

Barcode Number.

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 18

def barcode_number
  @barcode_number
end

#commodity_codeString

International description code of the overall order’s goods or services or the Categorizes purchases for VAT reporting. Contact your acquirer for a list of codes.

Returns:

  • (String)


58
59
60
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 58

def commodity_code
  @commodity_code
end

#cost_centerString

Cost centre of the merchant

Returns:

  • (String)


139
140
141
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 139

def cost_center
  @cost_center
end

#expiration_dateString

Expiration Date.

Returns:

  • (String)


22
23
24
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 22

def expiration_date
  @expiration_date
end

#invoice_dateString

Date of the tax calculation. Use format YYYYMMDD. You can provide a date in the past if you are calculating tax for a refund and want to know what the tax was on the date the order was placed. You can provide a date in the future if you are calculating the tax for a future date, such as an upcoming tax holiday. The default is the date, in Pacific time, that the bank receives the request. Keep this in mind if you are in a different time zone and want the tax calculated with the rates that are applicable on a specific date.

Tax Calculation

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

Returns:

  • (String)


135
136
137
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 135

def invoice_date
  @invoice_date
end

#invoice_numberString

Invoice Number.

Returns:

  • (String)


14
15
16
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 14

def invoice_number
  @invoice_number
end

#issuer_messageString

Text message from the issuer. If you give the customer a receipt, display this value on the receipt.

Returns:

  • (String)


144
145
146
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 144

def issuer_message
  @issuer_message
end

#merchandise_codeInteger

Identifier for the merchandise. This field is supported only on the processors listed in this field description.

American Express Direct

Possible value:

  • 1000: Gift card

Visa Acceptance through VisaNet

This value must be right justified. In Japan, this value is called a goods code.

JCN Gateway

This value must be right justified. In Japan, this value is called a goods code.

Returns:

  • (Integer)


72
73
74
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 72

def merchandise_code
  @merchandise_code
end

#product_descriptionString

Brief description of item.

Returns:

  • (String)


148
149
150
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 148

def product_description
  @product_description
end

#purchase_contact_nameString

The name of the individual or the company contacted for company authorized purchases.

Returns:

  • (String)


37
38
39
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 37

def purchase_contact_name
  @purchase_contact_name
end

#purchase_order_dateString

Date the order was processed. Format: YYYY-MM-DD.

Returns:

  • (String)


32
33
34
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 32

def purchase_order_date
  @purchase_order_date
end

#purchase_order_numberString

Value used by your customer to identify the order. This value is typically a purchase order number. Visa Acceptance recommends that you do not populate the field with all zeros or nines.

Returns:

  • (String)


28
29
30
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 28

def purchase_order_number
  @purchase_order_number
end

#reference_data_codeString

Code that identifies the value of the referenceDataNumber field. This field is a pass-through, which means that Visa Acceptance does not verify the value or modify it in any way before sending it to the processor.

Returns:

  • (String)


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

def reference_data_code
  @reference_data_code
end

#reference_data_numberString

Reference number. The meaning of this value is identified by the value of the referenceDataCode field. This field is a pass-through, which means that Visa Acceptance does not verify the value or modify it in any way before sending it to the processor.

Returns:

  • (String)


101
102
103
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 101

def reference_data_number
  @reference_data_number
end

#sales_slip_numberInteger

Transaction identifier that is generated. You have the option of printing the sales slip number on the receipt. This field is supported only on Visa Acceptance through Visanet and JCN gateway. Optional field.

Card Present processing message

If you included this field in the request, the returned value is the value that you sent in the request. If you did not include this field in the request, the system generated this value for you. The difference between this reply field and the processorInformation.systemTraceAuditNumber field is that the system generates the system trace audit number (STAN), and you must print the receipt number on the receipt; whereas you can generate the sales slip number, and you can choose to print the sales slip number on the receipt.

Returns:

  • (Integer)


120
121
122
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 120

def sales_slip_number
  @sales_slip_number
end

#taxableTrueClass | FalseClass

Flag that indicates whether an order is taxable. This value must be true if the sum of all lineItems.taxAmount values > 0. If you do not include any lineItems[].taxAmount values in your request, Visa Acceptance does not include invoiceDetails.taxable in the data it sends to the processor. Possible values:

  • true
  • false

Returns:

  • (TrueClass | FalseClass)


48
49
50
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 48

def taxable
  @taxable
end

#transaction_advice_addendumArray[TransactionAdviceAddendum]

Identifier for the merchandise. This field is supported only on the processors listed in this field description.

American Express Direct

Possible value:

  • 1000: Gift card

Visa Acceptance through VisaNet

This value must be right justified. In Japan, this value is called a goods code.

JCN Gateway

This value must be right justified. In Japan, this value is called a goods code.

Returns:



86
87
88
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 86

def transaction_advice_addendum
  @transaction_advice_addendum
end

#vat_invoice_reference_numberString

VAT invoice number associated with the transaction.

Returns:

  • (String)


52
53
54
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 52

def vat_invoice_reference_number
  @vat_invoice_reference_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



243
244
245
246
247
248
249
250
251
252
253
254
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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 243

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  invoice_number = hash.key?('invoiceNumber') ? hash['invoiceNumber'] : SKIP
  barcode_number = hash.key?('barcodeNumber') ? hash['barcodeNumber'] : SKIP
  expiration_date =
    hash.key?('expirationDate') ? hash['expirationDate'] : SKIP
  purchase_order_number =
    hash.key?('purchaseOrderNumber') ? hash['purchaseOrderNumber'] : SKIP
  purchase_order_date =
    hash.key?('purchaseOrderDate') ? hash['purchaseOrderDate'] : SKIP
  purchase_contact_name =
    hash.key?('purchaseContactName') ? hash['purchaseContactName'] : SKIP
  taxable = hash.key?('taxable') ? hash['taxable'] : SKIP
  vat_invoice_reference_number =
    hash.key?('vatInvoiceReferenceNumber') ? hash['vatInvoiceReferenceNumber'] : SKIP
  commodity_code = hash.key?('commodityCode') ? hash['commodityCode'] : SKIP
  merchandise_code =
    hash.key?('merchandiseCode') ? hash['merchandiseCode'] : SKIP
  # Parameter is an array, so we need to iterate through it
  transaction_advice_addendum = nil
  unless hash['transactionAdviceAddendum'].nil?
    transaction_advice_addendum = []
    hash['transactionAdviceAddendum'].each do |structure|
      transaction_advice_addendum << (TransactionAdviceAddendum.from_hash(structure) if structure)
    end
  end

  transaction_advice_addendum = SKIP unless hash.key?('transactionAdviceAddendum')
  reference_data_code =
    hash.key?('referenceDataCode') ? hash['referenceDataCode'] : SKIP
  reference_data_number =
    hash.key?('referenceDataNumber') ? hash['referenceDataNumber'] : SKIP
  sales_slip_number =
    hash.key?('salesSlipNumber') ? hash['salesSlipNumber'] : SKIP
  invoice_date = hash.key?('invoiceDate') ? hash['invoiceDate'] : SKIP
  cost_center = hash.key?('costCenter') ? hash['costCenter'] : SKIP
  issuer_message = hash.key?('issuerMessage') ? hash['issuerMessage'] : 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.
  InvoiceDetails.new(invoice_number: invoice_number,
                     barcode_number: barcode_number,
                     expiration_date: expiration_date,
                     purchase_order_number: purchase_order_number,
                     purchase_order_date: purchase_order_date,
                     purchase_contact_name: purchase_contact_name,
                     taxable: taxable,
                     vat_invoice_reference_number: vat_invoice_reference_number,
                     commodity_code: commodity_code,
                     merchandise_code: merchandise_code,
                     transaction_advice_addendum: transaction_advice_addendum,
                     reference_data_code: reference_data_code,
                     reference_data_number: reference_data_number,
                     sales_slip_number: sales_slip_number,
                     invoice_date: invoice_date,
                     cost_center: cost_center,
                     issuer_message: issuer_message,
                     product_description: product_description,
                     additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 151

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['invoice_number'] = 'invoiceNumber'
  @_hash['barcode_number'] = 'barcodeNumber'
  @_hash['expiration_date'] = 'expirationDate'
  @_hash['purchase_order_number'] = 'purchaseOrderNumber'
  @_hash['purchase_order_date'] = 'purchaseOrderDate'
  @_hash['purchase_contact_name'] = 'purchaseContactName'
  @_hash['taxable'] = 'taxable'
  @_hash['vat_invoice_reference_number'] = 'vatInvoiceReferenceNumber'
  @_hash['commodity_code'] = 'commodityCode'
  @_hash['merchandise_code'] = 'merchandiseCode'
  @_hash['transaction_advice_addendum'] = 'transactionAdviceAddendum'
  @_hash['reference_data_code'] = 'referenceDataCode'
  @_hash['reference_data_number'] = 'referenceDataNumber'
  @_hash['sales_slip_number'] = 'salesSlipNumber'
  @_hash['invoice_date'] = 'invoiceDate'
  @_hash['cost_center'] = 'costCenter'
  @_hash['issuer_message'] = 'issuerMessage'
  @_hash['product_description'] = 'productDescription'
  @_hash
end

.nullablesObject

An array for nullable fields



199
200
201
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 199

def self.nullables
  []
end

.optionalsObject

An array for optional fields



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 175

def self.optionals
  %w[
    invoice_number
    barcode_number
    expiration_date
    purchase_order_number
    purchase_order_date
    purchase_contact_name
    taxable
    vat_invoice_reference_number
    commodity_code
    merchandise_code
    transaction_advice_addendum
    reference_data_code
    reference_data_number
    sales_slip_number
    invoice_date
    cost_center
    issuer_message
    product_description
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 331

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} invoice_number: #{@invoice_number.inspect}, barcode_number:"\
  " #{@barcode_number.inspect}, expiration_date: #{@expiration_date.inspect},"\
  " purchase_order_number: #{@purchase_order_number.inspect}, purchase_order_date:"\
  " #{@purchase_order_date.inspect}, purchase_contact_name: #{@purchase_contact_name.inspect},"\
  " taxable: #{@taxable.inspect}, vat_invoice_reference_number:"\
  " #{@vat_invoice_reference_number.inspect}, commodity_code: #{@commodity_code.inspect},"\
  " merchandise_code: #{@merchandise_code.inspect}, transaction_advice_addendum:"\
  " #{@transaction_advice_addendum.inspect}, reference_data_code:"\
  " #{@reference_data_code.inspect}, reference_data_number: #{@reference_data_number.inspect},"\
  " sales_slip_number: #{@sales_slip_number.inspect}, invoice_date: #{@invoice_date.inspect},"\
  " cost_center: #{@cost_center.inspect}, issuer_message: #{@issuer_message.inspect},"\
  " product_description: #{@product_description.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



315
316
317
318
319
320
321
322
323
324
325
326
327
328
# File 'lib/visa_acceptance_merged_spec/models/invoice_details.rb', line 315

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} invoice_number: #{@invoice_number}, barcode_number: #{@barcode_number},"\
  " expiration_date: #{@expiration_date}, purchase_order_number: #{@purchase_order_number},"\
  " purchase_order_date: #{@purchase_order_date}, purchase_contact_name:"\
  " #{@purchase_contact_name}, taxable: #{@taxable}, vat_invoice_reference_number:"\
  " #{@vat_invoice_reference_number}, commodity_code: #{@commodity_code}, merchandise_code:"\
  " #{@merchandise_code}, transaction_advice_addendum: #{@transaction_advice_addendum},"\
  " reference_data_code: #{@reference_data_code}, reference_data_number:"\
  " #{@reference_data_number}, sales_slip_number: #{@sales_slip_number}, invoice_date:"\
  " #{@invoice_date}, cost_center: #{@cost_center}, issuer_message: #{@issuer_message},"\
  " product_description: #{@product_description}, additional_properties:"\
  " #{@additional_properties}>"
end