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



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 = {}) ⇒ InlineResponse2009

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.



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<(InlineResponse2009, 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.



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
# 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
  is_mle_supported_by_cybs_for_api = false
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, is_mle_supported_by_cybs_for_api, ["get_batch_report","get_batch_report_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  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 => 'InlineResponse2009')
  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 = {}) ⇒ InlineResponse2008

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)



108
109
110
111
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 108

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<(InlineResponse2008, 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)



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

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
  is_mle_supported_by_cybs_for_api = false
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, is_mle_supported_by_cybs_for_api, ["get_batch_status","get_batch_status_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  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 => 'InlineResponse2008')
  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 = {}) ⇒ InlineResponse2007

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.

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



190
191
192
193
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 190

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<(InlineResponse2007, 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.

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



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

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
  is_mle_supported_by_cybs_for_api = false
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, is_mle_supported_by_cybs_for_api, ["get_batches_list","get_batches_list_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  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 => 'InlineResponse2007')
  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.



268
269
270
271
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 268

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.



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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 278

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)
  is_mle_supported_by_cybs_for_api = false
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, is_mle_supported_by_cybs_for_api, ["post_batch","post_batch_with_http_info"])
    post_body = MLEUtility.encrypt_request_payload(@api_client.merchantconfig, post_body)
  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