conekta 7.0.1 → 7.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -8
  3. data/VERSION +1 -1
  4. data/config-ruby.json +1 -1
  5. data/docs/ChargesApi.md +2 -2
  6. data/docs/CheckoutRequest.md +1 -1
  7. data/docs/CompaniesApi.md +296 -0
  8. data/docs/CompanyDocumentRequest.md +26 -0
  9. data/docs/CompanyDocumentResponse.md +22 -0
  10. data/docs/CompanyResponse.md +18 -16
  11. data/docs/CompanyResponseDocumentsInner.md +22 -0
  12. data/docs/CreateCompanyRequest.md +26 -0
  13. data/docs/CreateCompanyRequestBankAccountInfo.md +18 -0
  14. data/docs/CreateCompanyRequestComercialInfo.md +24 -0
  15. data/docs/CreateCompanyRequestFiscalInfo.md +20 -0
  16. data/docs/PaymentMethodBnplRequest.md +1 -1
  17. data/docs/PaymentMethodSpeiRecurrent.md +2 -0
  18. data/examples/README.md +15 -0
  19. data/examples/one_time_charge_bnpl.rb +46 -0
  20. data/lib/conekta/api/companies_api.rb +300 -0
  21. data/lib/conekta/models/company_document_request.rb +318 -0
  22. data/lib/conekta/models/company_document_response.rb +291 -0
  23. data/lib/conekta/models/company_response.rb +110 -74
  24. data/lib/conekta/models/company_response_documents_inner.rb +270 -0
  25. data/lib/conekta/models/create_company_request.rb +252 -0
  26. data/lib/conekta/models/create_company_request_bank_account_info.rb +216 -0
  27. data/lib/conekta/models/create_company_request_comercial_info.rb +246 -0
  28. data/lib/conekta/models/create_company_request_fiscal_info.rb +226 -0
  29. data/lib/conekta/models/payment_method_bnpl_request.rb +2 -2
  30. data/lib/conekta/models/payment_method_spei_recurrent.rb +11 -1
  31. data/lib/conekta/version.rb +1 -1
  32. data/lib/conekta.rb +7 -3
  33. data/spec/api/companies_api_spec.rb +53 -0
  34. metadata +35 -22
  35. data/docs/CompanyFiscalInfoAddressResponse.md +0 -34
  36. data/docs/CompanyFiscalInfoResponse.md +0 -30
  37. data/docs/CompanyPayoutDestinationResponse.md +0 -28
@@ -9,6 +9,7 @@
9
9
  | **object** | **String** | | |
10
10
  | **created_at** | **Integer** | | |
11
11
  | **parent_id** | **String** | | [optional] |
12
+ | **bank** | **String** | Bank name for the SPEI payment method | [optional] |
12
13
  | **reference** | **String** | | [optional] |
13
14
  | **expires_at** | **String** | | [optional] |
14
15
 
@@ -23,6 +24,7 @@ instance = Conekta::PaymentMethodSpeiRecurrent.new(
23
24
  object: payment_source,
24
25
  created_at: 1675715413,
25
26
  parent_id: cus_2s8K1B3PBKDontpi8,
27
+ bank: STP,
26
28
  reference: 93000262276908,
27
29
  expires_at: none
28
30
  )
