conekta 7.0.0 → 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 (42) 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/CheckoutOrderTemplate.md +2 -0
  7. data/docs/CheckoutRequest.md +3 -1
  8. data/docs/CheckoutResponse.md +2 -0
  9. data/docs/CompaniesApi.md +296 -0
  10. data/docs/CompanyDocumentRequest.md +26 -0
  11. data/docs/CompanyDocumentResponse.md +22 -0
  12. data/docs/CompanyResponse.md +18 -16
  13. data/docs/CompanyResponseDocumentsInner.md +22 -0
  14. data/docs/CreateCompanyRequest.md +26 -0
  15. data/docs/CreateCompanyRequestBankAccountInfo.md +18 -0
  16. data/docs/CreateCompanyRequestComercialInfo.md +24 -0
  17. data/docs/CreateCompanyRequestFiscalInfo.md +20 -0
  18. data/docs/PaymentMethodBnplRequest.md +1 -1
  19. data/docs/PaymentMethodSpeiRecurrent.md +2 -0
  20. data/examples/README.md +15 -0
  21. data/examples/one_time_charge_bnpl.rb +46 -0
  22. data/lib/conekta/api/companies_api.rb +300 -0
  23. data/lib/conekta/models/checkout_order_template.rb +13 -1
  24. data/lib/conekta/models/checkout_request.rb +36 -2
  25. data/lib/conekta/models/checkout_response.rb +13 -1
  26. data/lib/conekta/models/company_document_request.rb +318 -0
  27. data/lib/conekta/models/company_document_response.rb +291 -0
  28. data/lib/conekta/models/company_response.rb +110 -74
  29. data/lib/conekta/models/company_response_documents_inner.rb +270 -0
  30. data/lib/conekta/models/create_company_request.rb +252 -0
  31. data/lib/conekta/models/create_company_request_bank_account_info.rb +216 -0
  32. data/lib/conekta/models/create_company_request_comercial_info.rb +246 -0
  33. data/lib/conekta/models/create_company_request_fiscal_info.rb +226 -0
  34. data/lib/conekta/models/payment_method_bnpl_request.rb +2 -2
  35. data/lib/conekta/models/payment_method_spei_recurrent.rb +11 -1
  36. data/lib/conekta/version.rb +1 -1
  37. data/lib/conekta.rb +7 -3
  38. data/spec/api/companies_api_spec.rb +53 -0
  39. metadata +35 -22
  40. data/docs/CompanyFiscalInfoAddressResponse.md +0 -34
  41. data/docs/CompanyFiscalInfoResponse.md +0 -30
  42. data/docs/CompanyPayoutDestinationResponse.md +0 -28
@@ -0,0 +1,24 @@
1
+ # Conekta::CreateCompanyRequestComercialInfo
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **website** | **String** | The company's website URL. | [optional] |
8
+ | **mcc** | **String** | The Merchant Category Code (MCC) for the company. | [optional] |
9
+ | **merchant_support_email** | **String** | Email address for merchant support. | [optional] |
10
+ | **merchant_support_phone** | **String** | Phone number for merchant support. | [optional] |
11
+
12
+ ## Example
13
+
14
+ ```ruby
15
+ require 'conekta'
16
+
17
+ instance = Conekta::CreateCompanyRequestComercialInfo.new(
18
+ website: http://www.test.com,
19
+ mcc: 5812,
20
+ merchant_support_email: test@test.com,
21
+ merchant_support_phone: 5300000000
22
+ )
23
+ ```
24
+
@@ -0,0 +1,20 @@
1
+ # Conekta::CreateCompanyRequestFiscalInfo
2
+
3
+ ## Properties
4
+
5
+ | Name | Type | Description | Notes |
6
+ | ---- | ---- | ----------- | ----- |
7
+ | **business_phone** | **String** | The business phone number for fiscal purposes. | [optional] |
8
+ | **fiscal_type** | **String** | The fiscal type of the company (e.g., 'moral', 'persona_fisica'). | [optional] |
9
+
10
+ ## Example
11
+
12
+ ```ruby
13
+ require 'conekta'
14
+
15
+ instance = Conekta::CreateCompanyRequestFiscalInfo.new(
16
+ business_phone: 5300000000,
17
+ fiscal_type: moral
18
+ )
19
+ ```
20
+
@@ -21,7 +21,7 @@ instance = Conekta::PaymentMethodBnplRequest.new(
21
21
  cancel_url: https://example.com/cancel,
22
22
  can_not_expire: true,
23
23
  failure_url: https://example.com/failure,
24
- product_type: klarna_bnpl,
24
+ product_type: aplazo_bnpl,
25
25
  success_url: https://example.com/success
26
26
  )
