diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0243b23..d7f3e7e 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -33,6 +33,8 @@ docs/ChargeResponseRefundsData.md docs/ChargeUpdateRequest.md docs/ChargesApi.md docs/ChargesDataResponse.md +docs/ChargesOrderResponse.md +docs/ChargesOrderResponseAllOfData.md docs/Checkout.md docs/CheckoutOrderTemplate.md docs/CheckoutOrderTemplateCustomerInfo.md @@ -256,6 +258,8 @@ lib/conekta/models/charge_response_refunds.rb lib/conekta/models/charge_response_refunds_data.rb lib/conekta/models/charge_update_request.rb lib/conekta/models/charges_data_response.rb +lib/conekta/models/charges_order_response.rb +lib/conekta/models/charges_order_response_all_of_data.rb lib/conekta/models/checkout.rb lib/conekta/models/checkout_order_template.rb lib/conekta/models/checkout_order_template_customer_info.rb diff --git a/README.md b/README.md index 63aa096..1dab56c 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This SDK is automatically generated by the [OpenAPI Generator](https://openapi-g - API version: 2.1.0 - Package version: 6.0.4 -- Build date: 2024-10-11T14:29:25.812959596Z[Etc/UTC] +- Build date: 2024-12-17T02:22:54.643378180Z[Etc/UTC] - Generator version: 7.5.0 - Build package: org.openapitools.codegen.languages.RubyClientCodegen For more information, please visit [https://github.com/conekta/openapi/issues](https://github.com/conekta/openapi/issues) @@ -105,6 +105,7 @@ Class | Method | HTTP request | Description *Conekta::BalancesApi* | [**get_balance**](docs/BalancesApi.md#get_balance) | **GET** /balance | Get a company's balance *Conekta::ChargesApi* | [**get_charges**](docs/ChargesApi.md#get_charges) | **GET** /charges | Get A List of Charges *Conekta::ChargesApi* | [**orders_create_charge**](docs/ChargesApi.md#orders_create_charge) | **POST** /orders/{id}/charges | Create charge +*Conekta::ChargesApi* | [**orders_create_charges**](docs/ChargesApi.md#orders_create_charges) | **POST** /orders/{id}/add_charges | Create charges *Conekta::ChargesApi* | [**update_charge**](docs/ChargesApi.md#update_charge) | **PUT** /charges/{id} | Update a charge *Conekta::CompaniesApi* | [**get_companies**](docs/CompaniesApi.md#get_companies) | **GET** /companies | Get List of Companies *Conekta::CompaniesApi* | [**get_company**](docs/CompaniesApi.md#get_company) | **GET** /companies/{id} | Get Company @@ -143,6 +144,7 @@ Class | Method | HTTP request | Description *Conekta::PaymentMethodsApi* | [**delete_customer_payment_methods**](docs/PaymentMethodsApi.md#delete_customer_payment_methods) | **DELETE** /customers/{id}/payment_sources/{payment_method_id} | Delete Payment Method *Conekta::PaymentMethodsApi* | [**get_customer_payment_methods**](docs/PaymentMethodsApi.md#get_customer_payment_methods) | **GET** /customers/{id}/payment_sources | Get Payment Methods *Conekta::PaymentMethodsApi* | [**update_customer_payment_methods**](docs/PaymentMethodsApi.md#update_customer_payment_methods) | **PUT** /customers/{id}/payment_sources/{payment_method_id} | Update Payment Method +*Conekta::PayoutOrdersApi* | [**cancel_payout_order_by_id**](docs/PayoutOrdersApi.md#cancel_payout_order_by_id) | **PUT** /payout_orders/{id}/cancel | Cancel Payout Order *Conekta::PayoutOrdersApi* | [**create_payout_order**](docs/PayoutOrdersApi.md#create_payout_order) | **POST** /payout_orders | Create payout order *Conekta::PayoutOrdersApi* | [**get_payout_order_by_id**](docs/PayoutOrdersApi.md#get_payout_order_by_id) | **GET** /payout_orders/{id} | Get Payout Order *Conekta::PayoutOrdersApi* | [**get_payout_orders**](docs/PayoutOrdersApi.md#get_payout_orders) | **GET** /payout_orders | Get a list of Payout Orders @@ -209,6 +211,8 @@ Class | Method | HTTP request | Description - [Conekta::ChargeResponseRefundsData](docs/ChargeResponseRefundsData.md) - [Conekta::ChargeUpdateRequest](docs/ChargeUpdateRequest.md) - [Conekta::ChargesDataResponse](docs/ChargesDataResponse.md) + - [Conekta::ChargesOrderResponse](docs/ChargesOrderResponse.md) + - [Conekta::ChargesOrderResponseAllOfData](docs/ChargesOrderResponseAllOfData.md) - [Conekta::Checkout](docs/Checkout.md) - [Conekta::CheckoutOrderTemplate](docs/CheckoutOrderTemplate.md) - [Conekta::CheckoutOrderTemplateCustomerInfo](docs/CheckoutOrderTemplateCustomerInfo.md) diff --git a/docs/ChargesApi.md b/docs/ChargesApi.md index e74fcd9..f5e15ab 100644 --- a/docs/ChargesApi.md +++ b/docs/ChargesApi.md @@ -6,6 +6,7 @@ All URIs are relative to *https://api.conekta.io* | ------ | ------------ | ----------- | | [**get_charges**](ChargesApi.md#get_charges) | **GET** /charges | Get A List of Charges | | [**orders_create_charge**](ChargesApi.md#orders_create_charge) | **POST** /orders/{id}/charges | Create charge | +| [**orders_create_charges**](ChargesApi.md#orders_create_charges) | **POST** /orders/{id}/add_charges | Create charges | | [**update_charge**](ChargesApi.md#update_charge) | **PUT** /charges/{id} | Update a charge | @@ -165,6 +166,83 @@ end - **Accept**: application/vnd.conekta-v2.1.0+json +## orders_create_charges + +> orders_create_charges(id, charge_request, opts) + +Create charges + +Create charges for an existing orden + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::ChargesApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +charge_request = Conekta::ChargeRequest.new({payment_method: Conekta::PaymentMethodCardRequest.new({type: 'card | cash | spei', cvc: '198', exp_month: '12', exp_year: '2025', name: 'John Doe', number: '4242424242424242'})}) # ChargeRequest | requested field for a charge +opts = { + accept_language: 'es', # String | Use for knowing which language to use + x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request. +} + +begin + # Create charges + result = api_instance.orders_create_charges(id, charge_request, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling ChargesApi->orders_create_charges: #{e}" +end +``` + +#### Using the orders_create_charges_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> orders_create_charges_with_http_info(id, charge_request, opts) + +```ruby +begin + # Create charges + data, status_code, headers = api_instance.orders_create_charges_with_http_info(id, charge_request, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling ChargesApi->orders_create_charges_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **charge_request** | [**ChargeRequest**](ChargeRequest.md) | requested field for a charge | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | +| **x_child_company_id** | **String** | In the case of a holding company, the company id of the child company to which will process the request. | [optional] | + +### Return type + +[**ChargesOrderResponse**](ChargesOrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/vnd.conekta-v2.1.0+json + + ## update_charge > update_charge(id, charge_update_request, opts) diff --git a/docs/ChargesOrderResponse.md b/docs/ChargesOrderResponse.md new file mode 100644 index 0000000..b248c68 --- /dev/null +++ b/docs/ChargesOrderResponse.md @@ -0,0 +1,22 @@ +# Conekta::ChargesOrderResponse + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **has_more** | **Boolean** | Indicates if there are more pages to be requested | | +| **object** | **String** | Object type, in this case is list | | +| **data** | [**Array<ChargesOrderResponseAllOfData>**](ChargesOrderResponseAllOfData.md) | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargesOrderResponse.new( + has_more: false, + object: list, + data: null +) +``` + diff --git a/docs/ChargesOrderResponseAllOfData.md b/docs/ChargesOrderResponseAllOfData.md new file mode 100644 index 0000000..2190d37 --- /dev/null +++ b/docs/ChargesOrderResponseAllOfData.md @@ -0,0 +1,52 @@ +# Conekta::ChargesOrderResponseAllOfData + +## Properties + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **amount** | **Integer** | | [optional] | +| **channel** | [**ChargeResponseChannel**](ChargeResponseChannel.md) | | [optional] | +| **created_at** | **Integer** | | [optional] | +| **currency** | **String** | | [optional] | +| **customer_id** | **String** | | [optional] | +| **description** | **String** | | [optional] | +| **device_fingerprint** | **String** | | [optional] | +| **failure_code** | **String** | | [optional] | +| **failure_message** | **String** | | [optional] | +| **id** | **String** | Charge ID | [optional] | +| **livemode** | **Boolean** | Whether the charge was made in live mode or not | [optional] | +| **object** | **String** | | [optional] | +| **order_id** | **String** | Order ID | [optional] | +| **paid_at** | **Integer** | Payment date | [optional] | +| **payment_method** | [**ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional] | +| **reference_id** | **String** | Reference ID of the charge | [optional] | +| **refunds** | [**ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional] | +| **status** | **String** | | [optional] | + +## Example + +```ruby +require 'conekta' + +instance = Conekta::ChargesOrderResponseAllOfData.new( + amount: 4321, + channel: null, + created_at: 1676386026, + currency: MXN, + customer_id: null, + description: Payment from order, + device_fingerprint: 6FR3chaU4Y1nGAW5NAGd1rcjAKa142Ba, + failure_code: suspected_fraud, + failure_message: Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso., + id: 63efa757cf65380001aec040, + livemode: false, + object: charge, + order_id: ord_2tN73UdUSNrYRPD9r, + paid_at: 1676390742, + payment_method: null, + reference_id: ref_2tN73UdUSNrYRPD9r, + refunds: null, + status: pending_payment +) +``` + diff --git a/docs/CheckoutRequest.md b/docs/CheckoutRequest.md index d3ffe8c..7f7c294 100644 --- a/docs/CheckoutRequest.md +++ b/docs/CheckoutRequest.md @@ -9,6 +9,7 @@ | **failure_url** | **String** | Redirection url back to the site in case of failed payment, applies only to HostedPayment. | [optional] | | **monthly_installments_enabled** | **Boolean** | | [optional] | | **monthly_installments_options** | **Array<Integer>** | | [optional] | +| **max_failed_retries** | **Integer** | Number of retries allowed before the checkout is marked as failed | [optional] | | **name** | **String** | Reason for payment | [optional] | | **on_demand_enabled** | **Boolean** | | [optional] | | **redirection_time** | **Integer** | number of seconds to wait before redirecting to the success_url | [optional] | @@ -26,6 +27,7 @@ instance = Conekta::CheckoutRequest.new( failure_url: null, monthly_installments_enabled: false, monthly_installments_options: [3,6,12], + max_failed_retries: 3, name: null, on_demand_enabled: true, redirection_time: 10, diff --git a/docs/Customer.md b/docs/Customer.md index 34da418..ce14311 100644 --- a/docs/Customer.md +++ b/docs/Customer.md @@ -7,12 +7,14 @@ | **antifraud_info** | [**CustomerAntifraudInfo**](CustomerAntifraudInfo.md) | | [optional] | | **corporate** | **Boolean** | It is a value that allows identifying if the email is corporate or not. | [optional][default to false] | | **custom_reference** | **String** | It is an undefined value. | [optional] | +| **date_of_birth** | **String** | It is a parameter that allows to identify the date of birth of the client. | [optional] | | **email** | **String** | An email address is a series of customizable characters followed by a universal Internet symbol, the at symbol (@), the name of a host server, and a web domain ending (.mx, .com, .org, . net, etc). | | | **default_payment_source_id** | **String** | It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id) | [optional] | | **default_shipping_contact_id** | **String** | It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact) | [optional] | | **fiscal_entities** | [**Array<CustomerFiscalEntitiesRequest>**](CustomerFiscalEntitiesRequest.md) | | [optional] | | **metadata** | **Hash<String, Object>** | | [optional] | | **name** | **String** | Client's name | | +| **national_id** | **String** | It is a parameter that allows to identify the national identification number of the client. | [optional] | | **payment_sources** | [**Array<CustomerPaymentMethodsRequest>**](CustomerPaymentMethodsRequest.md) | Contains details of the payment methods that the customer has active or has used in Conekta | [optional] | | **phone** | **String** | Is the customer's phone number | | | **plan_id** | **String** | Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription | [optional] | @@ -28,12 +30,14 @@ instance = Conekta::Customer.new( antifraud_info: null, corporate: false, custom_reference: null, + date_of_birth: 24/07/1992, email: miguel@gmail.com, default_payment_source_id: src_1a2b3c4d5e6f7g8h, default_shipping_contact_id: ship_cont_1a2b3c4d5e6f7g8h, fiscal_entities: null, metadata: null, name: miguel, + national_id: HEGG560427MVZRRL04, payment_sources: null, phone: +5215555555555, plan_id: plan_987234823, diff --git a/docs/CustomerResponse.md b/docs/CustomerResponse.md index fd7c415..c9897ee 100644 --- a/docs/CustomerResponse.md +++ b/docs/CustomerResponse.md @@ -8,6 +8,7 @@ | **corporate** | **Boolean** | true if the customer is a company | [optional] | | **created_at** | **Integer** | Creation date of the object | | | **custom_reference** | **String** | Custom reference | [optional] | +| **date_of_birth** | **String** | It is a parameter that allows to identify the date of birth of the client. | [optional] | | **default_fiscal_entity_id** | **String** | | [optional] | | **default_shipping_contact_id** | **String** | | [optional] | | **default_payment_source_id** | **String** | | [optional] | @@ -16,6 +17,7 @@ | **id** | **String** | Customer's ID | | | **livemode** | **Boolean** | true if the object exists in live mode or the value false if the object exists in test mode | | | **name** | **String** | Customer's name | | +| **national_id** | **String** | It is a parameter that allows to identify the national identification number of the client. | [optional] | | **metadata** | **Hash<String, Object>** | | [optional] | | **object** | **String** | | | | **payment_sources** | [**CustomerPaymentMethodsResponse**](CustomerPaymentMethodsResponse.md) | | [optional] | @@ -33,6 +35,7 @@ instance = Conekta::CustomerResponse.new( corporate: null, created_at: 1485151007, custom_reference: custom_reference, + date_of_birth: 24/07/1992, default_fiscal_entity_id: fis_ent_2tKqqAfqPi21oCmEJ, default_shipping_contact_id: ship_cont_2tKZsTYcsryyu7Ah8, default_payment_source_id: src_2tHJfJ79KyUwpxTio, @@ -41,6 +44,7 @@ instance = Conekta::CustomerResponse.new( id: cus_2tHJfJ79KyUwpxTik, livemode: true, name: Felipe, + national_id: HEGG560427MVZRRL04, metadata: null, object: customer, payment_sources: null, diff --git a/docs/OrderResponseCheckout.md b/docs/OrderResponseCheckout.md index 8de3269..0fef91d 100644 --- a/docs/OrderResponseCheckout.md +++ b/docs/OrderResponseCheckout.md @@ -14,6 +14,7 @@ | **id** | **String** | | [optional] | | **is_redirect_on_failure** | **Boolean** | | [optional] | | **livemode** | **Boolean** | | [optional] | +| **max_failed_retries** | **Integer** | Number of retries allowed before the checkout is marked as failed | [optional] | | **metadata** | **Hash<String, Object>** | | [optional] | | **monthly_installments_enabled** | **Boolean** | | [optional] | | **monthly_installments_options** | **Array<Integer>** | | [optional] | @@ -48,6 +49,7 @@ instance = Conekta::OrderResponseCheckout.new( id: 6fca054a-8519-4c43-971e-cea35cc519bb, is_redirect_on_failure: false, livemode: false, + max_failed_retries: 3, metadata: null, monthly_installments_enabled: false, monthly_installments_options: null, diff --git a/docs/PaymentMethodCash.md b/docs/PaymentMethodCash.md index 7907d22..785fa7f 100644 --- a/docs/PaymentMethodCash.md +++ b/docs/PaymentMethodCash.md @@ -6,11 +6,13 @@ | ---- | ---- | ----------- | ----- | | **type** | **String** | | [optional] | | **object** | **String** | | | +| **agreement** | **String** | Agreement ID | [optional] | | **auth_code** | **Integer** | | [optional] | | **cashier_id** | **String** | | [optional] | | **reference** | **String** | | [optional] | | **barcode_url** | **String** | | [optional] | | **expires_at** | **Integer** | | [optional] | +| **product_type** | **String** | Product type, e.g. bbva_cash_in, cash_in, pespay_cash_in, etc. | [optional] | | **service_name** | **String** | | [optional] | | **store** | **String** | | [optional] | | **store_name** | **String** | | [optional] | @@ -24,11 +26,13 @@ require 'conekta' instance = Conekta::PaymentMethodCash.new( type: null, object: payment_source, + agreement: agreement_2tN73UdUSNrYRPD9r, auth_code: 542563, cashier_id: OINM01010, reference: 93000262276908, barcode_url: https://pt-common-s3-stg.s3.amazonaws.com/644ebf80f2243197aad6cd8810375b905b613dbe.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIA3UN6375MP4SLLCWV%2F20230203%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230203T215750Z&X-Amz-Expires=604800&X-Amz-Security-Token=IQoJb3JpZ2luX2VjEH4aCXVzLWVhc3QtMSJGMEQCICd79cu7DYu%2F4%2B3HnVVswydgU9yHcE9kmQIIk2TLoZJrAiBVZ0HxVSeboK5lhdQSqADjwQF62XX35jhC%2F2riB0M8uCqQBAj2%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F8BEAIaDDc5OTgwMTA4MTY4OCIMXWZds9ZI5hzUdbeGKuQDFreMyeWnWWPqDuGZ2%2BHk6usCr%2Fl096%2FNJh9xtf8htLu56K%2FhWUTx%2BjiqFWM2O%2FF5zTS%2BIV6TqkLDZ%2BQ5Jo1miQrRmR57YDz6uP2Yd1mNZ1ouq5ipnNjUuu5UWCCBAmqyZQsrVmeMQpSV2IB%2BTERCCcW2SukFEYU%2F20%2Fzy5orsoZ8DxOW460IymR3cWBk5u3Xh2cV6Y1RdPEwDEThhqYEF5w%2ByKbLENloMsI%2FUm6sG5PPrO3yQOAP9aK2muLJs9lXQRU%2FL%2FSsmS4FKSUFOqlN6YU%2Bi2Y%2FyGIKAJT2VDkngvz5Sl%2Fadj0j%2BPKftVRV5FcEhySB6Rl%2BSkPN7kVQMJp6pS8hMJ6JCyEA%2BA3eWYdIfKgQhWVXAR4oCBfJ62DH8FU3a7WfSjjpTwfVkiReWen3GGCYfUWETTVKp46MKnJ9PG0CD3KzxKV8VfmEGc5krK%2FI%2F%2BDV2wtSa%2F9qf1%2BK1YYJIK9qZGb25ljUiGhTB4T%2BMUOSQFjetiWUoOJc5Q3Jz%2FXJbiTAMTST39MhdbCgiMgfrc8OGKN5DOVbex33Z7dn0xf%2FOCkSqurhLaG08efKQBdhLNS0RlE9hbg9yZ2ywwtQIF39fI6A7eeH0T11a5HMlvm51u4rAffPHRuEJfwJoIuj%2F2s3QzDg7%2FWeBjqmAbnPOlGfysjrDdvHyG7HVnaX02kdG%2BI3Q4PFOO4Mjaa3ocpjcfPT70%2BZ5a%2FSv5vP0jDLGrLToeM9%2BAUlNepptICRu23a1tLGW4ri0twPA%2FZ4JDTtUUUgdblyG8bKpcUTNp4oOsdmLLBz3FVyr4c2xQbDZSu2zYOtoOxB18W0AC6kIbsMWVU55Bf0mBhPeBWxGrtM4Kw1SgHHlt%2F8vetQi2OwtUcg08c%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=d06dfa41550003359f2aabc8006063a80dfd806a13a54d244024946a76aa9abc, expires_at: 0, + product_type: bbva_cash_in, service_name: OxxoPay, store: 10MON50EDI, store_name: OXXO, diff --git a/docs/PaymentMethodTokenRequest.md b/docs/PaymentMethodTokenRequest.md index 71b0531..5b3cd63 100644 --- a/docs/PaymentMethodTokenRequest.md +++ b/docs/PaymentMethodTokenRequest.md @@ -14,7 +14,7 @@ require 'conekta' instance = Conekta::PaymentMethodTokenRequest.new( type: card | cash | spei, - token_id: test_32hj4g234as + token_id: tok_32hj4g234as ) ``` diff --git a/docs/PayoutOrdersApi.md b/docs/PayoutOrdersApi.md index da8f18f..e9e9208 100644 --- a/docs/PayoutOrdersApi.md +++ b/docs/PayoutOrdersApi.md @@ -4,11 +4,85 @@ All URIs are relative to *https://api.conekta.io* | Method | HTTP request | Description | | ------ | ------------ | ----------- | +| [**cancel_payout_order_by_id**](PayoutOrdersApi.md#cancel_payout_order_by_id) | **PUT** /payout_orders/{id}/cancel | Cancel Payout Order | | [**create_payout_order**](PayoutOrdersApi.md#create_payout_order) | **POST** /payout_orders | Create payout order | | [**get_payout_order_by_id**](PayoutOrdersApi.md#get_payout_order_by_id) | **GET** /payout_orders/{id} | Get Payout Order | | [**get_payout_orders**](PayoutOrdersApi.md#get_payout_orders) | **GET** /payout_orders | Get a list of Payout Orders | +## cancel_payout_order_by_id + +> cancel_payout_order_by_id(id, opts) + +Cancel Payout Order + +Cancel a payout Order resource that corresponds to a payout order ID. + +### Examples + +```ruby +require 'time' +require 'conekta' +# setup authorization +Conekta.configure do |config| + # Configure Bearer authorization: bearerAuth + config.access_token = 'YOUR_BEARER_TOKEN' +end + +api_instance = Conekta::PayoutOrdersApi.new +id = '6307a60c41de27127515a575' # String | Identifier of the resource +opts = { + accept_language: 'es' # String | Use for knowing which language to use +} + +begin + # Cancel Payout Order + result = api_instance.cancel_payout_order_by_id(id, opts) + p result +rescue Conekta::ApiError => e + puts "Error when calling PayoutOrdersApi->cancel_payout_order_by_id: #{e}" +end +``` + +#### Using the cancel_payout_order_by_id_with_http_info variant + +This returns an Array which contains the response data, status code and headers. + +> , Integer, Hash)> cancel_payout_order_by_id_with_http_info(id, opts) + +```ruby +begin + # Cancel Payout Order + data, status_code, headers = api_instance.cancel_payout_order_by_id_with_http_info(id, opts) + p status_code # => 2xx + p headers # => { ... } + p data # => +rescue Conekta::ApiError => e + puts "Error when calling PayoutOrdersApi->cancel_payout_order_by_id_with_http_info: #{e}" +end +``` + +### Parameters + +| Name | Type | Description | Notes | +| ---- | ---- | ----------- | ----- | +| **id** | **String** | Identifier of the resource | | +| **accept_language** | **String** | Use for knowing which language to use | [optional][default to 'es'] | + +### Return type + +[**PayoutOrderResponse**](PayoutOrderResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/vnd.conekta-v2.1.0+json + + ## create_payout_order > create_payout_order(payout_order, opts) diff --git a/docs/UpdateCustomer.md b/docs/UpdateCustomer.md index ce5cca7..66f7455 100644 --- a/docs/UpdateCustomer.md +++ b/docs/UpdateCustomer.md @@ -5,6 +5,7 @@ | Name | Type | Description | Notes | | ---- | ---- | ----------- | ----- | | **antifraud_info** | [**UpdateCustomerAntifraudInfo**](UpdateCustomerAntifraudInfo.md) | | [optional] | +| **date_of_birth** | **String** | It is a parameter that allows to identify the date of birth of the client. | [optional] | | **default_payment_source_id** | **String** | It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id) | [optional] | | **email** | **String** | An email address is a series of customizable characters followed by a universal Internet symbol, the at symbol (@), the name of a host server, and a web domain ending (.mx, .com, .org, . net, etc). | [optional] | | **name** | **String** | Client's name | [optional] | @@ -15,6 +16,7 @@ | **custom_reference** | **String** | It is an undefined value. | [optional] | | **fiscal_entities** | [**Array<CustomerFiscalEntitiesRequest>**](CustomerFiscalEntitiesRequest.md) | | [optional] | | **metadata** | **Hash<String, Object>** | | [optional] | +| **national_id** | **String** | It is a parameter that allows to identify the national identification number of the client. | [optional] | | **payment_sources** | [**Array<CustomerPaymentMethodsRequest>**](CustomerPaymentMethodsRequest.md) | Contains details of the payment methods that the customer has active or has used in Conekta | [optional] | | **shipping_contacts** | [**Array<CustomerShippingContacts>**](CustomerShippingContacts.md) | Contains the detail of the shipping addresses that the client has active or has used in Conekta | [optional] | | **subscription** | [**SubscriptionRequest**](SubscriptionRequest.md) | | [optional] | @@ -26,6 +28,7 @@ require 'conekta' instance = Conekta::UpdateCustomer.new( antifraud_info: null, + date_of_birth: 24/07/1992, default_payment_source_id: src_1a2b3c4d5e6f7g8h, email: miguel@gmail.com, name: miguel, @@ -36,6 +39,7 @@ instance = Conekta::UpdateCustomer.new( custom_reference: null, fiscal_entities: null, metadata: null, + national_id: HEGG560427MVZRRL04, payment_sources: null, shipping_contacts: null, subscription: null diff --git a/lib/conekta.rb b/lib/conekta.rb index 2bedac2..5d482dd 100644 --- a/lib/conekta.rb +++ b/lib/conekta.rb @@ -36,6 +36,8 @@ require 'conekta/models/charge_response_refunds_data' require 'conekta/models/charge_update_request' require 'conekta/models/charges_data_response' +require 'conekta/models/charges_order_response' +require 'conekta/models/charges_order_response_all_of_data' require 'conekta/models/checkout' require 'conekta/models/checkout_order_template' require 'conekta/models/checkout_order_template_customer_info' diff --git a/lib/conekta/api/charges_api.rb b/lib/conekta/api/charges_api.rb index a63fd75..f1f84ef 100644 --- a/lib/conekta/api/charges_api.rb +++ b/lib/conekta/api/charges_api.rb @@ -188,6 +188,90 @@ def orders_create_charge_with_http_info(id, charge_request, opts = {}) return data, status_code, headers end + # Create charges + # Create charges for an existing orden + # @param id [String] Identifier of the resource + # @param charge_request [ChargeRequest] requested field for a charge + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [ChargesOrderResponse] + def orders_create_charges(id, charge_request, opts = {}) + data, _status_code, _headers = orders_create_charges_with_http_info(id, charge_request, opts) + data + end + + # Create charges + # Create charges for an existing orden + # @param id [String] Identifier of the resource + # @param charge_request [ChargeRequest] requested field for a charge + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @option opts [String] :x_child_company_id In the case of a holding company, the company id of the child company to which will process the request. + # @return [Array<(ChargesOrderResponse, Integer, Hash)>] ChargesOrderResponse data, response status code and response headers + def orders_create_charges_with_http_info(id, charge_request, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ChargesApi.orders_create_charges ...' + 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 ChargesApi.orders_create_charges" + end + # verify the required parameter 'charge_request' is set + if @api_client.config.client_side_validation && charge_request.nil? + fail ArgumentError, "Missing the required parameter 'charge_request' when calling ChargesApi.orders_create_charges" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/orders/{id}/add_charges'.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/vnd.conekta-v2.1.0+json']) + # 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 + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + header_params[:'X-Child-Company-Id'] = opts[:'x_child_company_id'] if !opts[:'x_child_company_id'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] || @api_client.object_to_http_body(charge_request) + + # return_type + return_type = opts[:debug_return_type] || 'ChargesOrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"ChargesApi.orders_create_charges", + :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: ChargesApi#orders_create_charges\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Update a charge # @param id [String] Identifier of the resource # @param charge_update_request [ChargeUpdateRequest] requested field for update a charge diff --git a/lib/conekta/api/payout_orders_api.rb b/lib/conekta/api/payout_orders_api.rb index cd67495..820e416 100644 --- a/lib/conekta/api/payout_orders_api.rb +++ b/lib/conekta/api/payout_orders_api.rb @@ -19,6 +19,76 @@ class PayoutOrdersApi def initialize(api_client = ApiClient.default) @api_client = api_client end + # Cancel Payout Order + # Cancel a payout Order resource that corresponds to a payout order ID. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [PayoutOrderResponse] + def cancel_payout_order_by_id(id, opts = {}) + data, _status_code, _headers = cancel_payout_order_by_id_with_http_info(id, opts) + data + end + + # Cancel Payout Order + # Cancel a payout Order resource that corresponds to a payout order ID. + # @param id [String] Identifier of the resource + # @param [Hash] opts the optional parameters + # @option opts [String] :accept_language Use for knowing which language to use (default to 'es') + # @return [Array<(PayoutOrderResponse, Integer, Hash)>] PayoutOrderResponse data, response status code and response headers + def cancel_payout_order_by_id_with_http_info(id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: PayoutOrdersApi.cancel_payout_order_by_id ...' + 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 PayoutOrdersApi.cancel_payout_order_by_id" + end + allowable_values = ["es", "en"] + if @api_client.config.client_side_validation && opts[:'accept_language'] && !allowable_values.include?(opts[:'accept_language']) + fail ArgumentError, "invalid value for \"accept_language\", must be one of #{allowable_values}" + end + # resource path + local_var_path = '/payout_orders/{id}/cancel'.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/vnd.conekta-v2.1.0+json']) + header_params[:'Accept-Language'] = opts[:'accept_language'] if !opts[:'accept_language'].nil? + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'PayoutOrderResponse' + + # auth_names + auth_names = opts[:debug_auth_names] || ['bearerAuth'] + + new_options = opts.merge( + :operation => :"PayoutOrdersApi.cancel_payout_order_by_id", + :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(:PUT, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: PayoutOrdersApi#cancel_payout_order_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # Create payout order # Create a new payout order. # @param payout_order [PayoutOrder] requested field for payout order diff --git a/lib/conekta/models/charges_order_response.rb b/lib/conekta/models/charges_order_response.rb new file mode 100644 index 0000000..7fa8fa0 --- /dev/null +++ b/lib/conekta/models/charges_order_response.rb @@ -0,0 +1,258 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Conekta + # The charges associated with the order + class ChargesOrderResponse + # Indicates if there are more pages to be requested + attr_accessor :has_more + + # Object type, in this case is list + attr_accessor :object + + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'has_more' => :'has_more', + :'object' => :'object', + :'data' => :'data' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'has_more' => :'Boolean', + :'object' => :'String', + :'data' => :'Array' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'Pagination' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargesOrderResponse` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargesOrderResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'has_more') + self.has_more = attributes[:'has_more'] + else + self.has_more = nil + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + else + self.object = nil + end + + if attributes.key?(:'data') + if (value = attributes[:'data']).is_a?(Array) + self.data = value + end + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + if @has_more.nil? + invalid_properties.push('invalid value for "has_more", has_more cannot be nil.') + end + + if @object.nil? + invalid_properties.push('invalid value for "object", object cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + return false if @has_more.nil? + return false if @object.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + has_more == o.has_more && + object == o.object && + data == o.data + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [has_more, object, data].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/charges_order_response_all_of_data.rb b/lib/conekta/models/charges_order_response_all_of_data.rb new file mode 100644 index 0000000..a8cc036 --- /dev/null +++ b/lib/conekta/models/charges_order_response_all_of_data.rb @@ -0,0 +1,382 @@ +=begin +#Conekta API + +#Conekta sdk + +The version of the OpenAPI document: 2.1.0 +Contact: engineering@conekta.com +Generated by: https://openapi-generator.tech +Generator version: 7.5.0 + +=end + +require 'date' +require 'time' + +module Conekta + class ChargesOrderResponseAllOfData + attr_accessor :amount + + attr_accessor :channel + + attr_accessor :created_at + + attr_accessor :currency + + attr_accessor :customer_id + + attr_accessor :description + + attr_accessor :device_fingerprint + + attr_accessor :failure_code + + attr_accessor :failure_message + + # Charge ID + attr_accessor :id + + # Whether the charge was made in live mode or not + attr_accessor :livemode + + attr_accessor :object + + # Order ID + attr_accessor :order_id + + # Payment date + attr_accessor :paid_at + + attr_accessor :payment_method + + # Reference ID of the charge + attr_accessor :reference_id + + attr_accessor :refunds + + attr_accessor :status + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'amount' => :'amount', + :'channel' => :'channel', + :'created_at' => :'created_at', + :'currency' => :'currency', + :'customer_id' => :'customer_id', + :'description' => :'description', + :'device_fingerprint' => :'device_fingerprint', + :'failure_code' => :'failure_code', + :'failure_message' => :'failure_message', + :'id' => :'id', + :'livemode' => :'livemode', + :'object' => :'object', + :'order_id' => :'order_id', + :'paid_at' => :'paid_at', + :'payment_method' => :'payment_method', + :'reference_id' => :'reference_id', + :'refunds' => :'refunds', + :'status' => :'status' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'amount' => :'Integer', + :'channel' => :'ChargeResponseChannel', + :'created_at' => :'Integer', + :'currency' => :'String', + :'customer_id' => :'String', + :'description' => :'String', + :'device_fingerprint' => :'String', + :'failure_code' => :'String', + :'failure_message' => :'String', + :'id' => :'String', + :'livemode' => :'Boolean', + :'object' => :'String', + :'order_id' => :'String', + :'paid_at' => :'Integer', + :'payment_method' => :'ChargeResponsePaymentMethod', + :'reference_id' => :'String', + :'refunds' => :'ChargeResponseRefunds', + :'status' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + :'paid_at', + :'reference_id', + :'refunds', + ]) + end + + # List of class defined in allOf (OpenAPI v3) + def self.openapi_all_of + [ + :'ChargeResponse' + ] + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Conekta::ChargesOrderResponseAllOfData` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Conekta::ChargesOrderResponseAllOfData`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'amount') + self.amount = attributes[:'amount'] + end + + if attributes.key?(:'channel') + self.channel = attributes[:'channel'] + end + + if attributes.key?(:'created_at') + self.created_at = attributes[:'created_at'] + end + + if attributes.key?(:'currency') + self.currency = attributes[:'currency'] + end + + if attributes.key?(:'customer_id') + self.customer_id = attributes[:'customer_id'] + end + + if attributes.key?(:'description') + self.description = attributes[:'description'] + end + + if attributes.key?(:'device_fingerprint') + self.device_fingerprint = attributes[:'device_fingerprint'] + end + + if attributes.key?(:'failure_code') + self.failure_code = attributes[:'failure_code'] + end + + if attributes.key?(:'failure_message') + self.failure_message = attributes[:'failure_message'] + end + + if attributes.key?(:'id') + self.id = attributes[:'id'] + end + + if attributes.key?(:'livemode') + self.livemode = attributes[:'livemode'] + end + + if attributes.key?(:'object') + self.object = attributes[:'object'] + end + + if attributes.key?(:'order_id') + self.order_id = attributes[:'order_id'] + end + + if attributes.key?(:'paid_at') + self.paid_at = attributes[:'paid_at'] + end + + if attributes.key?(:'payment_method') + self.payment_method = attributes[:'payment_method'] + end + + if attributes.key?(:'reference_id') + self.reference_id = attributes[:'reference_id'] + end + + if attributes.key?(:'refunds') + self.refunds = attributes[:'refunds'] + end + + if attributes.key?(:'status') + self.status = attributes[:'status'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' + invalid_properties = Array.new + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + warn '[DEPRECATED] the `valid?` method is obsolete' + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + amount == o.amount && + channel == o.channel && + created_at == o.created_at && + currency == o.currency && + customer_id == o.customer_id && + description == o.description && + device_fingerprint == o.device_fingerprint && + failure_code == o.failure_code && + failure_message == o.failure_message && + id == o.id && + livemode == o.livemode && + object == o.object && + order_id == o.order_id && + paid_at == o.paid_at && + payment_method == o.payment_method && + reference_id == o.reference_id && + refunds == o.refunds && + status == o.status + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [amount, channel, created_at, currency, customer_id, description, device_fingerprint, failure_code, failure_message, id, livemode, object, order_id, paid_at, payment_method, reference_id, refunds, status].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + transformed_hash = {} + openapi_types.each_pair do |key, type| + if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = nil + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[attribute_map[key]].is_a?(Array) + transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } + end + elsif !attributes[attribute_map[key]].nil? + transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) + end + end + new(transformed_hash) + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def self._deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Conekta.const_get(type) + klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/lib/conekta/models/checkout_request.rb b/lib/conekta/models/checkout_request.rb index 6060e51..f2447a3 100644 --- a/lib/conekta/models/checkout_request.rb +++ b/lib/conekta/models/checkout_request.rb @@ -29,6 +29,9 @@ class CheckoutRequest attr_accessor :monthly_installments_options + # Number of retries allowed before the checkout is marked as failed + attr_accessor :max_failed_retries + # Reason for payment attr_accessor :name @@ -51,6 +54,7 @@ def self.attribute_map :'failure_url' => :'failure_url', :'monthly_installments_enabled' => :'monthly_installments_enabled', :'monthly_installments_options' => :'monthly_installments_options', + :'max_failed_retries' => :'max_failed_retries', :'name' => :'name', :'on_demand_enabled' => :'on_demand_enabled', :'redirection_time' => :'redirection_time', @@ -72,6 +76,7 @@ def self.openapi_types :'failure_url' => :'String', :'monthly_installments_enabled' => :'Boolean', :'monthly_installments_options' => :'Array', + :'max_failed_retries' => :'Integer', :'name' => :'String', :'on_demand_enabled' => :'Boolean', :'redirection_time' => :'Integer', @@ -127,6 +132,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'max_failed_retries') + self.max_failed_retries = attributes[:'max_failed_retries'] + end + if attributes.key?(:'name') self.name = attributes[:'name'] end @@ -178,6 +187,7 @@ def ==(o) failure_url == o.failure_url && monthly_installments_enabled == o.monthly_installments_enabled && monthly_installments_options == o.monthly_installments_options && + max_failed_retries == o.max_failed_retries && name == o.name && on_demand_enabled == o.on_demand_enabled && redirection_time == o.redirection_time && @@ -194,7 +204,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [allowed_payment_methods, expires_at, failure_url, monthly_installments_enabled, monthly_installments_options, name, on_demand_enabled, redirection_time, success_url, type].hash + [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 end # Builds the object from hash diff --git a/lib/conekta/models/customer.rb b/lib/conekta/models/customer.rb index 3f21a98..745f71e 100644 --- a/lib/conekta/models/customer.rb +++ b/lib/conekta/models/customer.rb @@ -24,6 +24,9 @@ class Customer # It is an undefined value. attr_accessor :custom_reference + # It is a parameter that allows to identify the date of birth of the client. + attr_accessor :date_of_birth + # An email address is a series of customizable characters followed by a universal Internet symbol, the at symbol (@), the name of a host server, and a web domain ending (.mx, .com, .org, . net, etc). attr_accessor :email @@ -40,6 +43,9 @@ class Customer # Client's name attr_accessor :name + # It is a parameter that allows to identify the national identification number of the client. + attr_accessor :national_id + # Contains details of the payment methods that the customer has active or has used in Conekta attr_accessor :payment_sources @@ -60,12 +66,14 @@ def self.attribute_map :'antifraud_info' => :'antifraud_info', :'corporate' => :'corporate', :'custom_reference' => :'custom_reference', + :'date_of_birth' => :'date_of_birth', :'email' => :'email', :'default_payment_source_id' => :'default_payment_source_id', :'default_shipping_contact_id' => :'default_shipping_contact_id', :'fiscal_entities' => :'fiscal_entities', :'metadata' => :'metadata', :'name' => :'name', + :'national_id' => :'national_id', :'payment_sources' => :'payment_sources', :'phone' => :'phone', :'plan_id' => :'plan_id', @@ -85,12 +93,14 @@ def self.openapi_types :'antifraud_info' => :'CustomerAntifraudInfo', :'corporate' => :'Boolean', :'custom_reference' => :'String', + :'date_of_birth' => :'String', :'email' => :'String', :'default_payment_source_id' => :'String', :'default_shipping_contact_id' => :'String', :'fiscal_entities' => :'Array', :'metadata' => :'Hash', :'name' => :'String', + :'national_id' => :'String', :'payment_sources' => :'Array', :'phone' => :'String', :'plan_id' => :'String', @@ -135,6 +145,10 @@ def initialize(attributes = {}) self.custom_reference = attributes[:'custom_reference'] end + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + if attributes.key?(:'email') self.email = attributes[:'email'] else @@ -167,6 +181,10 @@ def initialize(attributes = {}) self.name = nil end + if attributes.key?(:'national_id') + self.national_id = attributes[:'national_id'] + end + if attributes.key?(:'payment_sources') if (value = attributes[:'payment_sources']).is_a?(Array) self.payment_sources = value @@ -251,12 +269,14 @@ def ==(o) antifraud_info == o.antifraud_info && corporate == o.corporate && custom_reference == o.custom_reference && + date_of_birth == o.date_of_birth && email == o.email && default_payment_source_id == o.default_payment_source_id && default_shipping_contact_id == o.default_shipping_contact_id && fiscal_entities == o.fiscal_entities && metadata == o.metadata && name == o.name && + national_id == o.national_id && payment_sources == o.payment_sources && phone == o.phone && plan_id == o.plan_id && @@ -273,7 +293,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [antifraud_info, corporate, custom_reference, email, default_payment_source_id, default_shipping_contact_id, fiscal_entities, metadata, name, payment_sources, phone, plan_id, shipping_contacts, subscription].hash + [antifraud_info, corporate, custom_reference, date_of_birth, email, default_payment_source_id, default_shipping_contact_id, fiscal_entities, metadata, name, national_id, payment_sources, phone, plan_id, shipping_contacts, subscription].hash end # Builds the object from hash diff --git a/lib/conekta/models/customer_response.rb b/lib/conekta/models/customer_response.rb index 0a56088..7c69b25 100644 --- a/lib/conekta/models/customer_response.rb +++ b/lib/conekta/models/customer_response.rb @@ -27,6 +27,9 @@ class CustomerResponse # Custom reference attr_accessor :custom_reference + # It is a parameter that allows to identify the date of birth of the client. + attr_accessor :date_of_birth + attr_accessor :default_fiscal_entity_id attr_accessor :default_shipping_contact_id @@ -46,6 +49,9 @@ class CustomerResponse # Customer's name attr_accessor :name + # It is a parameter that allows to identify the national identification number of the client. + attr_accessor :national_id + attr_accessor :metadata attr_accessor :object @@ -66,6 +72,7 @@ def self.attribute_map :'corporate' => :'corporate', :'created_at' => :'created_at', :'custom_reference' => :'custom_reference', + :'date_of_birth' => :'date_of_birth', :'default_fiscal_entity_id' => :'default_fiscal_entity_id', :'default_shipping_contact_id' => :'default_shipping_contact_id', :'default_payment_source_id' => :'default_payment_source_id', @@ -74,6 +81,7 @@ def self.attribute_map :'id' => :'id', :'livemode' => :'livemode', :'name' => :'name', + :'national_id' => :'national_id', :'metadata' => :'metadata', :'object' => :'object', :'payment_sources' => :'payment_sources', @@ -95,6 +103,7 @@ def self.openapi_types :'corporate' => :'Boolean', :'created_at' => :'Integer', :'custom_reference' => :'String', + :'date_of_birth' => :'String', :'default_fiscal_entity_id' => :'String', :'default_shipping_contact_id' => :'String', :'default_payment_source_id' => :'String', @@ -103,6 +112,7 @@ def self.openapi_types :'id' => :'String', :'livemode' => :'Boolean', :'name' => :'String', + :'national_id' => :'String', :'metadata' => :'Hash', :'object' => :'String', :'payment_sources' => :'CustomerPaymentMethodsResponse', @@ -154,6 +164,10 @@ def initialize(attributes = {}) self.custom_reference = attributes[:'custom_reference'] end + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + if attributes.key?(:'default_fiscal_entity_id') self.default_fiscal_entity_id = attributes[:'default_fiscal_entity_id'] end @@ -192,6 +206,10 @@ def initialize(attributes = {}) self.name = nil end + if attributes.key?(:'national_id') + self.national_id = attributes[:'national_id'] + end + if attributes.key?(:'metadata') if (value = attributes[:'metadata']).is_a?(Hash) self.metadata = value @@ -289,6 +307,7 @@ def ==(o) corporate == o.corporate && created_at == o.created_at && custom_reference == o.custom_reference && + date_of_birth == o.date_of_birth && default_fiscal_entity_id == o.default_fiscal_entity_id && default_shipping_contact_id == o.default_shipping_contact_id && default_payment_source_id == o.default_payment_source_id && @@ -297,6 +316,7 @@ def ==(o) id == o.id && livemode == o.livemode && name == o.name && + national_id == o.national_id && metadata == o.metadata && object == o.object && payment_sources == o.payment_sources && @@ -314,7 +334,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [antifraud_info, corporate, created_at, custom_reference, default_fiscal_entity_id, default_shipping_contact_id, default_payment_source_id, email, fiscal_entities, id, livemode, name, metadata, object, payment_sources, phone, shipping_contacts, subscription].hash + [antifraud_info, corporate, created_at, custom_reference, date_of_birth, default_fiscal_entity_id, default_shipping_contact_id, default_payment_source_id, email, fiscal_entities, id, livemode, name, national_id, metadata, object, payment_sources, phone, shipping_contacts, subscription].hash end # Builds the object from hash diff --git a/lib/conekta/models/order_refund_request.rb b/lib/conekta/models/order_refund_request.rb index e11dbf2..310171d 100644 --- a/lib/conekta/models/order_refund_request.rb +++ b/lib/conekta/models/order_refund_request.rb @@ -49,7 +49,6 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ - :'expires_at', ]) end diff --git a/lib/conekta/models/order_response_checkout.rb b/lib/conekta/models/order_response_checkout.rb index 82507f2..8ea8bb8 100644 --- a/lib/conekta/models/order_response_checkout.rb +++ b/lib/conekta/models/order_response_checkout.rb @@ -35,6 +35,9 @@ class OrderResponseCheckout attr_accessor :livemode + # Number of retries allowed before the checkout is marked as failed + attr_accessor :max_failed_retries + attr_accessor :metadata attr_accessor :monthly_installments_enabled @@ -83,6 +86,7 @@ def self.attribute_map :'id' => :'id', :'is_redirect_on_failure' => :'is_redirect_on_failure', :'livemode' => :'livemode', + :'max_failed_retries' => :'max_failed_retries', :'metadata' => :'metadata', :'monthly_installments_enabled' => :'monthly_installments_enabled', :'monthly_installments_options' => :'monthly_installments_options', @@ -121,6 +125,7 @@ def self.openapi_types :'id' => :'String', :'is_redirect_on_failure' => :'Boolean', :'livemode' => :'Boolean', + :'max_failed_retries' => :'Integer', :'metadata' => :'Hash', :'monthly_installments_enabled' => :'Boolean', :'monthly_installments_options' => :'Array', @@ -144,6 +149,7 @@ def self.openapi_types # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'max_failed_retries', :'on_demand_enabled', :'redirection_time', ]) @@ -208,6 +214,10 @@ def initialize(attributes = {}) self.livemode = attributes[:'livemode'] end + if attributes.key?(:'max_failed_retries') + self.max_failed_retries = attributes[:'max_failed_retries'] + end + if attributes.key?(:'metadata') if (value = attributes[:'metadata']).is_a?(Hash) self.metadata = value @@ -330,6 +340,7 @@ def ==(o) id == o.id && is_redirect_on_failure == o.is_redirect_on_failure && livemode == o.livemode && + max_failed_retries == o.max_failed_retries && metadata == o.metadata && monthly_installments_enabled == o.monthly_installments_enabled && monthly_installments_options == o.monthly_installments_options && @@ -358,7 +369,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [allowed_payment_methods, can_not_expire, emails_sent, exclude_card_networks, expires_at, failure_url, force_3ds_flow, id, is_redirect_on_failure, livemode, metadata, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, object, on_demand_enabled, paid_payments_count, recurrent, redirection_time, slug, sms_sent, success_url, starts_at, status, type, url].hash + [allowed_payment_methods, can_not_expire, emails_sent, exclude_card_networks, expires_at, failure_url, force_3ds_flow, id, is_redirect_on_failure, livemode, max_failed_retries, metadata, monthly_installments_enabled, monthly_installments_options, name, needs_shipping_contact, object, on_demand_enabled, paid_payments_count, recurrent, redirection_time, slug, sms_sent, success_url, starts_at, status, type, url].hash end # Builds the object from hash diff --git a/lib/conekta/models/payment_method_cash.rb b/lib/conekta/models/payment_method_cash.rb index ef3c65d..f5f8548 100644 --- a/lib/conekta/models/payment_method_cash.rb +++ b/lib/conekta/models/payment_method_cash.rb @@ -19,6 +19,9 @@ class PaymentMethodCash attr_accessor :object + # Agreement ID + attr_accessor :agreement + attr_accessor :auth_code attr_accessor :cashier_id @@ -29,6 +32,9 @@ class PaymentMethodCash attr_accessor :expires_at + # Product type, e.g. bbva_cash_in, cash_in, pespay_cash_in, etc. + attr_accessor :product_type + attr_accessor :service_name attr_accessor :store @@ -42,11 +48,13 @@ def self.attribute_map { :'type' => :'type', :'object' => :'object', + :'agreement' => :'agreement', :'auth_code' => :'auth_code', :'cashier_id' => :'cashier_id', :'reference' => :'reference', :'barcode_url' => :'barcode_url', :'expires_at' => :'expires_at', + :'product_type' => :'product_type', :'service_name' => :'service_name', :'store' => :'store', :'store_name' => :'store_name', @@ -64,11 +72,13 @@ def self.openapi_types { :'type' => :'String', :'object' => :'String', + :'agreement' => :'String', :'auth_code' => :'Integer', :'cashier_id' => :'String', :'reference' => :'String', :'barcode_url' => :'String', :'expires_at' => :'Integer', + :'product_type' => :'String', :'service_name' => :'String', :'store' => :'String', :'store_name' => :'String', @@ -117,6 +127,10 @@ def initialize(attributes = {}) self.object = nil end + if attributes.key?(:'agreement') + self.agreement = attributes[:'agreement'] + end + if attributes.key?(:'auth_code') self.auth_code = attributes[:'auth_code'] end @@ -137,6 +151,10 @@ def initialize(attributes = {}) self.expires_at = attributes[:'expires_at'] end + if attributes.key?(:'product_type') + self.product_type = attributes[:'product_type'] + end + if attributes.key?(:'service_name') self.service_name = attributes[:'service_name'] end @@ -181,11 +199,13 @@ def ==(o) self.class == o.class && type == o.type && object == o.object && + agreement == o.agreement && auth_code == o.auth_code && cashier_id == o.cashier_id && reference == o.reference && barcode_url == o.barcode_url && expires_at == o.expires_at && + product_type == o.product_type && service_name == o.service_name && store == o.store && store_name == o.store_name && @@ -201,7 +221,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [type, object, auth_code, cashier_id, reference, barcode_url, expires_at, service_name, store, store_name, customer_ip_address].hash + [type, object, agreement, auth_code, cashier_id, reference, barcode_url, expires_at, product_type, service_name, store, store_name, customer_ip_address].hash end # Builds the object from hash diff --git a/lib/conekta/models/update_customer.rb b/lib/conekta/models/update_customer.rb index dc0a49f..207aaa7 100644 --- a/lib/conekta/models/update_customer.rb +++ b/lib/conekta/models/update_customer.rb @@ -18,6 +18,9 @@ module Conekta class UpdateCustomer attr_accessor :antifraud_info + # It is a parameter that allows to identify the date of birth of the client. + attr_accessor :date_of_birth + # It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id) attr_accessor :default_payment_source_id @@ -46,6 +49,9 @@ class UpdateCustomer attr_accessor :metadata + # It is a parameter that allows to identify the national identification number of the client. + attr_accessor :national_id + # Contains details of the payment methods that the customer has active or has used in Conekta attr_accessor :payment_sources @@ -58,6 +64,7 @@ class UpdateCustomer def self.attribute_map { :'antifraud_info' => :'antifraud_info', + :'date_of_birth' => :'date_of_birth', :'default_payment_source_id' => :'default_payment_source_id', :'email' => :'email', :'name' => :'name', @@ -68,6 +75,7 @@ def self.attribute_map :'custom_reference' => :'custom_reference', :'fiscal_entities' => :'fiscal_entities', :'metadata' => :'metadata', + :'national_id' => :'national_id', :'payment_sources' => :'payment_sources', :'shipping_contacts' => :'shipping_contacts', :'subscription' => :'subscription' @@ -83,6 +91,7 @@ def self.acceptable_attributes def self.openapi_types { :'antifraud_info' => :'UpdateCustomerAntifraudInfo', + :'date_of_birth' => :'String', :'default_payment_source_id' => :'String', :'email' => :'String', :'name' => :'String', @@ -93,6 +102,7 @@ def self.openapi_types :'custom_reference' => :'String', :'fiscal_entities' => :'Array', :'metadata' => :'Hash', + :'national_id' => :'String', :'payment_sources' => :'Array', :'shipping_contacts' => :'Array', :'subscription' => :'SubscriptionRequest' @@ -125,6 +135,10 @@ def initialize(attributes = {}) self.antifraud_info = attributes[:'antifraud_info'] end + if attributes.key?(:'date_of_birth') + self.date_of_birth = attributes[:'date_of_birth'] + end + if attributes.key?(:'default_payment_source_id') self.default_payment_source_id = attributes[:'default_payment_source_id'] end @@ -171,6 +185,10 @@ def initialize(attributes = {}) end end + if attributes.key?(:'national_id') + self.national_id = attributes[:'national_id'] + end + if attributes.key?(:'payment_sources') if (value = attributes[:'payment_sources']).is_a?(Array) self.payment_sources = value @@ -228,6 +246,7 @@ def ==(o) return true if self.equal?(o) self.class == o.class && antifraud_info == o.antifraud_info && + date_of_birth == o.date_of_birth && default_payment_source_id == o.default_payment_source_id && email == o.email && name == o.name && @@ -238,6 +257,7 @@ def ==(o) custom_reference == o.custom_reference && fiscal_entities == o.fiscal_entities && metadata == o.metadata && + national_id == o.national_id && payment_sources == o.payment_sources && shipping_contacts == o.shipping_contacts && subscription == o.subscription @@ -252,7 +272,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [antifraud_info, default_payment_source_id, email, name, phone, plan_id, default_shipping_contact_id, corporate, custom_reference, fiscal_entities, metadata, payment_sources, shipping_contacts, subscription].hash + [antifraud_info, date_of_birth, default_payment_source_id, email, name, phone, plan_id, default_shipping_contact_id, corporate, custom_reference, fiscal_entities, metadata, national_id, payment_sources, shipping_contacts, subscription].hash end # Builds the object from hash