Class: CyberSource::BatchesApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/api/batches_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default, config) ⇒ BatchesApi

Returns a new instance of BatchesApi.



18
19
20
21
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 18

def initialize(api_client = ApiClient.default, config)
  @api_client = api_client
  @api_client.set_configuration(config)
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



16
17
18
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#get_batch_report(batch_id, opts = {}) ⇒ InlineResponse20013

Retrieve a Batch Report **Get Batch Report**
This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) - Source record information including token ids, masked card number, expiration dates & card type. - Response record information including response code, reason, token ids, masked card number, expiration dates & card type.

Parameters:

  • batch_id

    Unique identification number assigned to the submitted request.

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

    the optional parameters

Returns:



29
30
31
32
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 29

def get_batch_report(batch_id, opts = {})
  data, status_code, headers = get_batch_report_with_http_info(batch_id, opts)
  return data, status_code, headers
end

#get_batch_report_with_http_info(batch_id, opts = {}) ⇒ Array<(InlineResponse20013, Fixnum, Hash)>

Retrieve a Batch Report **Get Batch Report**&lt;br&gt;This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH) - Source record information including token ids, masked card number, expiration dates &amp; card type. - Response record information including response code, reason, token ids, masked card number, expiration dates &amp; card type.

Parameters:

  • batch_id

    Unique identification number assigned to the submitted request.

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

    the optional parameters

Returns:

  • (Array<(InlineResponse20013, Fixnum, Hash)>)

    InlineResponse20013 data, response status code and response headers



39
40
41
42
43
44
45
46
47
48
49
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
103
104
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 39

