Class: CyberSource::VpriRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/models/vpri_request.rb

Overview

Unified risk assessment request with action-based routing

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VpriRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



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
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
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
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 186

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'actions')
    if (value = attributes[:'actions']).is_a?(Array)
      self.actions = value
    end
  end

  if attributes.has_key?(:'events')
    if (value = attributes[:'events']).is_a?(Array)
      self.events = value
    end
  end

  if attributes.has_key?(:'transaction')
    self.transaction = attributes[:'transaction']
  end

  if attributes.has_key?(:'requestId')
    self.request_id = attributes[:'requestId']
  end

  if attributes.has_key?(:'eventTime')
    self.event_time = attributes[:'eventTime']
  end

  if attributes.has_key?(:'context')
    self.context = attributes[:'context']
  end

  if attributes.has_key?(:'mode')
    self.mode = attributes[:'mode']
  end

  if attributes.has_key?(:'requestComments')
    self.request_comments = attributes[:'requestComments']
  end

  if attributes.has_key?(:'schemaVersion')
    self.schema_version = attributes[:'schemaVersion']
  end

  if attributes.has_key?(:'partner')
    self.partner = attributes[:'partner']
  end

  if attributes.has_key?(:'payment')
    self.payment = attributes[:'payment']
  end

  if attributes.has_key?(:'order')
    self.order = attributes[:'order']
  end

  if attributes.has_key?(:'customer')
    self.customer = attributes[:'customer']
  end

  if attributes.has_key?(:'riskAssessment')
    self.risk_assessment = attributes[:'riskAssessment']
  end

  if attributes.has_key?(:'travel')
    self.travel = attributes[:'travel']
  end

  if attributes.has_key?(:'merchant')
    self.merchant = attributes[:'merchant']
  end

  if attributes.has_key?(:'acquirer')
    self.acquirer = attributes[:'acquirer']
  end

  if attributes.has_key?(:'device')
    self.device = attributes[:'device']
  end

  if attributes.has_key?(:'session')
    self.session = attributes[:'session']
  end

  if attributes.has_key?(:'supplementaryData')
    self.supplementary_data = attributes[:'supplementaryData']
  end

  if attributes.has_key?(:'labels')
    self.labels = attributes[:'labels']
  end

  if attributes.has_key?(:'account')
    self. = attributes[:'account']
  end

  if attributes.has_key?(:'authentication')
    self.authentication = attributes[:'authentication']
  end

  if attributes.has_key?(:'authorization')
    self.authorization = attributes[:'authorization']
  end

  if attributes.has_key?(:'browser')
    self.browser = attributes[:'browser']
  end

  if attributes.has_key?(:'initiatingParty')
    self.initiating_party = attributes[:'initiatingParty']
  end

  if attributes.has_key?(:'terminal')
    self.terminal = attributes[:'terminal']
  end

  if attributes.has_key?(:'thirdPartyRisk')
    self.third_party_risk = attributes[:'thirdPartyRisk']
  end
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



68
69
70
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 68

def 
  @account
end

#acquirerObject

Returns the value of attribute acquirer.



57
58
59
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 57

def acquirer
  @acquirer
end

#actionsObject

Actions to perform. For VPRI, specify VISA_PROTECT_RISK_INSIGHTS. Multiple actions may be included in a single request to invoke additional services simultaneously.



18
19
20
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 18

def actions
  @actions
end

#authenticationObject

Returns the value of attribute authentication.



70
71
72
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 70

def authentication
  @authentication
end

#authorizationObject

Returns the value of attribute authorization.



72
73
74
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 72

def authorization
  @authorization
end

#browserObject

Returns the value of attribute browser.



74
75
76
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 74

def browser
  @browser
end

#contextObject

The context in which the request is made.



32
33
34
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 32

def context
  @context
end

#customerObject

Returns the value of attribute customer.



49
50
51
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 49

def customer
  @customer
end

#deviceObject

Returns the value of attribute device.



59
60
61
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 59

def device
  @device
end

#event_timeObject

The time that the real-world event occurred.



29
30
31
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 29

def event_time
  @event_time
end

#eventsObject

