Class: UltracartClient::FraudApi

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/api/fraud_api.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ FraudApi

Returns a new instance of FraudApi.



19
20
21
# File 'lib/ultracart_api/api/fraud_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_client ⇒ Object

Returns the value of attribute api_client.



17
18
19
# File 'lib/ultracart_api/api/fraud_api.rb', line 17

def api_client
  @api_client
end

Class Method Details

.new_using_api_key(simple_key, verify_ssl = true, debugging = false) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ultracart_api/api/fraud_api.rb', line 23

def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
  api_config = Configuration.new
  api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
  api_config.api_version = '2017-03-01'
  api_config.verify_ssl = verify_ssl

  api_client = ApiClient.new(api_config)
  api_client.config.debugging = debugging

  UltracartClient::FraudApi.new(api_client)
end

Instance Method Details

#decline_email(fraud_decline_emails_request, opts = {}) ⇒ nil

Decline email during checkout fraud review Adds one email address to the fraud decline list for this merchant account.

Parameters:

  • fraud_decline_emails_request (FraudDeclineEmailRequest) —

    Fraud decline emails request

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (nil)


40
41
42
43
# File 'lib/ultracart_api/api/fraud_api.rb', line 40

def decline_email(fraud_decline_emails_request, opts = {})
  decline_email_with_http_info(fraud_decline_emails_request, opts)
  nil
end

#decline_email_with_http_info(fraud_decline_emails_request, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Decline email during checkout fraud review Adds one email address to the fraud decline list for this merchant account.

Parameters:

  • fraud_decline_emails_request (FraudDeclineEmailRequest) —

    Fraud decline emails request

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/ultracart_api/api/fraud_api.rb', line 50

def decline_email_with_http_info(fraud_decline_emails_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FraudApi.decline_email ...'
  end
  # verify the required parameter 'fraud_decline_emails_request' is set
  if @api_client.config.client_side_validation && fraud_decline_emails_request.nil?
    fail ArgumentError, "Missing the required parameter 'fraud_decline_emails_request' when calling FraudApi.decline_email"
  end
  # resource path
  local_var_path = '/fraud/decline_email'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(fraud_decline_emails_request)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FraudApi.decline_email",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FraudApi#decline_email\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_fraud_rule(fraud_rule_oid, opts = {}) ⇒ nil

Delete a fraud rule Deletes a fraud rule for this merchant account.

Parameters:

  • fraud_rule_oid (Integer)
  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (nil)


109
110
111
112
# File 'lib/ultracart_api/api/fraud_api.rb', line 109

def delete_fraud_rule(fraud_rule_oid, opts = {})
  delete_fraud_rule_with_http_info(fraud_rule_oid, opts)
  nil
end

#delete_fraud_rule_with_http_info(fraud_rule_oid, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete a fraud rule Deletes a fraud rule for this merchant account.

Parameters:

  • fraud_rule_oid (Integer)
  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>) —

    nil, response status code and response headers



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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/ultracart_api/api/fraud_api.rb', line 119