@@ -0,0 +1,15 @@
1
+ ## Running an example
2
+
3
+ From the examples folder, run:
4
+ `RUBYLIB=../lib ruby your_example.rb`
5
+
6
+ e.g.
7
+
8
+ `RUBYLIB=../lib ruby example.rb`
9
+
10
+ ## Adding a new example
11
+
12
+ 1. Implement your example
13
+ 2. Fill out the file comment. Include a description and key steps that are being demonstrated.
14
+ 3. Run it (as per above)
15
+ 4. 👍
@@ -0,0 +1,46 @@
1
+ # Load the gem
2
+ require 'conekta'
3
+ class OneTimeChargeBnpl
4
+ Conekta.configure do |config|
5
+ config.access_token = ENV['CONEKTA_API_KEY']
6
+ end
7
+
8
+ api_instance = Conekta::OrdersApi.new
9
+ order_request = Conekta::OrderRequest.new(
10
+ :currency => 'MXN',
11
+ :line_items => [
12
+ {
13
+ :name => 'Box of Cohiba S1s',
14
+ :unit_price => 35000,
15
+ :quantity => 1
16
+ }
17
+ ],
18
+ :customer_info => {
19
+ :name => 'Mario Hernandez',
20
+ :email => 'mm@gmail.com',
21
+ :phone => '5555555555'
22
+ },
23
+ :charges => [
24
+ {
25
+ :payment_method => Conekta::PaymentMethodBnplRequest.new(
26
+ :expires_at => Time.now.advance(days: 30).to_i,
27
+ :product_type => 'creditea_bnpl',
28
+ :type => 'bnpl',
29
+ :success_url => 'https://www.example.com/success',
30
+ :failure_url => 'https://www.example.com/failure',
31
+ :cancel_url => 'https://www.example.com/cancel'
32
+ )
33
+ }
34
+ ]
35
+ )
36
+ opts = {
37
+ accept_language: 'es' # String | Use for knowing which language to use
38
+ }
39
+
40
+ begin
41
+ result = api_instance.create_order(order_request, opts)
42
+ p result
43
+ rescue Conekta::ApiError => e
44
+ puts "Exception when calling create order #{e}"
45
+ end
46
+ end
@@ -19,6 +19,74 @@ module Conekta
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
+ # Create Company
23
+ # Create a new company.
24
+ # @param create_company_request [CreateCompanyRequest] Company data
25
+ # @param [Hash] opts the optional parameters
26
+ # @return [CompanyResponse]
27
+ def create_company(create_company_request, opts = {})
28
+ data, _status_code, _headers = create_company_with_http_info(create_company_request, opts)
29
+ data
30
+ end
31
+
32
+ # Create Company
33
+ # Create a new company.
34
+ # @param create_company_request [CreateCompanyRequest] Company data
35
+ # @param [Hash] opts the optional parameters
36
+ # @return [Array<(CompanyResponse, Integer, Hash)>] CompanyResponse data, response status code and response headers
37
+ def create_company_with_http_info(create_company_request, opts = {})
38
+ if @api_client.config.debugging
39
+ @api_client.config.logger.debug 'Calling API: CompaniesApi.create_company ...'
40
+ end
41
+ # verify the required parameter 'create_company_request' is set
42
+ if @api_client.config.client_side_validation && create_company_request.nil?
43
+ fail ArgumentError, "Missing the required parameter 'create_company_request' when calling CompaniesApi.create_company"
44
+ end
45
+ # resource path
46
+ local_var_path = '/companies'
47
+
48
+ # query parameters
49
+ query_params = opts[:query_params] || {}
50
+
51
+ # header parameters
52
+ header_params = opts[:header_params] || {}
53
+ # HTTP header 'Accept' (if needed)
54
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.2.0+json'])
55
+ # HTTP header 'Content-Type'
56
+ content_type = @api_client.select_header_content_type(['application/json'])
57
+ if !content_type.nil?
58
+ header_params['Content-Type'] = content_type
59
+ end
60
+
61
+ # form parameters
62
+ form_params = opts[:form_params] || {}
63
+
64
+ # http body (model)
65
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_company_request)
66
+
67
+ # return_type
68
+ return_type = opts[:debug_return_type] || 'CompanyResponse'
69
+
70
+ # auth_names
71
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
72
+
73
+ new_options = opts.merge(
74
+ :operation => :"CompaniesApi.create_company",
75
+ :header_params => header_params,
76
+ :query_params => query_params,
77
+ :form_params => form_params,
78
+ :body => post_body,
79
+ :auth_names => auth_names,
80
+ :return_type => return_type
81
+ )
82
+
83
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
84
+ if @api_client.config.debugging
85
+ @api_client.config.logger.debug "API called: CompaniesApi#create_company\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
86
+ end
87
+ return data, status_code, headers
88
+ end
89
+
22
90
  # Get List of Companies
23
91
  # Consume the list of child companies. This is used for holding companies with several child entities.
24
92
  # @param [Hash] opts the optional parameters
@@ -170,5 +238,237 @@ module Conekta
170
238
  end
171
239
  return data, status_code, headers
172
240
  end