def get_batch_report_with_http_info(batch_id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: BatchesApi.get_batch_report ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'batch_id' is set

  if @api_client.config.client_side_validation && batch_id.nil?
    fail ArgumentError, "Missing the required parameter 'batch_id' when calling BatchesApi.get_batch_report"
  end
  #if @api_client.config.client_side_validation && batch_id !~ Regexp.new(/^[0-9]*$/)

    #fail ArgumentError, "invalid value for 'batch_id' when calling BatchesApi.get_batch_report, must conform to the pattern /^[0-9]*$/."

  #end


  # resource path

  local_var_path = 'accountupdater/v1/batches/{batchId}/report'.sub('{' + 'batchId' + '}', batch_id.to_s)

  # query parameters

  query_params = {}

  # header parameters

  header_params = {}
  # HTTP header 'Accept' (if needed)

  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=utf-8'])
  # HTTP header 'Content-Type'

  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters

  form_params = {}

  # http body (model)

  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["get_batch_report","get_batch_report_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse20013')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: BatchesApi#get_batch_report\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_batch_status(batch_id, opts = {}) ⇒ InlineResponse20012

Retrieve a Batch Status **Get Batch Status**
This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH)

Parameters:

  • batch_id

    Unique identification number assigned to the submitted request.

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

    the optional parameters

Returns:



112
113
114
115
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 112

def get_batch_status(batch_id, opts = {})
  data, status_code, headers = get_batch_status_with_http_info(batch_id, opts)
  return data, status_code, headers
end

#get_batch_status_with_http_info(batch_id, opts = {}) ⇒ Array<(InlineResponse20012, Fixnum, Hash)>

Retrieve a Batch Status **Get Batch Status**&lt;br&gt;This resource accepts a batch id and returns: - The batch status. - The total number of accepted, rejected, updated records. - The total number of card association responses. - The billable quantities of: - New Account Numbers (NAN) - New Expiry Dates (NED) - Account Closures (ACL) - Contact Card Holders (CCH)

Parameters:

  • batch_id

    Unique identification number assigned to the submitted request.

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

    the optional parameters

Returns:

  • (Array<(InlineResponse20012, Fixnum, Hash)>)

    InlineResponse20012 data, response status code and response headers



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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 122

def get_batch_status_with_http_info(batch_id, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: BatchesApi.get_batch_status ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'batch_id' is set

  if @api_client.config.client_side_validation && batch_id.nil?
    fail ArgumentError, "Missing the required parameter 'batch_id' when calling BatchesApi.get_batch_status"
  end
  #if @api_client.config.client_side_validation && batch_id !~ Regexp.new(/^[0-9]*$/)

    #fail ArgumentError, "invalid value for 'batch_id' when calling BatchesApi.get_batch_status, must conform to the pattern /^[0-9]*$/."

  #end


  # resource path

  local_var_path = 'accountupdater/v1/batches/{batchId}/status'.sub('{' + 'batchId' + '}', batch_id.to_s)

  # query parameters

  query_params = {}

  # header parameters

  header_params = {}
  # HTTP header 'Accept' (if needed)

  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=utf-8'])
  # HTTP header 'Content-Type'

  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters

  form_params = {}

  # http body (model)

  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["get_batch_status","get_batch_status_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse20012')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: BatchesApi#get_batch_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_batches_list(opts = {}) ⇒ InlineResponse20011

List Batches **List Batches**
This resource accepts a optional date range, record offset and limit, returning a paginated response of batches containing: - The batch id. - The batch status. - The batch created / modified dates. - The total number of accepted, rejected, updated records. - The total number of card association responses.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :offset (Integer)

    Starting record in zero-based dataset that should be returned as the first object in the array. (default to 0)

  • :limit (Integer)

    The maximum number that can be returned in the array starting from the offset record in zero-based dataset. (default to 20)

  • :from_date (String)

    ISO-8601 format: yyyyMMddTHHmmssZ

  • :to_date (String)

    ISO-8601 format: yyyyMMddTHHmmssZ

Returns:



198
199
200
201
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 198

def get_batches_list(opts = {})
  data, status_code, headers = get_batches_list_with_http_info(opts)
  return data, status_code, headers
end

#get_batches_list_with_http_info(opts = {}) ⇒ Array<(InlineResponse20011, Fixnum, Hash)>

List Batches **List Batches**&lt;br&gt;This resource accepts a optional date range, record offset and limit, returning a paginated response of batches containing: - The batch id. - The batch status. - The batch created / modified dates. - The total number of accepted, rejected, updated records. - The total number of card association responses.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :offset (Integer)

    Starting record in zero-based dataset that should be returned as the first object in the array.

  • :limit (Integer)

    The maximum number that can be returned in the array starting from the offset record in zero-based dataset.

  • :from_date (String)

    ISO-8601 format: yyyyMMddTHHmmssZ

  • :to_date (String)

    ISO-8601 format: yyyyMMddTHHmmssZ

Returns:

  • (Array<(InlineResponse20011, Fixnum, Hash)>)

    InlineResponse20011 data, response status code and response headers



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
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 211

def get_batches_list_with_http_info(opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: BatchesApi.get_batches_list ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # resource path

  local_var_path = 'accountupdater/v1/batches'

  # query parameters

  query_params = {}
  query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'fromDate'] = opts[:'from_date'] if !opts[:'from_date'].nil?
  query_params[:'toDate'] = opts[:'to_date'] if !opts[:'to_date'].nil?

  # header parameters

  header_params = {}
  # HTTP header 'Accept' (if needed)

  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=utf-8'])
  # HTTP header 'Content-Type'

  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters

  form_params = {}

  # http body (model)

  if 'GET' == 'POST'
    post_body = '{}'
  else
    post_body = nil
  end
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["get_batches_list","get_batches_list_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end
  auth_names = []
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse20011')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: BatchesApi#get_batches_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#post_batch(body, opts = {}) ⇒ InlineResponse202

Create a Batch **Create a Batch**
This resource accepts TMS tokens ids of a Customer, Payment Instrument or Instrument Identifier.
The card numbers for the supplied tokens ids are then sent to the relevant card associations to check for updates.
The following type of batches can be submitted: - oneOff batch containing tokens id for Visa or MasterCard card numbers. - amexRegistration batch containing tokens id for Amex card numbers. A batch id will be returned on a successful response which can be used to get the batch status and the batch report. The availability of API features for a merchant may depend on the portfolio configuration and may need to be enabled at the portfolio level before they can be added to merchant accounts.

Parameters:

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

    the optional parameters

Returns:



280
281
282
283
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 280

def post_batch(body, opts = {})
  data, status_code, headers = post_batch_with_http_info(body, opts)
  return data, status_code, headers
end

#post_batch_with_http_info(body, opts = {}) ⇒ Array<(InlineResponse202, Fixnum, Hash)>

Create a Batch **Create a Batch**&lt;br&gt;This resource accepts TMS tokens ids of a Customer, Payment Instrument or Instrument Identifier. &lt;br&gt; The card numbers for the supplied tokens ids are then sent to the relevant card associations to check for updates.&lt;br&gt;The following type of batches can be submitted: - oneOff batch containing tokens id for Visa or MasterCard card numbers. - amexRegistration batch containing tokens id for Amex card numbers. A batch id will be returned on a successful response which can be used to get the batch status and the batch report. The availability of API features for a merchant may depend on the portfolio configuration and may need to be enabled at the portfolio level before they can be added to merchant accounts.

Parameters:

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

    the optional parameters

Returns:

  • (Array<(InlineResponse202, Fixnum, Hash)>)

    InlineResponse202 data, response status code and response headers



290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
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
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 290

def post_batch_with_http_info(body, opts = {})

  if @api_client.config.debugging
      begin
        raise
            @api_client.config.logger.debug 'Calling API: BatchesApi.post_batch ...'
        rescue
            puts 'Cannot write to log'
        end
  end
  # verify the required parameter 'body' is set

  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling BatchesApi.post_batch"
  end
  # resource path

  local_var_path = 'accountupdater/v1/batches'

  # query parameters

  query_params = {}

  # header parameters

  header_params = {}
  # HTTP header 'Accept' (if needed)

  header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=utf-8'])
  # HTTP header 'Content-Type'

  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json;charset=utf-8'])

  # form parameters

  form_params = {}

  # http body (model)

  post_body = @api_client.object_to_http_body(body)
  sdk_tracker = SdkTracker.new
  post_body = sdk_tracker.insert_developer_id_tracker(post_body, 'Body', @api_client.config.host, @api_client.merchantconfig.defaultDeveloperId)
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["post_batch","post_batch_with_http_info"])
    begin
      post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
    rescue
      raise
    end
  end
  auth_names = []
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => 'InlineResponse202')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: BatchesApi#post_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end