def delete_fraud_rule_with_http_info(fraud_rule_oid, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FraudApi.delete_fraud_rule ...'
  end
  # verify the required parameter 'fraud_rule_oid' is set
  if @api_client.config.client_side_validation && fraud_rule_oid.nil?
    fail ArgumentError, "Missing the required parameter 'fraud_rule_oid' when calling FraudApi.delete_fraud_rule"
  end
  # resource path
  local_var_path = '/fraud/rules/{fraud_rule_oid}'.sub('{' + 'fraud_rule_oid' + '}', CGI.escape(fraud_rule_oid.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FraudApi.delete_fraud_rule",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FraudApi#delete_fraud_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#establish_fraud_rules_from_order(fraud_rule_from_order_request, opts = {}) ⇒ FraudRulesResponse

Establish fraud rules from an order Creates one or more fraud rules for this merchant account derived from an existing order, mirroring the 'establish fraud filter' action in the order processing screen. Select which filters to establish; all values are taken from the order. The IP rule is created against the order's /24 subnet (last octet masked). The credit card filter duplicates the order's stored card vault token, so no card number is sent through the API. Filters whose order data is missing (no stored card, no email, no usable IP, or no numeric street) are skipped and reported in the warning slot rather than failing the request.

Parameters:

  • fraud_rule_from_order_request (FraudRuleFromOrderRequest) —

    Fraud rule from order request

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



173
174
175
176
# File 'lib/ultracart_api/api/fraud_api.rb', line 173

def establish_fraud_rules_from_order(fraud_rule_from_order_request, opts = {})
  data, _status_code, _headers = establish_fraud_rules_from_order_with_http_info(fraud_rule_from_order_request, opts)
  data
end

#establish_fraud_rules_from_order_with_http_info(fraud_rule_from_order_request, opts = {}) ⇒ Array<(FraudRulesResponse, Integer, Hash)>

Establish fraud rules from an order Creates one or more fraud rules for this merchant account derived from an existing order, mirroring the 'establish fraud filter' action in the order processing screen. Select which filters to establish; all values are taken from the order. The IP rule is created against the order's /24 subnet (last octet masked). The credit card filter duplicates the order's stored card vault token, so no card number is sent through the API. Filters whose order data is missing (no stored card, no email, no usable IP, or no numeric street) are skipped and reported in the warning slot rather than failing the request.

Parameters:

  • fraud_rule_from_order_request (FraudRuleFromOrderRequest) —

    Fraud rule from order request

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(FraudRulesResponse, Integer, Hash)>) —

    FraudRulesResponse data, response status code and response headers



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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/ultracart_api/api/fraud_api.rb', line 183

def establish_fraud_rules_from_order_with_http_info(fraud_rule_from_order_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FraudApi.establish_fraud_rules_from_order ...'
  end
  # verify the required parameter 'fraud_rule_from_order_request' is set
  if @api_client.config.client_side_validation && fraud_rule_from_order_request.nil?
    fail ArgumentError, "Missing the required parameter 'fraud_rule_from_order_request' when calling FraudApi.establish_fraud_rules_from_order"
  end
  # resource path
  local_var_path = '/fraud/rules/from_order'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(fraud_rule_from_order_request)

  # return_type
  return_type = opts[:debug_return_type] || 'FraudRulesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FraudApi.establish_fraud_rules_from_order",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FraudApi#establish_fraud_rules_from_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_fraud_lookup_values(opts = {}) ⇒ FraudLookupValuesResponse

Retrieve fraud rule lookup values Returns the dropdown values required to build valid fraud rule insert and search requests. Includes rule types, failure actions, user actions, IP range types, AVS match types, the merchant's rotating transaction gateways, screen branding themes, countries, and affiliates.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



241
242
243
244
# File 'lib/ultracart_api/api/fraud_api.rb', line 241

def get_fraud_lookup_values(opts = {})
  data, _status_code, _headers = get_fraud_lookup_values_with_http_info(opts)
  data
end

#get_fraud_lookup_values_with_http_info(opts = {}) ⇒ Array<(FraudLookupValuesResponse, Integer, Hash)>

Retrieve fraud rule lookup values Returns the dropdown values required to build valid fraud rule insert and search requests. Includes rule types, failure actions, user actions, IP range types, AVS match types, the merchant's rotating transaction gateways, screen branding themes, countries, and affiliates.

Parameters:

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(FraudLookupValuesResponse, Integer, Hash)>) —

    FraudLookupValuesResponse data, response status code and response headers



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
# File 'lib/ultracart_api/api/fraud_api.rb', line 250

def get_fraud_lookup_values_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FraudApi.get_fraud_lookup_values ...'
  end
  # resource path
  local_var_path = '/fraud/lookup_values'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'FraudLookupValuesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FraudApi.get_fraud_lookup_values",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FraudApi#get_fraud_lookup_values\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#insert_fraud_rule(fraud_rule_insert_request, opts = {}) ⇒ FraudRuleResponse

Insert a fraud rule Creates a fraud rule for this merchant account. Field names in the request body are semantic (eg amount_threshold, email, ip_address). Call GET /v2/fraud/lookup_values for the list of valid rule_type, failure_action, and related dropdown values. The 'credit card matches' rule type is not supported via REST.

Parameters:

  • fraud_rule_insert_request (FraudRuleInsertRequest) —

    Fraud rule insert request

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:



300
301
302
303
# File 'lib/ultracart_api/api/fraud_api.rb', line 300

def insert_fraud_rule(fraud_rule_insert_request, opts = {})
  data, _status_code, _headers = insert_fraud_rule_with_http_info(fraud_rule_insert_request, opts)
  data
end

#insert_fraud_rule_with_http_info(fraud_rule_insert_request, opts = {}) ⇒ Array<(FraudRuleResponse, Integer, Hash)>

Insert a fraud rule Creates a fraud rule for this merchant account. Field names in the request body are semantic (eg amount_threshold, email, ip_address). Call GET /v2/fraud/lookup_values for the list of valid rule_type, failure_action, and related dropdown values. The 'credit card matches' rule type is not supported via REST.

Parameters:

  • fraud_rule_insert_request (FraudRuleInsertRequest) —

    Fraud rule insert request

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Returns:

  • (Array<(FraudRuleResponse, Integer, Hash)>) —

    FraudRuleResponse data, response status code and response headers



310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
# File 'lib/ultracart_api/api/fraud_api.rb', line 310

def insert_fraud_rule_with_http_info(fraud_rule_insert_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FraudApi.insert_fraud_rule ...'
  end
  # verify the required parameter 'fraud_rule_insert_request' is set
  if @api_client.config.client_side_validation && fraud_rule_insert_request.nil?
    fail ArgumentError, "Missing the required parameter 'fraud_rule_insert_request' when calling FraudApi.insert_fraud_rule"
  end
  # resource path
  local_var_path = '/fraud/rules'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(fraud_rule_insert_request)

  # return_type
  return_type = opts[:debug_return_type] || 'FraudRuleResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FraudApi.insert_fraud_rule",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FraudApi#insert_fraud_rule\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#search_fraud_rules(fraud_rule_search_request, opts = {}) ⇒ FraudRulesResponse

Search fraud rules Searches fraud rules for this merchant account using semantic filter fields. Pagination and sort are passed as query parameters (_limit, _offset, _sort). You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. Results are capped at 10,000 records by ElasticSearch and the warning slot indicates when that cap was hit. Use more selective filters in that case.

Parameters:

  • fraud_rule_search_request (FraudRuleSearchRequest) —

    Fraud rule search request

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :_limit (Integer) —

    The maximum number of records to return on this one API call. (Maximum 200) (default to 100)

  • :_offset (Integer) —

    Pagination of the record set. Offset is a zero based index. (default to 0)

  • :_sort (String) —

    The sort order of the fraud rules. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.

Returns:



372
373
374
375
# File 'lib/ultracart_api/api/fraud_api.rb', line 372

def search_fraud_rules(fraud_rule_search_request, opts = {})
  data, _status_code, _headers = search_fraud_rules_with_http_info(fraud_rule_search_request, opts)
  data
end

#search_fraud_rules_with_http_info(fraud_rule_search_request, opts = {}) ⇒ Array<(FraudRulesResponse, Integer, Hash)>

Search fraud rules Searches fraud rules for this merchant account using semantic filter fields. Pagination and sort are passed as query parameters (_limit, _offset, _sort). You will need to make multiple API calls in order to retrieve the entire result set since this API performs result set pagination. Results are capped at 10,000 records by ElasticSearch and the warning slot indicates when that cap was hit. Use more selective filters in that case.

Parameters:

  • fraud_rule_search_request (FraudRuleSearchRequest) —

    Fraud rule search request

  • opts (Hash) (defaults to: {}) —

    the optional parameters

Options Hash (opts):

  • :_limit (Integer) —

    The maximum number of records to return on this one API call. (Maximum 200) (default to 100)

  • :_offset (Integer) —

    Pagination of the record set. Offset is a zero based index. (default to 0)

  • :_sort (String) —

    The sort order of the fraud rules. See Sorting documentation for examples of using multiple values and sorting by ascending and descending.

Returns:

  • (Array<(FraudRulesResponse, Integer, Hash)>) —

    FraudRulesResponse data, response status code and response headers



385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
# File 'lib/ultracart_api/api/fraud_api.rb', line 385

def search_fraud_rules_with_http_info(fraud_rule_search_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FraudApi.search_fraud_rules ...'
  end
  # verify the required parameter 'fraud_rule_search_request' is set
  if @api_client.config.client_side_validation && fraud_rule_search_request.nil?
    fail ArgumentError, "Missing the required parameter 'fraud_rule_search_request' when calling FraudApi.search_fraud_rules"
  end
  # resource path
  local_var_path = '/fraud/rules/search'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
  query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
  query_params[:'_sort'] = opts[:'_sort'] if !opts[:'_sort'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(fraud_rule_search_request)

  # return_type
  return_type = opts[:debug_return_type] || 'FraudRulesResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']

  new_options = opts.merge(
    :operation => :"FraudApi.search_fraud_rules",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FraudApi#search_fraud_rules\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end