241
+
242
+ # Get Company Documents
243
+ # Retrieve a list of documents associated with a specific company.
244
+ # @param company_id [String] The unique identifier of the company.
245
+ # @param [Hash] opts the optional parameters
246
+ # @option opts [String] :accept_language Use for knowing which language to use (default to 'es')
247
+ # @return [Array<CompanyDocumentResponse>]
248
+ def get_company_documents(company_id, opts = {})
249
+ data, _status_code, _headers = get_company_documents_with_http_info(company_id, opts)
250
+ data
251
+ end
252
+
253
+ # Get Company Documents
254
+ # Retrieve a list of documents associated with a specific company.
255
+ # @param company_id [String] The unique identifier of the company.
256
+ # @param [Hash] opts the optional parameters
257
+ # @option opts [String] :accept_language Use for knowing which language to use (default to 'es')
258
+ # @return [Array<(Array<CompanyDocumentResponse>, Integer, Hash)>] Array<CompanyDocumentResponse> data, response status code and response headers
259
+ def get_company_documents_with_http_info(company_id, opts = {})
260
+ if @api_client.config.debugging
261
+ @api_client.config.logger.debug 'Calling API: CompaniesApi.get_company_documents ...'
262
+ end
263
+ # verify the required parameter 'company_id' is set
264
+ if @api_client.config.client_side_validation && company_id.nil?
265
+ fail ArgumentError, "Missing the required parameter 'company_id' when calling CompaniesApi.get_company_documents"
266
+ end
267
+ allowable_values = ["es", "en"]
268
+ if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
269
+ fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
270
+ end
271
+ # resource path
272
+ local_var_path = '/companies/{company_id}/documents'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s))
273
+
274
+ # query parameters
275
+ query_params = opts[:query_params] || {}
276
+
277
+ # header parameters
278
+ header_params = opts[:header_params] || {}
279
+ # HTTP header 'Accept' (if needed)
280
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.2.0+json'])
281
+ header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
282
+
283
+ # form parameters
284
+ form_params = opts[:form_params] || {}
285
+
286
+ # http body (model)
287
+ post_body = opts[:debug_body]
288
+
289
+ # return_type
290
+ return_type = opts[:debug_return_type] || 'Array<CompanyDocumentResponse>'
291
+
292
+ # auth_names
293
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
294
+
295
+ new_options = opts.merge(
296
+ :operation => :"CompaniesApi.get_company_documents",
297
+ :header_params => header_params,
298
+ :query_params => query_params,
299
+ :form_params => form_params,
300
+ :body => post_body,
301
+ :auth_names => auth_names,
302
+ :return_type => return_type
303
+ )
304
+
305
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
306
+ if @api_client.config.debugging
307
+ @api_client.config.logger.debug "API called: CompaniesApi#get_company_documents\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
308
+ end
309
+ return data, status_code, headers
310
+ end
311
+
312
+ # Update Company Document
313
+ # Updates an existing document associated with a specific company.
314
+ # @param company_id [String] The unique identifier of the company.
315
+ # @param company_document_request [CompanyDocumentRequest] Document information to update.
316
+ # @param [Hash] opts the optional parameters
317
+ # @option opts [String] :accept_language Use for knowing which language to use (default to 'es')
318
+ # @return [CompanyDocumentResponse]
319
+ def update_company_document(company_id, company_document_request, opts = {})
320
+ data, _status_code, _headers = update_company_document_with_http_info(company_id, company_document_request, opts)
321
+ data
322
+ end
323
+
324
+ # Update Company Document
325
+ # Updates an existing document associated with a specific company.
326
+ # @param company_id [String] The unique identifier of the company.
327
+ # @param company_document_request [CompanyDocumentRequest] Document information to update.
328
+ # @param [Hash] opts the optional parameters
329
+ # @option opts [String] :accept_language Use for knowing which language to use (default to 'es')
330
+ # @return [Array<(CompanyDocumentResponse, Integer, Hash)>] CompanyDocumentResponse data, response status code and response headers
331
+ def update_company_document_with_http_info(company_id, company_document_request, opts = {})
332
+ if @api_client.config.debugging
333
+ @api_client.config.logger.debug 'Calling API: CompaniesApi.update_company_document ...'
334
+ end
335
+ # verify the required parameter 'company_id' is set
336
+ if @api_client.config.client_side_validation && company_id.nil?
337
+ fail ArgumentError, "Missing the required parameter 'company_id' when calling CompaniesApi.update_company_document"
338
+ end
339
+ # verify the required parameter 'company_document_request' is set
340
+ if @api_client.config.client_side_validation && company_document_request.nil?
341
+ fail ArgumentError, "Missing the required parameter 'company_document_request' when calling CompaniesApi.update_company_document"
342
+ end
343
+ allowable_values = ["es", "en"]
344
+ if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
345
+ fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
346
+ end
347
+ # resource path
348
+ local_var_path = '/companies/{company_id}/document'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s))
349
+
350
+ # query parameters
351
+ query_params = opts[:query_params] || {}
352
+
353
+ # header parameters
354
+ header_params = opts[:header_params] || {}
355
+ # HTTP header 'Accept' (if needed)
356
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.2.0+json'])
357
+ # HTTP header 'Content-Type'
358
+ content_type = @api_client.select_header_content_type(['application/json'])
359
+ if !content_type.nil?
360
+ header_params['Content-Type'] = content_type
361
+ end
362
+ header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
363
+
364
+ # form parameters
365
+ form_params = opts[:form_params] || {}
366
+
367
+ # http body (model)
368
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(company_document_request)
369
+
370
+ # return_type
371
+ return_type = opts[:debug_return_type] || 'CompanyDocumentResponse'
372
+
373
+ # auth_names
374
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
375
+
376
+ new_options = opts.merge(
377
+ :operation => :"CompaniesApi.update_company_document",
378
+ :header_params => header_params,
379
+ :query_params => query_params,
380
+ :form_params => form_params,
381
+ :body => post_body,
382
+ :auth_names => auth_names,
383
+ :return_type => return_type
384
+ )
385
+
386
+ data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)
387
+ if @api_client.config.debugging
388
+ @api_client.config.logger.debug "API called: CompaniesApi#update_company_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
389
+ end
390
+ return data, status_code, headers
391
+ end
392
+
393
+ # Upload Company Document
394
+ # Uploads a document associated with a specific company.
395
+ # @param company_id [String] The unique identifier of the company.
396
+ # @param company_document_request [CompanyDocumentRequest] Document information to upload.
397
+ # @param [Hash] opts the optional parameters
398
+ # @option opts [String] :accept_language Use for knowing which language to use (default to 'es')
399
+ # @return [CompanyDocumentResponse]
400
+ def upload_company_document(company_id, company_document_request, opts = {})
401
+ data, _status_code, _headers = upload_company_document_with_http_info(company_id, company_document_request, opts)
402
+ data
403
+ end
404
+
405
+ # Upload Company Document
406
+ # Uploads a document associated with a specific company.
407
+ # @param company_id [String] The unique identifier of the company.
408
+ # @param company_document_request [CompanyDocumentRequest] Document information to upload.
409
+ # @param [Hash] opts the optional parameters
410
+ # @option opts [String] :accept_language Use for knowing which language to use (default to 'es')
411
+ # @return [Array<(CompanyDocumentResponse, Integer, Hash)>] CompanyDocumentResponse data, response status code and response headers
412
+ def upload_company_document_with_http_info(company_id, company_document_request, opts = {})
413
+ if @api_client.config.debugging
414
+ @api_client.config.logger.debug 'Calling API: CompaniesApi.upload_company_document ...'
415
+ end
416
+ # verify the required parameter 'company_id' is set
417
+ if @api_client.config.client_side_validation && company_id.nil?
418
+ fail ArgumentError, "Missing the required parameter 'company_id' when calling CompaniesApi.upload_company_document"
419
+ end
420
+ # verify the required parameter 'company_document_request' is set
421
+ if @api_client.config.client_side_validation && company_document_request.nil?
422
+ fail ArgumentError, "Missing the required parameter 'company_document_request' when calling CompaniesApi.upload_company_document"
423
+ end
424
+ allowable_values = ["es", "en"]
425
+ if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language'])
426
+ fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}"
427
+ end
428
+ # resource path
429
+ local_var_path = '/companies/{company_id}/document'.sub('{' + 'company_id' + '}', CGI.escape(company_id.to_s))
430
+
431
+ # query parameters
432
+ query_params = opts[:query_params] || {}
433
+
434
+ # header parameters
435
+ header_params = opts[:header_params] || {}
436
+ # HTTP header 'Accept' (if needed)
437
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.conekta-v2.2.0+json'])
438
+ # HTTP header 'Content-Type'
439
+ content_type = @api_client.select_header_content_type(['application/json'])
440
+ if !content_type.nil?
441
+ header_params['Content-Type'] = content_type
442
+ end
443
+ header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil?
444
+
445
+ # form parameters
446
+ form_params = opts[:form_params] || {}
447
+
448
+ # http body (model)
449
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(company_document_request)
450
+
451
+ # return_type
452
+ return_type = opts[:debug_return_type] || 'CompanyDocumentResponse'
453
+
454
+ # auth_names
455
+ auth_names = opts[:debug_auth_names] || ['bearerAuth']
456
+
457
+ new_options = opts.merge(
458
+ :operation => :"CompaniesApi.upload_company_document",
459
+ :header_params => header_params,
460
+ :query_params => query_params,
461
+ :form_params => form_params,
462
+ :body => post_body,
463
+ :auth_names => auth_names,
464
+ :return_type => return_type
465
+ )
466
+
467
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
468
+ if @api_client.config.debugging
469
+ @api_client.config.logger.debug "API called: CompaniesApi#upload_company_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
470
+ end
471
+ return data, status_code, headers
472
+ end
173
473
  end
174
474
  end