27
27
  ```
@@ -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
@@ -24,6 +24,9 @@ module Conekta
24
24
  # They are the products to buy. Each contains the \"unit price\" and \"quantity\" parameters that are used to calculate the total amount of the order.
25
25
  attr_accessor :line_items
26
26
 
27
+ # It is a list of plan IDs that will be associated with the order.
28
+ attr_accessor :plan_ids
29
+
27
30
  # It is a set of key-value pairs that you can attach to the order. It can be used to store additional information about the order in a structured format.
28
31
  attr_accessor :metadata
29
32
 
@@ -33,6 +36,7 @@ module Conekta
33
36
  :'currency' => :'currency',
34
37
  :'customer_info' => :'customer_info',
35
38
  :'line_items' => :'line_items',
39
+ :'plan_ids' => :'plan_ids',
36
40
  :'metadata' => :'metadata'
37
41
  }
38
42
  end
@@ -48,6 +52,7 @@ module Conekta
48
52
  :'currency' => :'String',
49
53
  :'customer_info' => :'CheckoutOrderTemplateCustomerInfo',
50
54
  :'line_items' => :'Array<Product>',
55
+ :'plan_ids' => :'Array<String>',
51
56
  :'metadata' => :'Hash<String, Object>'
52
57
  }
53
58
  end
@@ -91,6 +96,12 @@ module Conekta
91
96
  self.line_items = nil
92
97
  end
93
98
 
99
+ if attributes.key?(:'plan_ids')
100
+ if (value = attributes[:'plan_ids']).is_a?(Array)
101
+ self.plan_ids = value
102
+ end
103
+ end
104
+
94
105
  if attributes.key?(:'metadata')
95
106
  if (value = attributes[:'metadata']).is_a?(Hash)
96
107
  self.metadata = value
@@ -169,6 +180,7 @@ module Conekta
169
180
  currency == o.currency &&
170
181
  customer_info == o.customer_info &&
171
182
  line_items == o.line_items &&
183
+ plan_ids == o.plan_ids &&
172
184
  metadata == o.metadata
173
185
  end
174
186
 
@@ -181,7 +193,7 @@ module Conekta
181
193
  # Calculates hash code according to all attributes.
182
194
  # @return [Integer] Hash code
183
195
  def hash
184
- [currency, customer_info, line_items, metadata].hash
196
+ [currency, customer_info, line_items, plan_ids, metadata].hash
185
197
  end
186
198
 
187
199
  # Builds the object from hash
@@ -16,9 +16,12 @@ require 'time'
16
16
  module Conekta
17
17
  # [Checkout](https://developers.conekta.com/v2.2.0/reference/payment-link) details
18
18
  class CheckoutRequest
19
- # Are the payment methods available for this link
19
+ # Are the payment methods available for this link. For subscriptions, only 'card' is allowed due to the recurring nature of the payments.
20
20
  attr_accessor :allowed_payment_methods
21
21
 
22
+ # List of plan IDs that will be available for subscription. This field is required for subscription payments.
23
+ attr_accessor :plan_ids
24
+
22
25
  # Unix timestamp of checkout expiration
23
26
  attr_accessor :expires_at
24
27
 
@@ -46,10 +49,33 @@ module Conekta
46
49
  # This field represents the type of checkout
47
50
  attr_accessor :type
48
51
 
52
+ class EnumAttributeValidator
53
+ attr_reader :datatype
54
+ attr_reader :allowable_values
55
+
56
+ def initialize(datatype, allowable_values)
57
+ @allowable_values = allowable_values.map do |value|
58
+ case datatype.to_s
59
+ when /Integer/i
60
+ value.to_i
61
+ when /Float/i
62
+ value.to_f
63
+ else
64
+ value
65
+ end
66
+ end
67
+ end
68
+
69
+ def valid?(value)
70
+ !value || allowable_values.include?(value)
71
+ end
72
+ end
73
+
49
74
  # Attribute mapping from ruby-style variable name to JSON key.
50
75
  def self.attribute_map
51
76
  {
52
77
  :'allowed_payment_methods' => :'allowed_payment_methods',
78
+ :'plan_ids' => :'plan_ids',
53
79
  :'expires_at' => :'expires_at',
54
80
  :'failure_url' => :'failure_url',
55
81
  :'monthly_installments_enabled' => :'monthly_installments_enabled',
@@ -72,6 +98,7 @@ module Conekta
72
98
  def self.openapi_types
73
99
  {
74
100
  :'allowed_payment_methods' => :'Array<String>',
101
+ :'plan_ids' => :'Array<String>',
75
102
  :'expires_at' => :'Integer',
76
103
  :'failure_url' => :'String',
77
104
  :'monthly_installments_enabled' => :'Boolean',
@@ -114,6 +141,12 @@ module Conekta
114
141
  self.allowed_payment_methods = nil
115
142
  end
116
143
 
144
+ if attributes.key?(:'plan_ids')
145
+ if (value = attributes[:'plan_ids']).is_a?(Array)
146
+ self.plan_ids = value
147
+ end
148
+ end
149
+
117
150
  if attributes.key?(:'expires_at')
118
151
  self.expires_at = attributes[:'expires_at']
119
152
  end
@@ -183,6 +216,7 @@ module Conekta
183
216
  return true if self.equal?(o)
184
217
  self.class == o.class &&
185
218
  allowed_payment_methods == o.allowed_payment_methods &&
219
+ plan_ids == o.plan_ids &&
186
220
  expires_at == o.expires_at &&
187
221
  failure_url == o.failure_url &&
188
222
  monthly_installments_enabled == o.monthly_installments_enabled &&
@@ -204,7 +238,7 @@ module Conekta
204
238
  # Calculates hash code according to all attributes.
205
239
  # @return [Integer] Hash code
206
240
  def hash
207
- [allowed_payment_methods, expires_at, failure_url, monthly_installments_enabled, monthly_installments_options, max_failed_retries, name, on_demand_enabled, redirection_time, success_url, type].hash
241
+ [allowed_payment_methods, plan_ids, expires_at, failure_url, monthly_installments_enabled, monthly_installments_options, max_failed_retries, name, on_demand_enabled, redirection_time, success_url, type].hash
208
242
  end
209
243
 
210
244
  # Builds the object from hash
@@ -19,6 +19,9 @@ module Conekta
19
19
  # Are the payment methods available for this link
20
20
  attr_accessor :allowed_payment_methods
21
21
 
22
+ # List of plan IDs that are available for subscription
23
+ attr_accessor :plan_ids
24
+
22
25
  attr_accessor :can_not_expire
23
26
 
24
27
  attr_accessor :emails_sent
@@ -72,6 +75,7 @@ module Conekta
72
75
  def self.attribute_map
73
76
  {
74
77
  :'allowed_payment_methods' => :'allowed_payment_methods',
78
+ :'plan_ids' => :'plan_ids',
75
79
  :'can_not_expire' => :'can_not_expire',
76
80
  :'emails_sent' => :'emails_sent',
77
81
  :'exclude_card_networks' => :'exclude_card_networks',
@@ -108,6 +112,7 @@ module Conekta
108
112
  def self.openapi_types
109
113
  {
110
114
  :'allowed_payment_methods' => :'Array<String>',
115
+ :'plan_ids' => :'Array<String>',
111
116
  :'can_not_expire' => :'Boolean',
112
117
  :'emails_sent' => :'Integer',
113
118
  :'exclude_card_networks' => :'Array<Object>',
@@ -163,6 +168,12 @@ module Conekta
163
168
  end
164
169
  end
165
170
 
171
+ if attributes.key?(:'plan_ids')
172
+ if (value = attributes[:'plan_ids']).is_a?(Array)
173
+ self.plan_ids = value
174
+ end
175
+ end
176
+
166
177
  if attributes.key?(:'can_not_expire')
167
178
  self.can_not_expire = attributes[:'can_not_expire']
168
179
  end
@@ -315,6 +326,7 @@ module Conekta
315
326
  return true if self.equal?(o)
316
327
  self.class == o.class &&
317
328
  allowed_payment_methods == o.allowed_payment_methods &&
329
+ plan_ids == o.plan_ids &&
318
330
  can_not_expire == o.can_not_expire &&
319
331
  emails_sent == o.emails_sent &&
320
332
  exclude_card_networks == o.exclude_card_networks &&
@@ -350,7 +362,7 @@ module Conekta
350
362
  # Calculates hash code according to all attributes.
351
363
  # @return [Integer] Hash code
352
364
  def hash
353
- [allowed_payment_methods, can_not_expire, emails_sent, exclude_card_networks, expires_at, failure_url, force_3ds_flow, id, livemode, metadata, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, object, paid_payments_count, payments_limit_count, recurrent, slug, sms_sent, starts_at, status, success_url, type, url].hash
365
+ [allowed_payment_methods, plan_ids, can_not_expire, emails_sent, exclude_card_networks, expires_at, failure_url, force_3ds_flow, id, livemode, metadata, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, object, paid_payments_count, payments_limit_count, recurrent, slug, sms_sent, starts_at, status, success_url, type, url].hash
354
366
  end
355
367
 
356
368
  # Builds the object from hash