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

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<(InlineResponse2007, 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<(InlineResponse2007, Fixnum, Hash)>)

    InlineResponse2007 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
# 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
  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_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 = {}) ⇒ InlineResponse2006

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:



104
105
106
107
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 104

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<(InlineResponse2006, 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<(InlineResponse2006, Fixnum, Hash)>)

    InlineResponse2006 data, response status code and response headers



114
115
116
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 114

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
  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 => 'InlineResponse2006')
  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 = {}) ⇒ InlineResponse2005

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:



182
183
184
185
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 182

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<(InlineResponse2005, 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<(InlineResponse2005, Fixnum, Hash)>)

    InlineResponse2005 data, response status code and response headers



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

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
  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 => 'InlineResponse2005')
  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.

Parameters:

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

    the optional parameters

Returns:



256
257
258
259
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 256

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.

Parameters:

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

    the optional parameters

Returns:

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

    InlineResponse202 data, response status code and response headers



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
308
309
310
311
312
313
314
315
316
317
# File 'lib/cybersource_rest_client/api/batches_api.rb', line 266

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)
  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