Class: Komoju::ChargebacksApi

Inherits:
Object
  • Object
show all
Defined in:
lib/komoju-sdk/api/chargebacks_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ChargebacksApi

Returns a new instance of ChargebacksApi.



19
20
21
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

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

Chargeback: Accept Accepts a chargeback, agreeing to the dispute. Takes no request body. A chargeback can only be accepted while its status is pending. If the due date has passed, the request returns an error. Accepting an already-accepted chargeback returns 204 (idempotent).

Parameters:

  • id (String)

    The chargeback request UUID.

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

    the optional parameters

Returns:

  • (nil)


27
28
29
30
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 27

def accept_chargeback_request(id, opts = {})
  accept_chargeback_request_with_http_info(id, opts)
  nil
end

#accept_chargeback_request_with_http_info(id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Chargeback: Accept Accepts a chargeback, agreeing to the dispute. Takes no request body. A chargeback can only be accepted while its status is `pending`. If the due date has passed, the request returns an error. Accepting an already-accepted chargeback returns `204` (idempotent).

Parameters:

  • id (String)

    The chargeback request UUID.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



37
38
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
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 37

def accept_chargeback_request_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ChargebacksApi.accept_chargeback_request ...'
  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 ChargebacksApi.accept_chargeback_request"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling ChargebacksApi.accept_chargeback_request, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 25
    fail ArgumentError, 'invalid value for "id" when calling ChargebacksApi.accept_chargeback_request, the character length must be greater than or equal to 25.'
  end

  # resource path
  local_var_path = '/chargeback_requests/{id}/accept'.sub('{id}', CGI.escape(id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

  # 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] || ['api_key']

  new_options = opts.merge(
    :operation => :"ChargebacksApi.accept_chargeback_request",
    :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: ChargebacksApi#accept_chargeback_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#defend_chargeback_request(id, defend_chargeback_request_body, opts = {}) ⇒ nil

Chargeback: Defend Submits a defense against a chargeback, including supporting documentation. A chargeback can only be defended while its status is pending. If the due date has passed, the request returns an error. Defending an already-defended chargeback returns 204 (idempotent). Only one defense can be created per chargeback request. The document.document_base64 payload must be 15 MB or less. Supported types are PDF, JPG/JPEG, PNG, and GIF; the type is inferred from the file's bytes, not the filename.

Parameters:

  • id (String)

    The chargeback request UUID.

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

    the optional parameters

Returns:

  • (nil)


99
100
101
102
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 99

def defend_chargeback_request(id, defend_chargeback_request_body, opts = {})
  defend_chargeback_request_with_http_info(id, defend_chargeback_request_body, opts)
  nil
end

#defend_chargeback_request_with_http_info(id, defend_chargeback_request_body, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Chargeback: Defend Submits a defense against a chargeback, including supporting documentation. A chargeback can only be defended while its status is `pending`. If the due date has passed, the request returns an error. Defending an already-defended chargeback returns `204` (idempotent). Only one defense can be created per chargeback request. The `document.document_base64` payload must be 15 MB or less. Supported types are PDF, JPG/JPEG, PNG, and GIF; the type is inferred from the file's bytes, not the filename.

Parameters:

  • id (String)

    The chargeback request UUID.

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



110
111
112
113
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
172
173
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 110

def defend_chargeback_request_with_http_info(id, defend_chargeback_request_body, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ChargebacksApi.defend_chargeback_request ...'
  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 ChargebacksApi.defend_chargeback_request"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling ChargebacksApi.defend_chargeback_request, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 25
    fail ArgumentError, 'invalid value for "id" when calling ChargebacksApi.defend_chargeback_request, the character length must be greater than or equal to 25.'
  end

  # verify the required parameter 'defend_chargeback_request_body' is set
  if @api_client.config.client_side_validation && defend_chargeback_request_body.nil?
    fail ArgumentError, "Missing the required parameter 'defend_chargeback_request_body' when calling ChargebacksApi.defend_chargeback_request"
  end
  # resource path
  local_var_path = '/chargeback_requests/{id}/defend'.sub('{id}', CGI.escape(id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # 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(defend_chargeback_request_body)

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key']

  new_options = opts.merge(
    :operation => :"ChargebacksApi.defend_chargeback_request",
    :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: ChargebacksApi#defend_chargeback_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_chargeback_requests(opts = {}) ⇒ ChargebackRequestList

Chargeback: List Retrieves a paginated list of chargeback requests for the authenticated merchant. Results are ordered with pending chargebacks first, followed by non-pending chargebacks. There is no request sort parameter. This endpoint is only available to merchants with the chargeback feature enabled; otherwise it returns 404 Not Found.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start_time (Time)

    Query for records created after this time.

  • :end_time (Time)

    Query for records created before this time.

  • :per_page (Integer)

    How many objects per page.

  • :page (Integer)

    Page number to query for.

  • :status (ChargebackStatus)

    Filter by chargeback status.

  • :payment_id (String)

    Filter by the associated payment ID.

  • :due_date_start (Time)

    Lower bound (inclusive) on the chargeback's due date.

  • :due_date_end (Time)

    Upper bound (inclusive) on the chargeback's due date.

Returns:



187
188
189
190
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 187

def list_chargeback_requests(opts = {})
  data, _status_code, _headers = list_chargeback_requests_with_http_info(opts)
  data
end

#list_chargeback_requests_with_http_info(opts = {}) ⇒ Array<(ChargebackRequestList, Integer, Hash)>

Chargeback: List Retrieves a paginated list of chargeback requests for the authenticated merchant. Results are ordered with `pending` chargebacks first, followed by non-pending chargebacks. There is no request sort parameter. This endpoint is only available to merchants with the chargeback feature enabled; otherwise it returns `404 Not Found`.

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :start_time (Time)

    Query for records created after this time.

  • :end_time (Time)

    Query for records created before this time.

  • :per_page (Integer)

    How many objects per page.

  • :page (Integer)

    Page number to query for.

  • :status (ChargebackStatus)

    Filter by chargeback status.

  • :payment_id (String)

    Filter by the associated payment ID.

  • :due_date_start (Time)

    Lower bound (inclusive) on the chargeback's due date.

  • :due_date_end (Time)

    Upper bound (inclusive) on the chargeback's due date.

Returns:

  • (Array<(ChargebackRequestList, Integer, Hash)>)

    ChargebackRequestList data, response status code and response headers



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
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 204

def list_chargeback_requests_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ChargebacksApi.list_chargeback_requests ...'
  end
  # resource path
  local_var_path = '/chargeback_requests'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'start_time'] = opts[:'start_time'] if !opts[:'start_time'].nil?
  query_params[:'end_time'] = opts[:'end_time'] if !opts[:'end_time'].nil?
  query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?
  query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?
  query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
  query_params[:'payment_id'] = opts[:'payment_id'] if !opts[:'payment_id'].nil?
  query_params[:'due_date_start'] = opts[:'due_date_start'] if !opts[:'due_date_start'].nil?
  query_params[:'due_date_end'] = opts[:'due_date_end'] if !opts[:'due_date_end'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key']

  new_options = opts.merge(
    :operation => :"ChargebacksApi.list_chargeback_requests",
    :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: ChargebacksApi#list_chargeback_requests\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#show_chargeback_request(id, opts = {}) ⇒ ChargebackRequestDetail

Chargeback: Show Retrieves the details of a single chargeback request, including its timeline, payment, customer, and defense (if one exists). This endpoint is only available to merchants with the chargeback feature enabled; otherwise it returns 404 Not Found.

Parameters:

  • id (String)

    The chargeback request UUID.

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

    the optional parameters

Returns:



261
262
263
264
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 261

def show_chargeback_request(id, opts = {})
  data, _status_code, _headers = show_chargeback_request_with_http_info(id, opts)
  data
end

#show_chargeback_request_with_http_info(id, opts = {}) ⇒ Array<(ChargebackRequestDetail, Integer, Hash)>

Chargeback: Show Retrieves the details of a single chargeback request, including its timeline, payment, customer, and defense (if one exists). This endpoint is only available to merchants with the chargeback feature enabled; otherwise it returns `404 Not Found`.

Parameters:

  • id (String)

    The chargeback request UUID.

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

    the optional parameters

Returns:

  • (Array<(ChargebackRequestDetail, Integer, Hash)>)

    ChargebackRequestDetail data, response status code and response headers



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
318
319
320
321
322
323
324
325
# File 'lib/komoju-sdk/api/chargebacks_api.rb', line 271

def show_chargeback_request_with_http_info(id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ChargebacksApi.show_chargeback_request ...'
  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 ChargebacksApi.show_chargeback_request"
  end
  if @api_client.config.client_side_validation && id.to_s.length > 25
    fail ArgumentError, 'invalid value for "id" when calling ChargebacksApi.show_chargeback_request, the character length must be smaller than or equal to 25.'
  end

  if @api_client.config.client_side_validation && id.to_s.length < 25
    fail ArgumentError, 'invalid value for "id" when calling ChargebacksApi.show_chargeback_request, the character length must be greater than or equal to 25.'
  end

  # resource path
  local_var_path = '/chargeback_requests/{id}'.sub('{id}', CGI.escape(id.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

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

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

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['api_key']

  new_options = opts.merge(
    :operation => :"ChargebacksApi.show_chargeback_request",
    :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: ChargebacksApi#show_chargeback_request\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end