The events to be performed under specific actions. For VISA_PROTECT_RISK_INSIGHTS, supported values are LABELS and INSIGHTS.



21
22
23
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 21

def events
  @events
end

#initiating_partyObject

Returns the value of attribute initiating_party.



76
77
78
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 76

def initiating_party
  @initiating_party
end

#labelsObject

Returns the value of attribute labels.



66
67
68
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 66

def labels
  @labels
end

#merchantObject

Returns the value of attribute merchant.



55
56
57
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 55

def merchant
  @merchant
end

#modeObject

Indicates whether the request is live or a test.



35
36
37
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 35

def mode
  @mode
end

#orderObject

Returns the value of attribute order.



47
48
49
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 47

def order
  @order
end

#partnerObject

Returns the value of attribute partner.



43
44
45
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 43

def partner
  @partner
end

#paymentObject

Returns the value of attribute payment.



45
46
47
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 45

def payment
  @payment
end

#request_commentsObject

Brief description or comments about the request



38
39
40
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 38

def request_comments
  @request_comments
end

#request_idObject

Unique identifier for the risk assessment request



26
27
28
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 26

def request_id
  @request_id
end

#risk_assessmentObject

Returns the value of attribute risk_assessment.



51
52
53
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 51

def risk_assessment
  @risk_assessment
end

#schema_versionObject

Version of the request schema



41
42
43
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 41

def schema_version
  @schema_version
end

#sessionObject

Returns the value of attribute session.



61
62
63
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 61

def session
  @session
end

#supplementary_dataObject

Free-form field for information not catered for by other components. Must not contain cardholder data or sensitive auth data.



64
65
66
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 64

def supplementary_data
  @supplementary_data
end

#terminalObject

Returns the value of attribute terminal.



78
79
80
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 78

def terminal
  @terminal
end

#third_party_riskObject

Returns the value of attribute third_party_risk.



80
81
82
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 80

def third_party_risk
  @third_party_risk
end

#transactionObject

Returns the value of attribute transaction.



23
24
25
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 23

def transaction
  @transaction
end

#travelObject

Returns the value of attribute travel.



53
54
55
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 53

def travel
  @travel
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 83

def self.attribute_map
  {
    :'actions' => :'actions',
    :'events' => :'events',
    :'transaction' => :'transaction',
    :'request_id' => :'requestId',
    :'event_time' => :'eventTime',
    :'context' => :'context',
    :'mode' => :'mode',
    :'request_comments' => :'requestComments',
    :'schema_version' => :'schemaVersion',
    :'partner' => :'partner',
    :'payment' => :'payment',
    :'order' => :'order',
    :'customer' => :'customer',
    :'risk_assessment' => :'riskAssessment',
    :'travel' => :'travel',
    :'merchant' => :'merchant',
    :'acquirer' => :'acquirer',
    :'device' => :'device',
    :'session' => :'session',
    :'supplementary_data' => :'supplementaryData',
    :'labels' => :'labels',
    :'account' => :'account',
    :'authentication' => :'authentication',
    :'authorization' => :'authorization',
    :'browser' => :'browser',
    :'initiating_party' => :'initiatingParty',
    :'terminal' => :'terminal',
    :'third_party_risk' => :'thirdPartyRisk'
  }
end

.json_mapObject

Attribute mapping from JSON key to ruby-style variable name.



117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 117

def self.json_map
  {
    :'actions' => :'actions',
    :'events' => :'events',
    :'transaction' => :'transaction',
    :'request_id' => :'request_id',
    :'event_time' => :'event_time',
    :'context' => :'context',
    :'mode' => :'mode',
    :'request_comments' => :'request_comments',
    :'schema_version' => :'schema_version',
    :'partner' => :'partner',
    :'payment' => :'payment',
    :'order' => :'order',
    :'customer' => :'customer',
    :'risk_assessment' => :'risk_assessment',
    :'travel' => :'travel',
    :'merchant' => :'merchant',
    :'acquirer' => :'acquirer',
    :'device' => :'device',
    :'session' => :'session',
    :'supplementary_data' => :'supplementary_data',
    :'labels' => :'labels',
    :'account' => :'account',
    :'authentication' => :'authentication',
    :'authorization' => :'authorization',
    :'browser' => :'browser',
    :'initiating_party' => :'initiating_party',
    :'terminal' => :'terminal',
    :'third_party_risk' => :'third_party_risk'
  }
