Class: Billabear::PaymentsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/billabear/api/payments_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PaymentsApi

Returns a new instance of PaymentsApi.



16
17
18
# File 'lib/billabear/api/payments_api.rb', line 16

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/billabear/api/payments_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#charge_invoice(invoice_id, opts = {}) ⇒ InlineResponse20014

Charge Invoice Attempts to charge a card that is on file for the invoice amount

Parameters:

  • invoice_id

    The id of the invoice

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

    the optional parameters

Returns:



24
25
26
27
# File 'lib/billabear/api/payments_api.rb', line 24

def charge_invoice(invoice_id, opts = {})
  data, _status_code, _headers = charge_invoice_with_http_info(invoice_id, opts)
  data
end

#charge_invoice_with_http_info(invoice_id, opts = {}) ⇒ Array<(InlineResponse20014, Integer, Hash)>

Charge Invoice Attempts to charge a card that is on file for the invoice amount

Parameters:

  • invoice_id

    The id of the invoice

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

    the optional parameters

Returns:

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

    InlineResponse20014 data, response status code and response headers



34
35
36
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
# File 'lib/billabear/api/payments_api.rb', line 34

def charge_invoice_with_http_info(invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentsApi.charge_invoice ...'
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling PaymentsApi.charge_invoice"
  end
  # resource path
  local_var_path = '/invoice/{invoiceId}/charge'.sub('{' + 'invoiceId' + '}', invoice_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'])

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

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

  return_type = opts[:return_type] || 'InlineResponse20014' 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentsApi#charge_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_invoice(invoice_id, opts = {}) ⇒ String

Download Invoice Returns the pdf blob for the invoice

Parameters:

  • invoice_id

    The id of the invoice

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

    the optional parameters

Returns:

  • (String)


80
81
82
83
# File 'lib/billabear/api/payments_api.rb', line 80

def download_invoice(invoice_id, opts = {})
  data, _status_code, _headers = download_invoice_with_http_info(invoice_id, opts)
  data
end

#download_invoice_with_http_info(invoice_id, opts = {}) ⇒ Array<(String, Integer, Hash)>

Download Invoice Returns the pdf blob for the invoice

Parameters:

  • invoice_id

    The id of the invoice

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/billabear/api/payments_api.rb', line 90

def download_invoice_with_http_info(invoice_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentsApi.download_invoice ...'
  end
  # verify the required parameter 'invoice_id' is set
  if @api_client.config.client_side_validation && invoice_id.nil?
    fail ArgumentError, "Missing the required parameter 'invoice_id' when calling PaymentsApi.download_invoice"
  end
  # resource path
  local_var_path = '/invoice/{invoiceId}/download'.sub('{' + 'invoiceId' + '}', invoice_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/pdf'])

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

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

  return_type = opts[:return_type] || 'String' 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentsApi#download_invoice\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#download_receipt(receipt, opts = {}) ⇒ String

Download Receipt Returns the pdf blob for the Receipt

Parameters:

  • receipt

    The id of the receipt

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

    the optional parameters

Returns:

  • (String)


136
137
138
139
# File 'lib/billabear/api/payments_api.rb', line 136

def download_receipt(receipt, opts = {})
  data, _status_code, _headers = download_receipt_with_http_info(receipt, opts)
  data
end

#download_receipt_with_http_info(receipt, opts = {}) ⇒ Array<(String, Integer, Hash)>

Download Receipt Returns the pdf blob for the Receipt

Parameters:

  • receipt

    The id of the receipt

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

    the optional parameters

Returns:

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

    String data, response status code and response headers



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
# File 'lib/billabear/api/payments_api.rb', line 146

def download_receipt_with_http_info(receipt, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentsApi.download_receipt ...'
  end
  # verify the required parameter 'receipt' is set
  if @api_client.config.client_side_validation && receipt.nil?
    fail ArgumentError, "Missing the required parameter 'receipt' when calling PaymentsApi.download_receipt"
  end
  # resource path
  local_var_path = '/receipt/{receiptId}/download'.sub('{' + 'receipt' + '}', receipt.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/pdf'])

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

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

  return_type = opts[:return_type] || 'String' 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentsApi#download_receipt\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_invoices_for_customer(customer_id, opts = {}) ⇒ InlineResponse2006

List Customer Invoices List Customer Invoices

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:



192
193
194
195
# File 'lib/billabear/api/payments_api.rb', line 192

def get_invoices_for_customer(customer_id, opts = {})
  data, _status_code, _headers = get_invoices_for_customer_with_http_info(customer_id, opts)
  data
end

#get_invoices_for_customer_with_http_info(customer_id, opts = {}) ⇒ Array<(InlineResponse2006, Integer, Hash)>

List Customer Invoices List Customer Invoices

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Returns:

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

    InlineResponse2006 data, response status code and response headers



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
# File 'lib/billabear/api/payments_api.rb', line 202

def get_invoices_for_customer_with_http_info(customer_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentsApi.get_invoices_for_customer ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling PaymentsApi.get_invoices_for_customer"
  end
  # resource path
  local_var_path = '/customer/{customerId}/invoices'.sub('{' + 'customerId' + '}', customer_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'])

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

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

  return_type = opts[:return_type] || 'InlineResponse2006' 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentsApi#get_invoices_for_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_payments_for_customer(customer_id, opts = {}) ⇒ InlineResponse2004

List Customer Payments List Customer Payment

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many items to return at one time (max 100)

  • :last_key (String)

    The key to be used in pagination to say what the last key of the previous page was

  • :name (String)

    The name to search for

Returns:



251
252
253
254
# File 'lib/billabear/api/payments_api.rb', line 251

def get_payments_for_customer(customer_id, opts = {})
  data, _status_code, _headers = get_payments_for_customer_with_http_info(customer_id, opts)
  data
end

#get_payments_for_customer_with_http_info(customer_id, opts = {}) ⇒ Array<(InlineResponse2004, Integer, Hash)>

List Customer Payments List Customer Payment

Parameters:

  • customer_id

    The id of the customer to retrieve

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many items to return at one time (max 100)

  • :last_key (String)

    The key to be used in pagination to say what the last key of the previous page was

  • :name (String)

    The name to search for

Returns:

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

    InlineResponse2004 data, response status code and response headers



264
265
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
# File 'lib/billabear/api/payments_api.rb', line 264

def get_payments_for_customer_with_http_info(customer_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentsApi.get_payments_for_customer ...'
  end
  # verify the required parameter 'customer_id' is set
  if @api_client.config.client_side_validation && customer_id.nil?
    fail ArgumentError, "Missing the required parameter 'customer_id' when calling PaymentsApi.get_payments_for_customer"
  end
  # resource path
  local_var_path = '/customer/{customerId}/payment'.sub('{' + 'customerId' + '}', customer_id.to_s)

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'last_key'] = opts[:'last_key'] if !opts[:'last_key'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?

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

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

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

  return_type = opts[:return_type] || 'InlineResponse2004' 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentsApi#get_payments_for_customer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#list_payment(opts = {}) ⇒ InlineResponse2009

List List all payment

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many items to return at one time (max 100)

  • :last_key (String)

    The key to be used in pagination to say what the last key of the previous page was

  • :name (String)

    The name to search for

Returns:



315
316
317
318
# File 'lib/billabear/api/payments_api.rb', line 315

def list_payment(opts = {})
  data, _status_code, _headers = list_payment_with_http_info(opts)
  data
end

#list_payment_with_http_info(opts = {}) ⇒ Array<(InlineResponse2009, Integer, Hash)>

List List all payment

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :limit (Integer)

    How many items to return at one time (max 100)

  • :last_key (String)

    The key to be used in pagination to say what the last key of the previous page was

  • :name (String)

    The name to search for

Returns:

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

    InlineResponse2009 data, response status code and response headers



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
356
357
358
359
360
361
362
363
364
365
366
# File 'lib/billabear/api/payments_api.rb', line 327

def list_payment_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentsApi.list_payment ...'
  end
  # resource path
  local_var_path = '/payment'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
  query_params[:'last_key'] = opts[:'last_key'] if !opts[:'last_key'].nil?
  query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?

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

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

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

  return_type = opts[:return_type] || 'InlineResponse2009' 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentsApi#list_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#refund_payment(body, payment_id, opts = {}) ⇒ nil

Refund Payment Issue a refund for payment

Parameters:

  • body
  • payment_id

    The id of the payment

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

    the optional parameters

Returns:

  • (nil)


373
374
375
376
# File 'lib/billabear/api/payments_api.rb', line 373

def refund_payment(body, payment_id, opts = {})
  refund_payment_with_http_info(body, payment_id, opts)
  nil
end

#refund_payment_with_http_info(body, payment_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Refund Payment Issue a refund for payment

Parameters:

  • body
  • payment_id

    The id of the payment

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
# File 'lib/billabear/api/payments_api.rb', line 384

def refund_payment_with_http_info(body, payment_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentsApi.refund_payment ...'
  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 PaymentsApi.refund_payment"
  end
  # verify the required parameter 'payment_id' is set
  if @api_client.config.client_side_validation && payment_id.nil?
    fail ArgumentError, "Missing the required parameter 'payment_id' when calling PaymentsApi.refund_payment"
  end
  # resource path
  local_var_path = '/payment/{paymentId}/refund'.sub('{' + 'paymentId' + '}', payment_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'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

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

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(body) 

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['ApiKeyAuth']
  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 => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentsApi#refund_payment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end