Class: CyberSource::TransactionBatchesApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of TransactionBatchesApi.



18
19
20
21
# File 'lib/cybersource_rest_client/api/transaction_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/transaction_batches_api.rb', line 16

def api_client
  @api_client
end

Instance Method Details

#get_transaction_batch_details(id, opts = {}) ⇒ nil

Get Transaction Details for a given Batch Id Provides real-time detailed status information about the transactions that you previously uploaded in the Business Center or processed with the Offline Transaction File Submission service.

Parameters:

  • id

    The batch id assigned for the template.

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

    the optional parameters

Options Hash (opts):

  • :upload_date (Date)

    Date in which the original batch file was uploaded. Date must be in ISO-8601 format. Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd

  • :status (String)

    Allows you to filter by rejected response. Valid values: - Rejected

Returns:

  • (nil)


31
32
33
34
# File 'lib/cybersource_rest_client/api/transaction_batches_api.rb', line 31

def get_transaction_batch_details(id, opts = {})
  data, status_code, headers = get_transaction_batch_details_with_http_info(id, opts)
  return data, status_code, headers
end

#get_transaction_batch_details_with_http_info(id, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Get Transaction Details for a given Batch Id Provides real-time detailed status information about the transactions that you previously uploaded in the Business Center or processed with the Offline Transaction File Submission service.

Parameters:

  • id

    The batch id assigned for the template.

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

    the optional parameters

Options Hash (opts):

  • :upload_date (Date)

    Date in which the original batch file was uploaded. Date must be in ISO-8601 format. Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd

  • :status (String)

    Allows you to filter by rejected response. Valid values: - Rejected

Returns:

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

    nil, response status code and response headers



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
105
# File 'lib/cybersource_rest_client/api/transaction_batches_api.rb', line 43

def get_transaction_batch_details_with_http_info(id, opts = {})

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

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

  local_var_path = 'pts/v1/transaction-batch-details/{id}'.sub('{' + 'id' + '}', id.to_s)

  # query parameters

  query_params = {}
  query_params[:'uploadDate'] = opts[:'upload_date'] if !opts[:'upload_date'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?

  # header parameters

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

  header_params['Accept'] = @api_client.select_header_accept(['text/csv', 'application/xml', 'text/vnd.cybersource.map-csv'])
  # 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_transaction_batch_details","get_transaction_batch_details_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)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: TransactionBatchesApi#get_transaction_batch_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_transaction_batch_id(id, opts = {}) ⇒ PtsV1TransactionBatchesIdGet200Response

Get Individual Batch File This API provides details like upload date, completion date, transaction count and accepted and rejected transaction count of the individual batch file using the batch id

Parameters:

  • id

    The batch id assigned for the template.

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

    the optional parameters

Returns:



113
114
115
116
# File 'lib/cybersource_rest_client/api/transaction_batches_api.rb', line 113

def get_transaction_batch_id(id, opts = {})
  data, status_code, headers = get_transaction_batch_id_with_http_info(id, opts)
  return data, status_code, headers
end

#get_transaction_batch_id_with_http_info(id, opts = {}) ⇒ Array<(PtsV1TransactionBatchesIdGet200Response, Fixnum, Hash)>

Get Individual Batch File This API provides details like upload date, completion date, transaction count and accepted and rejected transaction count of the individual batch file using the batch id

Parameters:

  • id

    The batch id assigned for the template.

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

    the optional parameters

Returns:



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

def get_transaction_batch_id_with_http_info(id, opts = {})

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

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

  local_var_path = 'pts/v1/transaction-batches/{id}'.sub('{' + 'id' + '}', 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/hal+json'])
  # 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_transaction_batch_id","get_transaction_batch_id_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 => 'PtsV1TransactionBatchesIdGet200Response')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: TransactionBatchesApi#get_transaction_batch_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#get_transaction_batches(start_time, end_time, opts = {}) ⇒ PtsV1TransactionBatchesGet200Response

Get a List of Batch Files Provide the date and time search range to get a list of Batch Files ready for settlement

Parameters:

Returns:



193
194
195
196
# File 'lib/cybersource_rest_client/api/transaction_batches_api.rb', line 193

def get_transaction_batches(start_time, end_time, opts = {})
  data, status_code, headers = get_transaction_batches_with_http_info(start_time, end_time, opts)
  return data, status_code, headers
end

#get_transaction_batches_with_http_info(start_time, end_time, opts = {}) ⇒ Array<(PtsV1TransactionBatchesGet200Response, Fixnum, Hash)>

Get a List of Batch Files Provide the date and time search range to get a list of Batch Files ready for settlement

Parameters:

Returns:



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

def get_transaction_batches_with_http_info(start_time, end_time, opts = {})

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

  if @api_client.config.client_side_validation && start_time.nil?
    fail ArgumentError, "Missing the required parameter 'start_time' when calling TransactionBatchesApi.get_transaction_batches"
  end
  # verify the required parameter 'end_time' is set

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

  local_var_path = 'pts/v1/transaction-batches'

  # query parameters

  query_params = {}
  query_params[:'startTime'] = start_time
  query_params[:'endTime'] = end_time

  # header parameters

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

  header_params['Accept'] = @api_client.select_header_accept(['application/hal+json'])
  # 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_transaction_batches","get_transaction_batches_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 => 'PtsV1TransactionBatchesGet200Response')
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: TransactionBatchesApi#get_transaction_batches\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end

#upload_transaction_batch(file, opts = {}) ⇒ nil

Upload a Batch File This endpoint enables the upload of a batch file containing transactions for processing.

Parameters:

  • file

    The file to upload.

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

    the optional parameters

Returns:

  • (nil)


279
280
281
282
# File 'lib/cybersource_rest_client/api/transaction_batches_api.rb', line 279

def upload_transaction_batch(file, opts = {})
  data, status_code, headers = upload_transaction_batch_with_http_info(file, opts)
  return data, status_code, headers
end

#upload_transaction_batch_with_http_info(file, opts = {}) ⇒ Array<(nil, Fixnum, Hash)>

Upload a Batch File This endpoint enables the upload of a batch file containing transactions for processing.

Parameters:

  • file

    The file to upload.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/cybersource_rest_client/api/transaction_batches_api.rb', line 289

def upload_transaction_batch_with_http_info(file, opts = {})

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

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

  local_var_path = 'pts/v1/transaction-batch-upload'

  # query parameters

  query_params = {}

  boundary = SecureRandom.hex
  delimiter = "-------------" + boundary
  # header parameters

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

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

  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data; boundary=' + delimiter])

  # form parameters

  form_params = {}
  form_params[File.basename(file)] = File.read(file)

  # http body (model)

  if 'POST' == 'POST'
    post_body = '{}'
    require_relative '../utilities/multipart/multipart_helper'
    multipart_helper = MultipartHelper.new
    post_body = multipart_helper.build_data_files(boundary, form_params)
  else
    post_body = nil
  end
  inbound_mle_status = "false"      
  if MLEUtility.check_is_mle_for_API(@api_client.merchantconfig, inbound_mle_status, ["upload_transaction_batch","upload_transaction_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)
  if @api_client.config.debugging
    begin
    raise
        @api_client.config.logger.debug "API called: TransactionBatchesApi#upload_transaction_batch\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
    rescue
        puts 'Cannot write to log'
    end
  end
  return data, status_code, headers
end