end

.swagger_typesObject

Attribute type mapping.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 151

def self.swagger_types
  {
    :'actions' => :'Array<String>',
    :'events' => :'Array<String>',
    :'transaction' => :'UnifiedriskTransaction',
    :'request_id' => :'String',
    :'event_time' => :'DateTime',
    :'context' => :'String',
    :'mode' => :'String',
    :'request_comments' => :'String',
    :'schema_version' => :'Integer',
    :'partner' => :'UnifiedriskPartner',
    :'payment' => :'UnifiedriskPayment',
    :'order' => :'UnifiedriskOrder',
    :'customer' => :'UnifiedriskCustomer',
    :'risk_assessment' => :'UnifiedriskRiskAssessment',
    :'travel' => :'UnifiedriskTravel',
    :'merchant' => :'UnifiedriskMerchant',
    :'acquirer' => :'UnifiedriskAcquirer',
    :'device' => :'UnifiedriskDevice',
    :'session' => :'UnifiedriskSession',
    :'supplementary_data' => :'String',
    :'labels' => :'UnifiedriskLabels',
    :'account' => :'UnifiedriskAccount',
    :'authentication' => :'UnifiedriskAuthentication',
    :'authorization' => :'UnifiedriskAuthorization',
    :'browser' => :'UnifiedriskBrowser',
    :'initiating_party' => :'UnifiedriskInitiatingParty',
    :'terminal' => :'UnifiedriskTerminal',
    :'third_party_risk' => :'UnifiedriskThirdPartyRisk'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 356

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      actions == o.actions &&
      events == o.events &&
      transaction == o.transaction &&
      request_id == o.request_id &&
      event_time == o.event_time &&
      context == o.context &&
      mode == o.mode &&
      request_comments == o.request_comments &&
      schema_version == o.schema_version &&
      partner == o.partner &&
      payment == o.payment &&
      order == o.order &&
      customer == o.customer &&
      risk_assessment == o.risk_assessment &&
      travel == o.travel &&
      merchant == o.merchant &&
      acquirer == o.acquirer &&
      device == o.device &&
      session == o.session &&
      supplementary_data == o.supplementary_data &&
      labels == o.labels &&
       == o. &&
      authentication == o.authentication &&
      authorization == o.authorization &&
      browser == o.browser &&
      initiating_party == o.initiating_party &&
      terminal == o.terminal &&
      third_party_risk == o.third_party_risk
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 425

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = CyberSource.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



491
492
493
494
495
496
497
498
499
500
501
502
503
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 491

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 404

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{self.class.json_map[key]}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{self.class.json_map[key]}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


391
392
393
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 391

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



397
398
399
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 397

def hash
  [actions, events, transaction, request_id, event_time, context, mode, request_comments, schema_version, partner, payment, order, customer, risk_assessment, travel, merchant, acquirer, device, session, supplementary_data, labels, , authentication, authorization, browser, initiating_party, terminal, third_party_risk].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 311

def list_invalid_properties
  invalid_properties = Array.new
  if @actions.nil?
    invalid_properties.push('invalid value for "actions", actions cannot be nil.')
  end

  if @events.nil?
    invalid_properties.push('invalid value for "events", events cannot be nil.')
  end

  if @transaction.nil?
    invalid_properties.push('invalid value for "transaction", transaction cannot be nil.')
  end

  if @event_time.nil?
    invalid_properties.push('invalid value for "event_time", event_time cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



471
472
473
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 471

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



477
478
479
480
481
482
483
484
485
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 477

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



465
466
467
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 465

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



334
335
336
337
338
339
340
# File 'lib/cybersource_rest_client/models/vpri_request.rb', line 334

def valid?
  return false if @actions.nil?
  return false if @events.nil?
  return false if @transaction.nil?
  return false if @event_time.nil?
  true
end