Class: VisaAcceptanceMergedSpec::OrderInformation

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

Overview

OrderInformation 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(amount_details: SKIP, bill_to: SKIP, ship_to: SKIP, line_items: SKIP, invoice_details: SKIP, shipping_details: SKIP, returns_accepted: SKIP, is_cryptocurrency_purchase: SKIP, cutoff_date_time: SKIP, pre_order: SKIP, pre_order_date: SKIP, reordered: SKIP, total_offers_count: SKIP, additional_properties: nil) ⇒ OrderInformation

Returns a new instance of OrderInformation.



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 137

def initialize(amount_details: SKIP, bill_to: SKIP, ship_to: SKIP,
               line_items: SKIP, invoice_details: SKIP,
               shipping_details: SKIP, returns_accepted: SKIP,
               is_cryptocurrency_purchase: SKIP, cutoff_date_time: SKIP,
               pre_order: SKIP, pre_order_date: SKIP, reordered: SKIP,
               total_offers_count: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @amount_details = amount_details unless amount_details == SKIP
  @bill_to = bill_to unless bill_to == SKIP
  @ship_to = ship_to unless ship_to == SKIP
  @line_items = line_items unless line_items == SKIP
  @invoice_details = invoice_details unless invoice_details == SKIP
  @shipping_details = shipping_details unless shipping_details == SKIP
  @returns_accepted = returns_accepted unless returns_accepted == SKIP
  unless is_cryptocurrency_purchase == SKIP
    @is_cryptocurrency_purchase =
      is_cryptocurrency_purchase
  end
  @cutoff_date_time = cutoff_date_time unless cutoff_date_time == SKIP
  @pre_order = pre_order unless pre_order == SKIP
  @pre_order_date = pre_order_date unless pre_order_date == SKIP
  @reordered = reordered unless reordered == SKIP
  @total_offers_count = total_offers_count unless total_offers_count == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#amount_detailsAmountDetails

TODO: Write general description for this method

Returns:



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

def amount_details
  @amount_details
end

#bill_toBillTo

TODO: Write general description for this method

Returns:



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

def bill_to
  @bill_to
end

#cutoff_date_timeString

Starting date and time for an event or a journey that is independent of which transportation mechanism, in UTC. The cutoffDateTime will supersede travelInformation.transit.airline.legs.departureDate and travelInformation.transit.airline.legs.departureTime if these fields are supplied in the request. Format: YYYY-MM-DDThh:mm:ssZ. Example 2016-08-11T22:47:57Z equals August 11, 2016, at 22:47:57 (10:47:57 p.m.). The T separates the date and the time. The Z indicates UTC.

Returns:

  • (String)


66
67
68
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 66

def cutoff_date_time
  @cutoff_date_time
end

#invoice_detailsInvoiceDetails

TODO: Write general description for this method

Returns:



30
31
32
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 30

def invoice_details
  @invoice_details
end

#is_cryptocurrency_purchaseString

Visa Platform Connect :

This API will contain the Flag that specifies whether the payment is for the purchase of cryptocurrency. Additional values to add : This API will contain the Flag that specifies whether the payment is for the purchase of cryptocurrency. valid values are

  • Y/y, true
  • N/n, false

Returns:

  • (String)


55
56
57
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 55

def is_cryptocurrency_purchase
  @is_cryptocurrency_purchase
end

#line_itemsArray[LineItem]

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 26

def line_items
  @line_items
end

#pre_orderString

Indicates whether cardholder is placing an order with a future availability or release date. This field can contain one of these values:

  • MERCHANDISE_AVAILABLE: Merchandise available
  • FUTURE_AVAILABILITY: Future availability

Returns:

  • (String)


74
75
76
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 74

def pre_order
  @pre_order
end

#pre_order_dateString

Expected date that a pre-ordered purchase will be available. Format: YYYYMMDD

Returns:

  • (String)


79
80
81
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 79

def pre_order_date
  @pre_order_date
end

#reorderedTrueClass | FalseClass

Indicates whether the cardholder is reordering previously purchased merchandise. This field can contain one of these values:

  • false: First time ordered
  • true: Reordered

Returns:

  • (TrueClass | FalseClass)


87
88
89
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 87

def reordered
  @reordered
end

#returns_acceptedTrueClass | FalseClass

This is only needed when you are requesting both payment and DM service at same time. Boolean that indicates whether returns are accepted for this order. This field can contain one of the following values:

  • true: Returns are accepted for this order.
  • false: Returns are not accepted for this order.

Returns:

  • (TrueClass | FalseClass)


43
44
45
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 43

def returns_accepted
  @returns_accepted
end

#ship_toShipTo

TODO: Write general description for this method

Returns:



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

def ship_to
  @ship_to
end

#shipping_detailsShippingDetails2

TODO: Write general description for this method

Returns:



34
35
36
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 34

def shipping_details
  @shipping_details
end

#total_offers_countString

Total number of articles/items in the order as a numeric decimal count. Possible values: 00 - 99

Returns:

  • (String)


92
93
94
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 92

def total_offers_count
  @total_offers_count
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



166
167
168
169
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 166

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  amount_details = AmountDetails.from_hash(hash['amountDetails']) if hash['amountDetails']
  bill_to = BillTo.from_hash(hash['billTo']) if hash['billTo']
  ship_to = ShipTo.from_hash(hash['shipTo']) if hash['shipTo']
  # Parameter is an array, so we need to iterate through it
  line_items = nil
  unless hash['lineItems'].nil?
    line_items = []
    hash['lineItems'].each do |structure|
      line_items << (LineItem.from_hash(structure) if structure)
    end
  end

  line_items = SKIP unless hash.key?('lineItems')
  invoice_details = InvoiceDetails.from_hash(hash['invoiceDetails']) if hash['invoiceDetails']
  shipping_details = ShippingDetails2.from_hash(hash['shippingDetails']) if
    hash['shippingDetails']
  returns_accepted =
    hash.key?('returnsAccepted') ? hash['returnsAccepted'] : SKIP
  is_cryptocurrency_purchase =
    hash.key?('isCryptocurrencyPurchase') ? hash['isCryptocurrencyPurchase'] : SKIP
  cutoff_date_time =
    hash.key?('cutoffDateTime') ? hash['cutoffDateTime'] : SKIP
  pre_order = hash.key?('preOrder') ? hash['preOrder'] : SKIP
  pre_order_date = hash.key?('preOrderDate') ? hash['preOrderDate'] : SKIP
  reordered = hash.key?('reordered') ? hash['reordered'] : SKIP
  total_offers_count =
    hash.key?('totalOffersCount') ? hash['totalOffersCount'] : 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.
  OrderInformation.new(amount_details: amount_details,
                       bill_to: bill_to,
                       ship_to: ship_to,
                       line_items: line_items,
                       invoice_details: invoice_details,
                       shipping_details: shipping_details,
                       returns_accepted: returns_accepted,
                       is_cryptocurrency_purchase: is_cryptocurrency_purchase,
                       cutoff_date_time: cutoff_date_time,
                       pre_order: pre_order,
                       pre_order_date: pre_order_date,
                       reordered: reordered,
                       total_offers_count: total_offers_count,
                       additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 95

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['amount_details'] = 'amountDetails'
  @_hash['bill_to'] = 'billTo'
  @_hash['ship_to'] = 'shipTo'
  @_hash['line_items'] = 'lineItems'
  @_hash['invoice_details'] = 'invoiceDetails'
  @_hash['shipping_details'] = 'shippingDetails'
  @_hash['returns_accepted'] = 'returnsAccepted'
  @_hash['is_cryptocurrency_purchase'] = 'isCryptocurrencyPurchase'
  @_hash['cutoff_date_time'] = 'cutoffDateTime'
  @_hash['pre_order'] = 'preOrder'
  @_hash['pre_order_date'] = 'preOrderDate'
  @_hash['reordered'] = 'reordered'
  @_hash['total_offers_count'] = 'totalOffersCount'
  @_hash
end

.nullablesObject

An array for nullable fields



133
134
135
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 133

def self.nullables
  []
end

.optionalsObject

An array for optional fields



114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 114

def self.optionals
  %w[
    amount_details
    bill_to
    ship_to
    line_items
    invoice_details
    shipping_details
    returns_accepted
    is_cryptocurrency_purchase
    cutoff_date_time
    pre_order
    pre_order_date
    reordered
    total_offers_count
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



235
236
237
238
239
240
241
242
243
244
245
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 235

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} amount_details: #{@amount_details.inspect}, bill_to: #{@bill_to.inspect},"\
  " ship_to: #{@ship_to.inspect}, line_items: #{@line_items.inspect}, invoice_details:"\
  " #{@invoice_details.inspect}, shipping_details: #{@shipping_details.inspect},"\
  " returns_accepted: #{@returns_accepted.inspect}, is_cryptocurrency_purchase:"\
  " #{@is_cryptocurrency_purchase.inspect}, cutoff_date_time: #{@cutoff_date_time.inspect},"\
  " pre_order: #{@pre_order.inspect}, pre_order_date: #{@pre_order_date.inspect}, reordered:"\
  " #{@reordered.inspect}, total_offers_count: #{@total_offers_count.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



223
224
225
226
227
228
229
230
231
232
# File 'lib/visa_acceptance_merged_spec/models/order_information.rb', line 223

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} amount_details: #{@amount_details}, bill_to: #{@bill_to}, ship_to:"\
  " #{@ship_to}, line_items: #{@line_items}, invoice_details: #{@invoice_details},"\
  " shipping_details: #{@shipping_details}, returns_accepted: #{@returns_accepted},"\
  " is_cryptocurrency_purchase: #{@is_cryptocurrency_purchase}, cutoff_date_time:"\
  " #{@cutoff_date_time}, pre_order: #{@pre_order}, pre_order_date: #{@pre_order_date},"\
  " reordered: #{@reordered}, total_offers_count: #{@total_offers_count},"\
  " additional_properties: #{@additional_properties}>"
end