From 031dc666d7d8f52175969add8587742b51eadcaf Mon Sep 17 00:00:00 2001 From: Franklin Date: Tue, 21 Jul 2026 15:07:31 -0500 Subject: [PATCH 1/2] Add new API documentation and models for Payout Orders, Subscriptions, and Token Requests - Created documentation for PayoutOrderRequestCustomerInfo, ResendEventRequest, ShippingLinesDataResponse, SubscriptionDetails, SubscriptionDetailsCard, SubscriptionDetailsPlan, SubscriptionsCustomerPortalApi, TaxLinesDataResponse, TokenRequest, TokenRequestCard, TokenRequestCheckout, UpdateFiscalEntityRequest, UpdatePaymentMethodsCard, UpdatePlan, UpdateWebhook, and UpdatesASubscription. - Added unit tests for SubscriptionsCustomerPortalApi. --- .github/workflows/python.yml | 10 +- .openapi-generator/FILES | 163 ++--- .openapi-generator/VERSION | 2 +- Makefile | 3 +- README.md | 89 +-- VERSION | 2 +- conekta/__init__.py | 675 ++++++++++++------ conekta/api/__init__.py | 1 + conekta/api/antifraud_api.py | 65 +- conekta/api/api_keys_api.py | 3 +- conekta/api/balances_api.py | 3 +- conekta/api/charges_api.py | 3 +- conekta/api/companies_api.py | 270 ++++++- conekta/api/customers_api.py | 67 +- conekta/api/discounts_api.py | 3 +- conekta/api/events_api.py | 35 +- conekta/api/logs_api.py | 27 +- conekta/api/orders_api.py | 52 +- conekta/api/payment_link_api.py | 3 +- conekta/api/payment_methods_api.py | 35 +- conekta/api/payout_orders_api.py | 35 +- conekta/api/plans_api.py | 71 +- conekta/api/products_api.py | 3 +- conekta/api/shipping_contacts_api.py | 67 +- conekta/api/shippings_api.py | 3 +- conekta/api/subscriptions_api.py | 71 +- .../api/subscriptions_customer_portal_api.py | 636 +++++++++++++++++ conekta/api/taxes_api.py | 67 +- conekta/api/tokens_api.py | 41 +- conekta/api/transactions_api.py | 3 +- conekta/api/transfers_api.py | 3 +- conekta/api/webhook_keys_api.py | 3 +- conekta/api/webhooks_api.py | 35 +- conekta/api_client.py | 5 +- conekta/configuration.py | 292 ++++++-- conekta/exceptions.py | 29 +- conekta/models/__init__.py | 82 +-- conekta/models/api_key_create_response.py | 43 +- conekta/models/api_key_request.py | 11 +- conekta/models/api_key_response.py | 35 +- conekta/models/api_key_response_on_delete.py | 109 --- conekta/models/api_key_update_request.py | 11 +- ...ld.py => balance_common_fiels_response.py} | 17 +- conekta/models/balance_response.py | 45 +- conekta/models/blacklist_rule_response.py | 15 +- ...eements.py => cash_agreements_response.py} | 19 +- conekta/models/charge_order_response.py | 55 +- .../charge_order_response_payment_method.py | 32 +- conekta/models/charge_request.py | 9 +- conekta/models/charge_response.py | 58 +- conekta/models/charge_response_channel.py | 17 +- .../models/charge_response_payment_method.py | 30 +- conekta/models/charge_response_refunds.py | 25 +- .../models/charge_response_refunds_data.py | 21 +- conekta/models/charge_update_request.py | 9 +- conekta/models/chargeback_file_response.py | 95 +++ conekta/models/chargeback_response.py | 147 ++++ conekta/models/charges_data_response.py | 58 +- conekta/models/charges_order_response.py | 23 +- .../charges_order_response_all_of_data.py | 149 ---- conekta/models/checkout.py | 56 +- conekta/models/checkout_order_template.py | 45 +- .../checkout_order_template_customer_info.py | 138 ---- conekta/models/checkout_response.py | 77 +- conekta/models/checkouts_response.py | 25 +- conekta/models/company_document_request.py | 17 +- conekta/models/company_document_response.py | 13 +- conekta/models/company_response.py | 54 +- .../company_response_documents_inner.py | 107 --- conekta/models/create_company_request.py | 11 +- ...reate_company_request_bank_account_info.py | 9 +- .../create_company_request_comercial_info.py | 15 +- .../create_company_request_fiscal_info.py | 11 +- ...reate_customer_fiscal_entities_response.py | 33 +- ...reate_customer_payment_methods_response.py | 61 +- ...ta.py => create_rule_whitelist_request.py} | 21 +- conekta/models/customer.py | 42 +- conekta/models/customer_antifraud_info.py | 13 +- .../customer_antifraud_info_response.py | 13 +- ...method_response.py => customer_details.py} | 33 +- .../customer_fiscal_entities_data_response.py | 33 +- .../customer_fiscal_entities_response.py | 11 +- conekta/models/customer_info.py | 17 +- ...mer_id.py => customer_info_customer_id.py} | 19 +- .../models/customer_payment_method_request.py | 88 --- .../models/customer_payment_methods_data.py | 61 +- .../customer_payment_methods_response.py | 25 +- conekta/models/customer_portal_response.py | 119 +++ conekta/models/customer_response.py | 54 +- .../customer_response_shipping_contacts.py | 11 +- .../customer_shipping_contacts_address.py | 32 +- ...ustomer_shipping_contacts_data_response.py | 35 +- ... => customer_shipping_contacts_request.py} | 35 +- ...omer_shipping_contacts_request_address.py} | 40 +- .../customer_shipping_contacts_response.py | 34 +- .../models/customer_subscription_response.py | 123 ++++ ...tomer_update_shipping_contacts_request.py} | 35 +- conekta/models/customers_response.py | 31 +- conekta/models/delete_api_keys_response.py | 30 +- .../models/deleted_blacklist_rule_response.py | 15 +- .../models/deleted_whitelist_rule_response.py | 15 +- conekta/models/details.py | 96 --- conekta/models/details_error.py | 20 +- .../models/discount_lines_data_response.py | 19 +- conekta/models/discount_lines_response.py | 19 +- conekta/models/email_checkout_request.py | 11 +- conekta/models/error.py | 18 +- conekta/models/event_response.py | 23 +- conekta/models/events_resend_response.py | 21 +- conekta/models/fiscal_entity_address.py | 26 +- ...es_request.py => fiscal_entity_request.py} | 33 +- ...ss.py => fiscal_entity_request_address.py} | 29 +- conekta/models/get_api_keys_response.py | 25 +- conekta/models/get_charges_response.py | 25 +- conekta/models/get_companies_response.py | 25 +- ...t_customer_payment_method_data_response.py | 61 +- conekta/models/get_events_response.py | 25 +- .../get_order_discount_lines_response.py | 25 +- conekta/models/get_orders_response.py | 25 +- conekta/models/get_payment_method_response.py | 25 +- conekta/models/get_plans_response.py | 25 +- conekta/models/get_transactions_response.py | 25 +- conekta/models/get_transfers_response.py | 25 +- conekta/models/get_webhook_keys_response.py | 25 +- conekta/models/get_webhooks_response.py | 25 +- conekta/models/log_response.py | 141 ---- conekta/models/log_response_for_request.py | 135 ++++ conekta/models/logs_response_data.py | 64 +- ...sponse.py => logs_response_for_request.py} | 28 +- conekta/models/order_capture_request.py | 9 +- conekta/models/order_channel_response.py | 17 +- conekta/models/order_charges_response.py | 17 +- ...t_request.py => order_checkout_request.py} | 67 +- .../models/order_customer_info_response.py | 103 --- .../models/order_discount_lines_request.py | 13 +- .../models/order_discount_lines_response.py | 19 +- .../order_fiscal_entity_address_response.py | 28 +- conekta/models/order_fiscal_entity_request.py | 25 +- .../models/order_fiscal_entity_response.py | 41 +- conekta/models/order_next_action_response.py | 9 +- ...er_next_action_response_redirect_to_url.py | 11 +- conekta/models/order_refund_request.py | 13 +- conekta/models/order_request.py | 35 +- conekta/models/order_request_customer_info.py | 32 +- conekta/models/order_response.py | 48 +- conekta/models/order_response_checkout.py | 91 ++- .../models/order_response_customer_info.py | 28 +- conekta/models/order_response_products.py | 25 +- .../models/order_response_shipping_contact.py | 42 +- ...on.py => order_shipping_lines_response.py} | 39 +- ...esponse.py => order_tax_lines_response.py} | 35 +- conekta/models/order_tax_request.py | 13 +- ..._tax_response.py => order_tax_response.py} | 25 +- ...rder_update_request.py => order_update.py} | 49 +- ..._info.py => order_update_customer_info.py} | 38 +- .../order_update_fiscal_entity_request.py | 25 +- ...uest.py => orders_update_taxes_request.py} | 25 +- conekta/models/page.py | 100 --- conekta/models/payment_method.py | 90 --- .../models/payment_method_bank_transfer.py | 73 +- conekta/models/payment_method_bnpl_payment.py | 26 +- conekta/models/payment_method_bnpl_request.py | 23 +- conekta/models/payment_method_card.py | 31 +- conekta/models/payment_method_card_request.py | 21 +- .../models/payment_method_card_response.py | 37 +- conekta/models/payment_method_cash.py | 46 +- .../payment_method_cash_recurrent_response.py | 31 +- conekta/models/payment_method_cash_request.py | 11 +- .../models/payment_method_cash_response.py | 31 +- .../models/payment_method_general_request.py | 21 +- conekta/models/payment_method_pbb_payment.py | 17 +- conekta/models/payment_method_pbb_request.py | 13 +- ...payment_method_spei_recurrent_response.py} | 29 +- conekta/models/payment_method_spei_request.py | 11 +- .../models/payment_method_token_request.py | 11 +- conekta/models/payout.py | 7 +- conekta/models/payout_method.py | 9 +- conekta/models/payout_order_payouts_item.py | 23 +- ...ayout_order.py => payout_order_request.py} | 33 +- ... => payout_order_request_customer_info.py} | 21 +- conekta/models/payout_order_response.py | 31 +- .../payout_order_response_customer_info.py | 30 +- conekta/models/payout_orders_response.py | 31 +- conekta/models/plan_request.py | 25 +- conekta/models/plan_response.py | 43 +- conekta/models/product.py | 25 +- conekta/models/product_data_response.py | 25 +- conekta/models/product_order_response.py | 25 +- ...end_request.py => resend_event_request.py} | 17 +- conekta/models/risk_rules_data.py | 21 +- conekta/models/risk_rules_list.py | 25 +- .../models/shipping_lines_data_response.py | 104 +++ conekta/models/shipping_order_response.py | 17 +- conekta/models/shipping_request.py | 17 +- conekta/models/sms_checkout_request.py | 11 +- conekta/models/subscription_details.py | 115 +++ conekta/models/subscription_details_card.py | 111 +++ conekta/models/subscription_details_plan.py | 107 +++ .../models/subscription_events_response.py | 25 +- conekta/models/subscription_request.py | 15 +- conekta/models/subscription_response.py | 78 +- conekta/models/tax_lines_data_response.py | 100 +++ conekta/models/{token.py => token_request.py} | 35 +- .../{token_card.py => token_request_card.py} | 27 +- ..._checkout.py => token_request_checkout.py} | 17 +- conekta/models/token_response.py | 20 +- conekta/models/token_response_checkout.py | 47 +- conekta/models/transaction_response.py | 29 +- .../models/transfer_destination_response.py | 23 +- conekta/models/transfer_method_response.py | 23 +- conekta/models/transfer_response.py | 25 +- conekta/models/transfers_response.py | 25 +- conekta/models/update_customer.py | 42 +- .../models/update_customer_antifraud_info.py | 13 +- ...pdate_customer_fiscal_entities_response.py | 33 +- ...pdate_customer_payment_methods_response.py | 61 +- ...est.py => update_fiscal_entity_request.py} | 33 +- .../update_order_discount_lines_request.py | 13 +- ...hods.py => update_payment_methods_card.py} | 19 +- ...{plan_update_request.py => update_plan.py} | 21 +- conekta/models/update_product.py | 29 +- ...ok_update_request.py => update_webhook.py} | 23 +- ...e_request.py => updates_a_subscription.py} | 21 +- conekta/models/webhook_key_create_response.py | 19 +- conekta/models/webhook_key_delete_response.py | 19 +- conekta/models/webhook_key_request.py | 9 +- conekta/models/webhook_key_response.py | 24 +- conekta/models/webhook_key_update_request.py | 9 +- conekta/models/webhook_log.py | 23 +- conekta/models/webhook_request.py | 15 +- conekta/models/webhook_response.py | 23 +- conekta/models/whitelistlist_rule_response.py | 15 +- conekta/rest.py | 68 +- config-python.json | 4 +- docs/AntifraudApi.md | 44 +- docs/ApiKeyCreateResponse.md | 2 +- docs/ApiKeyResponseOnDelete.md | 38 - docs/ApiKeysApi.md | 20 +- ...Field.md => BalanceCommonFielsResponse.md} | 16 +- docs/BalanceResponse.md | 18 +- docs/BalancesApi.md | 4 +- docs/CashAgreementsResponse.md | 30 + docs/ChargeResponse.md | 3 +- docs/ChargebackFileResponse.md | 33 + docs/ChargebackResponse.md | 40 ++ docs/ChargesApi.md | 20 +- docs/ChargesDataResponse.md | 3 +- docs/ChargesOrderResponse.md | 4 +- docs/ChargesOrderResponseAllOfData.md | 46 -- docs/Checkout.md | 7 +- docs/CheckoutOrderTemplate.md | 5 +- docs/CheckoutOrderTemplateCustomerInfo.md | 35 - docs/CheckoutResponse.md | 4 +- docs/CompaniesApi.md | 101 ++- docs/CompanyDocumentRequest.md | 2 +- docs/CompanyResponse.md | 4 +- docs/CompanyResponseDocumentsInner.md | 31 - docs/CreateCustomerFiscalEntitiesResponse.md | 2 +- docs/CreateCustomerPaymentMethodsResponse.md | 3 +- ...sData.md => CreateRuleWhitelistRequest.md} | 16 +- docs/Customer.md | 4 +- docs/CustomerDetails.md | 33 + docs/CustomerFiscalEntitiesDataResponse.md | 2 +- docs/CustomerFiscalEntitiesRequest.md | 34 - docs/CustomerInfoCustomerId.md | 29 + docs/CustomerInfoJustCustomerId.md | 29 - docs/CustomerInfoJustCustomerIdResponse.md | 29 - docs/CustomerPaymentMethodRequest.md | 30 - docs/CustomerPaymentMethodsData.md | 3 +- docs/CustomerPortalResponse.md | 41 ++ docs/CustomerResponse.md | 2 +- docs/CustomerShippingContactsAddress.md | 4 +- docs/CustomerShippingContactsDataResponse.md | 2 +- ....md => CustomerShippingContactsRequest.md} | 18 +- .../CustomerShippingContactsRequestAddress.md | 36 + docs/CustomerShippingContactsResponse.md | 2 +- ...CustomerShippingContactsResponseAddress.md | 36 - docs/CustomerSubscriptionResponse.md | 47 ++ docs/CustomerUpdateFiscalEntitiesRequest.md | 34 - ... CustomerUpdateShippingContactsRequest.md} | 18 +- docs/CustomersApi.md | 52 +- docs/CustomersResponse.md | 2 +- docs/Details.md | 29 - docs/DiscountsApi.md | 20 +- docs/EventsApi.md | 22 +- docs/FiscalEntityRequest.md | 34 + ...dress.md => FiscalEntityRequestAddress.md} | 16 +- docs/GetCustomerPaymentMethodDataResponse.md | 3 +- ...ogResponse.md => LogResponseForRequest.md} | 16 +- docs/LogsApi.md | 20 +- ...sResponse.md => LogsResponseForRequest.md} | 16 +- docs/OrderChargesResponse.md | 2 + ...koutRequest.md => OrderCheckoutRequest.md} | 22 +- docs/OrderCustomerInfoResponse.md | 34 - docs/OrderDiscountLinesResponse.md | 3 + docs/OrderRequest.md | 10 +- docs/OrderResponse.md | 2 + docs/OrderResponseCheckout.md | 17 +- docs/OrderResponseCustomerInfo.md | 2 +- docs/OrderResponseShippingContact.md | 8 +- docs/OrderShippingLinesResponse.md | 34 + docs/OrderTaxLinesResponse.md | 34 + ...rderTaxResponse.md => OrderTaxResponse.md} | 16 +- .../{OrderUpdateRequest.md => OrderUpdate.md} | 26 +- docs/OrderUpdateCustomerInfo.md | 34 + docs/OrderUpdateRequestCustomerInfo.md | 34 - docs/OrdersApi.md | 50 +- docs/OrdersResponse.md | 29 - ...Request.md => OrdersUpdateTaxesRequest.md} | 16 +- docs/Page.md | 31 - docs/Pagination.md | 31 - docs/PaymentLinkApi.md | 26 +- docs/PaymentMethod.md | 30 - docs/PaymentMethodCardResponse.md | 1 + docs/PaymentMethodCashRecurrentResponse.md | 2 +- docs/PaymentMethodCashResponse.md | 2 +- ...aymentMethodCashResponseAllOfAgreements.md | 30 - docs/PaymentMethodResponse.md | 33 - ... => PaymentMethodSpeiRecurrentResponse.md} | 16 +- docs/PaymentMethodsApi.md | 26 +- .../{PayoutOrder.md => PayoutOrderRequest.md} | 19 +- docs/PayoutOrderRequestCustomerInfo.md | 30 + docs/PayoutOrderResponse.md | 4 +- docs/PayoutOrderResponseCustomerInfo.md | 2 +- docs/PayoutOrdersApi.md | 26 +- docs/PayoutOrdersResponse.md | 2 +- docs/PlansApi.md | 38 +- docs/ProductsApi.md | 12 +- ...ResendRequest.md => ResendEventRequest.md} | 16 +- docs/ShippingContactsApi.md | 32 +- docs/ShippingLinesDataResponse.md | 36 + docs/ShippingsApi.md | 12 +- docs/SubscriptionDetails.md | 39 + docs/SubscriptionDetailsCard.md | 40 ++ docs/SubscriptionDetailsPlan.md | 38 + docs/SubscriptionsApi.md | 86 +-- docs/SubscriptionsCustomerPortalApi.md | 179 +++++ docs/TaxLinesDataResponse.md | 34 + docs/TaxesApi.md | 38 +- docs/Token.md | 31 - docs/TokenRequest.md | 31 + docs/{TokenCard.md => TokenRequestCard.md} | 16 +- ...kenCheckout.md => TokenRequestCheckout.md} | 16 +- docs/TokensApi.md | 17 +- docs/TransactionsApi.md | 8 +- docs/TransfersApi.md | 8 +- docs/UpdateCustomer.md | 4 +- docs/UpdateCustomerFiscalEntitiesResponse.md | 2 +- docs/UpdateCustomerPaymentMethodsResponse.md | 3 +- docs/UpdateFiscalEntityRequest.md | 34 + ...Methods.md => UpdatePaymentMethodsCard.md} | 16 +- docs/{PlanUpdateRequest.md => UpdatePlan.md} | 16 +- ...bhookUpdateRequest.md => UpdateWebhook.md} | 16 +- ...dateRequest.md => UpdatesASubscription.md} | 16 +- docs/WebhookKeysApi.md | 20 +- docs/WebhooksApi.md | 34 +- pyproject.toml | 53 +- requirements.txt | 4 +- setup.py | 10 +- test-requirements.txt | 2 +- test/test_companies_api.py | 7 + .../test_subscriptions_customer_portal_api.py | 46 ++ 362 files changed, 7261 insertions(+), 5760 deletions(-) create mode 100644 conekta/api/subscriptions_customer_portal_api.py delete mode 100644 conekta/models/api_key_response_on_delete.py rename conekta/models/{balance_common_field.py => balance_common_fiels_response.py} (81%) rename conekta/models/{payment_method_cash_response_all_of_agreements.py => cash_agreements_response.py} (80%) create mode 100644 conekta/models/chargeback_file_response.py create mode 100644 conekta/models/chargeback_response.py delete mode 100644 conekta/models/charges_order_response_all_of_data.py delete mode 100644 conekta/models/checkout_order_template_customer_info.py delete mode 100644 conekta/models/company_response_documents_inner.py rename conekta/models/{create_risk_rules_data.py => create_rule_whitelist_request.py} (76%) rename conekta/models/{payment_method_response.py => customer_details.py} (66%) rename conekta/models/{customer_info_just_customer_id.py => customer_info_customer_id.py} (78%) delete mode 100644 conekta/models/customer_payment_method_request.py create mode 100644 conekta/models/customer_portal_response.py rename conekta/models/{customer_shipping_contacts.py => customer_shipping_contacts_request.py} (74%) rename conekta/models/{customer_shipping_contacts_response_address.py => customer_shipping_contacts_request_address.py} (59%) create mode 100644 conekta/models/customer_subscription_response.py rename conekta/models/{customer_update_shipping_contacts.py => customer_update_shipping_contacts_request.py} (73%) delete mode 100644 conekta/models/details.py rename conekta/models/{customer_fiscal_entities_request.py => fiscal_entity_request.py} (70%) rename conekta/models/{customer_address.py => fiscal_entity_request_address.py} (72%) delete mode 100644 conekta/models/log_response.py create mode 100644 conekta/models/log_response_for_request.py rename conekta/models/{logs_response.py => logs_response_for_request.py} (77%) rename conekta/models/{checkout_request.py => order_checkout_request.py} (53%) delete mode 100644 conekta/models/order_customer_info_response.py rename conekta/models/{pagination.py => order_shipping_lines_response.py} (53%) rename conekta/models/{orders_response.py => order_tax_lines_response.py} (55%) rename conekta/models/{update_order_tax_response.py => order_tax_response.py} (72%) rename conekta/models/{order_update_request.py => order_update.py} (80%) rename conekta/models/{order_update_request_customer_info.py => order_update_customer_info.py} (71%) rename conekta/models/{update_order_tax_request.py => orders_update_taxes_request.py} (77%) delete mode 100644 conekta/models/page.py delete mode 100644 conekta/models/payment_method.py rename conekta/models/{payment_method_spei_recurrent.py => payment_method_spei_recurrent_response.py} (69%) rename conekta/models/{payout_order.py => payout_order_request.py} (70%) rename conekta/models/{customer_info_just_customer_id_response.py => payout_order_request_customer_info.py} (75%) rename conekta/models/{resend_request.py => resend_event_request.py} (81%) create mode 100644 conekta/models/shipping_lines_data_response.py create mode 100644 conekta/models/subscription_details.py create mode 100644 conekta/models/subscription_details_card.py create mode 100644 conekta/models/subscription_details_plan.py create mode 100644 conekta/models/tax_lines_data_response.py rename conekta/models/{token.py => token_request.py} (67%) rename conekta/models/{token_card.py => token_request_card.py} (78%) rename conekta/models/{token_checkout.py => token_request_checkout.py} (83%) rename conekta/models/{customer_update_fiscal_entities_request.py => update_fiscal_entity_request.py} (69%) rename conekta/models/{update_payment_methods.py => update_payment_methods_card.py} (80%) rename conekta/models/{plan_update_request.py => update_plan.py} (81%) rename conekta/models/{webhook_update_request.py => update_webhook.py} (78%) rename conekta/models/{subscription_update_request.py => updates_a_subscription.py} (74%) delete mode 100644 docs/ApiKeyResponseOnDelete.md rename docs/{BalanceCommonField.md => BalanceCommonFielsResponse.md} (50%) create mode 100644 docs/CashAgreementsResponse.md create mode 100644 docs/ChargebackFileResponse.md create mode 100644 docs/ChargebackResponse.md delete mode 100644 docs/ChargesOrderResponseAllOfData.md delete mode 100644 docs/CheckoutOrderTemplateCustomerInfo.md delete mode 100644 docs/CompanyResponseDocumentsInner.md rename docs/{CreateRiskRulesData.md => CreateRuleWhitelistRequest.md} (51%) create mode 100644 docs/CustomerDetails.md delete mode 100644 docs/CustomerFiscalEntitiesRequest.md create mode 100644 docs/CustomerInfoCustomerId.md delete mode 100644 docs/CustomerInfoJustCustomerId.md delete mode 100644 docs/CustomerInfoJustCustomerIdResponse.md delete mode 100644 docs/CustomerPaymentMethodRequest.md create mode 100644 docs/CustomerPortalResponse.md rename docs/{CustomerShippingContacts.md => CustomerShippingContactsRequest.md} (60%) create mode 100644 docs/CustomerShippingContactsRequestAddress.md delete mode 100644 docs/CustomerShippingContactsResponseAddress.md create mode 100644 docs/CustomerSubscriptionResponse.md delete mode 100644 docs/CustomerUpdateFiscalEntitiesRequest.md rename docs/{CustomerUpdateShippingContacts.md => CustomerUpdateShippingContactsRequest.md} (55%) delete mode 100644 docs/Details.md create mode 100644 docs/FiscalEntityRequest.md rename docs/{CustomerAddress.md => FiscalEntityRequestAddress.md} (59%) rename docs/{LogResponse.md => LogResponseForRequest.md} (71%) rename docs/{LogsResponse.md => LogsResponseForRequest.md} (61%) rename docs/{CheckoutRequest.md => OrderCheckoutRequest.md} (52%) delete mode 100644 docs/OrderCustomerInfoResponse.md create mode 100644 docs/OrderShippingLinesResponse.md create mode 100644 docs/OrderTaxLinesResponse.md rename docs/{UpdateOrderTaxResponse.md => OrderTaxResponse.md} (59%) rename docs/{OrderUpdateRequest.md => OrderUpdate.md} (65%) create mode 100644 docs/OrderUpdateCustomerInfo.md delete mode 100644 docs/OrderUpdateRequestCustomerInfo.md delete mode 100644 docs/OrdersResponse.md rename docs/{UpdateOrderTaxRequest.md => OrdersUpdateTaxesRequest.md} (55%) delete mode 100644 docs/Page.md delete mode 100644 docs/Pagination.md delete mode 100644 docs/PaymentMethod.md delete mode 100644 docs/PaymentMethodCashResponseAllOfAgreements.md delete mode 100644 docs/PaymentMethodResponse.md rename docs/{PaymentMethodSpeiRecurrent.md => PaymentMethodSpeiRecurrentResponse.md} (51%) rename docs/{PayoutOrder.md => PayoutOrderRequest.md} (58%) create mode 100644 docs/PayoutOrderRequestCustomerInfo.md rename docs/{ResendRequest.md => ResendEventRequest.md} (52%) create mode 100644 docs/ShippingLinesDataResponse.md create mode 100644 docs/SubscriptionDetails.md create mode 100644 docs/SubscriptionDetailsCard.md create mode 100644 docs/SubscriptionDetailsPlan.md create mode 100644 docs/SubscriptionsCustomerPortalApi.md create mode 100644 docs/TaxLinesDataResponse.md delete mode 100644 docs/Token.md create mode 100644 docs/TokenRequest.md rename docs/{TokenCard.md => TokenRequestCard.md} (69%) rename docs/{TokenCheckout.md => TokenRequestCheckout.md} (52%) create mode 100644 docs/UpdateFiscalEntityRequest.md rename docs/{UpdatePaymentMethods.md => UpdatePaymentMethodsCard.md} (53%) rename docs/{PlanUpdateRequest.md => UpdatePlan.md} (67%) rename docs/{WebhookUpdateRequest.md => UpdateWebhook.md} (63%) rename docs/{SubscriptionUpdateRequest.md => UpdatesASubscription.md} (53%) create mode 100644 test/test_subscriptions_customer_portal_api.py diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index c2dea66..041dc34 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -17,9 +17,9 @@ jobs: matrix: python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v7 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v7 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -34,12 +34,12 @@ jobs: # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - name: Run Mockoon CLI - uses: mockoon/cli-action@v1 + uses: mockoon/cli-action@v3 with: - version: '6.0.1' + version: 'latest' data-file: 'https://raw.githubusercontent.com/conekta/openapi/main/mocks/conekta_api.json' port: 3000 - name: Test with pytest run: pytest env: - BASE_PATH: http://localhost:3000 \ No newline at end of file + BASE_PATH: http://localhost:3000 diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 50d4ead..f997640 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -24,6 +24,7 @@ conekta/api/products_api.py conekta/api/shipping_contacts_api.py conekta/api/shippings_api.py conekta/api/subscriptions_api.py +conekta/api/subscriptions_customer_portal_api.py conekta/api/taxes_api.py conekta/api/tokens_api.py conekta/api/transactions_api.py @@ -38,11 +39,11 @@ conekta/models/__init__.py conekta/models/api_key_create_response.py conekta/models/api_key_request.py conekta/models/api_key_response.py -conekta/models/api_key_response_on_delete.py conekta/models/api_key_update_request.py -conekta/models/balance_common_field.py +conekta/models/balance_common_fiels_response.py conekta/models/balance_response.py conekta/models/blacklist_rule_response.py +conekta/models/cash_agreements_response.py conekta/models/charge_order_response.py conekta/models/charge_order_response_payment_method.py conekta/models/charge_request.py @@ -53,19 +54,17 @@ conekta/models/charge_response_payment_method.py conekta/models/charge_response_refunds.py conekta/models/charge_response_refunds_data.py conekta/models/charge_update_request.py +conekta/models/chargeback_file_response.py +conekta/models/chargeback_response.py conekta/models/charges_data_response.py conekta/models/charges_order_response.py -conekta/models/charges_order_response_all_of_data.py conekta/models/checkout.py conekta/models/checkout_order_template.py -conekta/models/checkout_order_template_customer_info.py -conekta/models/checkout_request.py conekta/models/checkout_response.py conekta/models/checkouts_response.py conekta/models/company_document_request.py conekta/models/company_document_response.py conekta/models/company_response.py -conekta/models/company_response_documents_inner.py conekta/models/create_company_request.py conekta/models/create_company_request_bank_account_info.py conekta/models/create_company_request_comercial_info.py @@ -73,35 +72,32 @@ conekta/models/create_company_request_fiscal_info.py conekta/models/create_customer_fiscal_entities_response.py conekta/models/create_customer_payment_methods_request.py conekta/models/create_customer_payment_methods_response.py -conekta/models/create_risk_rules_data.py +conekta/models/create_rule_whitelist_request.py conekta/models/customer.py -conekta/models/customer_address.py conekta/models/customer_antifraud_info.py conekta/models/customer_antifraud_info_response.py +conekta/models/customer_details.py conekta/models/customer_fiscal_entities_data_response.py -conekta/models/customer_fiscal_entities_request.py conekta/models/customer_fiscal_entities_response.py conekta/models/customer_info.py -conekta/models/customer_info_just_customer_id.py -conekta/models/customer_info_just_customer_id_response.py -conekta/models/customer_payment_method_request.py +conekta/models/customer_info_customer_id.py conekta/models/customer_payment_methods_data.py conekta/models/customer_payment_methods_request.py conekta/models/customer_payment_methods_response.py +conekta/models/customer_portal_response.py conekta/models/customer_response.py conekta/models/customer_response_shipping_contacts.py -conekta/models/customer_shipping_contacts.py conekta/models/customer_shipping_contacts_address.py conekta/models/customer_shipping_contacts_data_response.py +conekta/models/customer_shipping_contacts_request.py +conekta/models/customer_shipping_contacts_request_address.py conekta/models/customer_shipping_contacts_response.py -conekta/models/customer_shipping_contacts_response_address.py -conekta/models/customer_update_fiscal_entities_request.py -conekta/models/customer_update_shipping_contacts.py +conekta/models/customer_subscription_response.py +conekta/models/customer_update_shipping_contacts_request.py conekta/models/customers_response.py conekta/models/delete_api_keys_response.py conekta/models/deleted_blacklist_rule_response.py conekta/models/deleted_whitelist_rule_response.py -conekta/models/details.py conekta/models/details_error.py conekta/models/discount_lines_data_response.py conekta/models/discount_lines_response.py @@ -111,6 +107,8 @@ conekta/models/event_response.py conekta/models/event_types.py conekta/models/events_resend_response.py conekta/models/fiscal_entity_address.py +conekta/models/fiscal_entity_request.py +conekta/models/fiscal_entity_request_address.py conekta/models/get_api_keys_response.py conekta/models/get_charges_response.py conekta/models/get_companies_response.py @@ -124,13 +122,13 @@ conekta/models/get_transactions_response.py conekta/models/get_transfers_response.py conekta/models/get_webhook_keys_response.py conekta/models/get_webhooks_response.py -conekta/models/log_response.py -conekta/models/logs_response.py +conekta/models/log_response_for_request.py conekta/models/logs_response_data.py +conekta/models/logs_response_for_request.py conekta/models/order_capture_request.py conekta/models/order_channel_response.py conekta/models/order_charges_response.py -conekta/models/order_customer_info_response.py +conekta/models/order_checkout_request.py conekta/models/order_discount_lines_request.py conekta/models/order_discount_lines_response.py conekta/models/order_fiscal_entity_address_response.py @@ -146,14 +144,14 @@ conekta/models/order_response_checkout.py conekta/models/order_response_customer_info.py conekta/models/order_response_products.py conekta/models/order_response_shipping_contact.py +conekta/models/order_shipping_lines_response.py +conekta/models/order_tax_lines_response.py conekta/models/order_tax_request.py +conekta/models/order_tax_response.py +conekta/models/order_update.py +conekta/models/order_update_customer_info.py conekta/models/order_update_fiscal_entity_request.py -conekta/models/order_update_request.py -conekta/models/order_update_request_customer_info.py -conekta/models/orders_response.py -conekta/models/page.py -conekta/models/pagination.py -conekta/models/payment_method.py +conekta/models/orders_update_taxes_request.py conekta/models/payment_method_bank_transfer.py conekta/models/payment_method_bnpl_payment.py conekta/models/payment_method_bnpl_request.py @@ -164,40 +162,42 @@ conekta/models/payment_method_cash.py conekta/models/payment_method_cash_recurrent_response.py conekta/models/payment_method_cash_request.py conekta/models/payment_method_cash_response.py -conekta/models/payment_method_cash_response_all_of_agreements.py conekta/models/payment_method_general_request.py conekta/models/payment_method_pbb_payment.py conekta/models/payment_method_pbb_request.py -conekta/models/payment_method_response.py -conekta/models/payment_method_spei_recurrent.py +conekta/models/payment_method_spei_recurrent_response.py conekta/models/payment_method_spei_request.py conekta/models/payment_method_token_request.py conekta/models/payout.py conekta/models/payout_method.py -conekta/models/payout_order.py conekta/models/payout_order_payouts_item.py +conekta/models/payout_order_request.py +conekta/models/payout_order_request_customer_info.py conekta/models/payout_order_response.py conekta/models/payout_order_response_customer_info.py conekta/models/payout_orders_response.py conekta/models/plan_request.py conekta/models/plan_response.py -conekta/models/plan_update_request.py conekta/models/product.py conekta/models/product_data_response.py conekta/models/product_order_response.py -conekta/models/resend_request.py +conekta/models/resend_event_request.py conekta/models/risk_rules_data.py conekta/models/risk_rules_list.py +conekta/models/shipping_lines_data_response.py conekta/models/shipping_order_response.py conekta/models/shipping_request.py conekta/models/sms_checkout_request.py +conekta/models/subscription_details.py +conekta/models/subscription_details_card.py +conekta/models/subscription_details_plan.py conekta/models/subscription_events_response.py conekta/models/subscription_request.py conekta/models/subscription_response.py -conekta/models/subscription_update_request.py -conekta/models/token.py -conekta/models/token_card.py -conekta/models/token_checkout.py +conekta/models/tax_lines_data_response.py +conekta/models/token_request.py +conekta/models/token_request_card.py +conekta/models/token_request_checkout.py conekta/models/token_response.py conekta/models/token_response_checkout.py conekta/models/transaction_response.py @@ -209,11 +209,13 @@ conekta/models/update_customer.py conekta/models/update_customer_antifraud_info.py conekta/models/update_customer_fiscal_entities_response.py conekta/models/update_customer_payment_methods_response.py +conekta/models/update_fiscal_entity_request.py conekta/models/update_order_discount_lines_request.py -conekta/models/update_order_tax_request.py -conekta/models/update_order_tax_response.py -conekta/models/update_payment_methods.py +conekta/models/update_payment_methods_card.py +conekta/models/update_plan.py conekta/models/update_product.py +conekta/models/update_webhook.py +conekta/models/updates_a_subscription.py conekta/models/webhook_key_create_response.py conekta/models/webhook_key_delete_response.py conekta/models/webhook_key_request.py @@ -222,7 +224,6 @@ conekta/models/webhook_key_update_request.py conekta/models/webhook_log.py conekta/models/webhook_request.py conekta/models/webhook_response.py -conekta/models/webhook_update_request.py conekta/models/whitelistlist_rule_response.py conekta/py.typed conekta/rest.py @@ -230,13 +231,13 @@ docs/AntifraudApi.md docs/ApiKeyCreateResponse.md docs/ApiKeyRequest.md docs/ApiKeyResponse.md -docs/ApiKeyResponseOnDelete.md docs/ApiKeyUpdateRequest.md docs/ApiKeysApi.md -docs/BalanceCommonField.md +docs/BalanceCommonFielsResponse.md docs/BalanceResponse.md docs/BalancesApi.md docs/BlacklistRuleResponse.md +docs/CashAgreementsResponse.md docs/ChargeOrderResponse.md docs/ChargeOrderResponsePaymentMethod.md docs/ChargeRequest.md @@ -247,21 +248,19 @@ docs/ChargeResponsePaymentMethod.md docs/ChargeResponseRefunds.md docs/ChargeResponseRefundsData.md docs/ChargeUpdateRequest.md +docs/ChargebackFileResponse.md +docs/ChargebackResponse.md docs/ChargesApi.md docs/ChargesDataResponse.md docs/ChargesOrderResponse.md -docs/ChargesOrderResponseAllOfData.md docs/Checkout.md docs/CheckoutOrderTemplate.md -docs/CheckoutOrderTemplateCustomerInfo.md -docs/CheckoutRequest.md docs/CheckoutResponse.md docs/CheckoutsResponse.md docs/CompaniesApi.md docs/CompanyDocumentRequest.md docs/CompanyDocumentResponse.md docs/CompanyResponse.md -docs/CompanyResponseDocumentsInner.md docs/CreateCompanyRequest.md docs/CreateCompanyRequestBankAccountInfo.md docs/CreateCompanyRequestComercialInfo.md @@ -269,36 +268,33 @@ docs/CreateCompanyRequestFiscalInfo.md docs/CreateCustomerFiscalEntitiesResponse.md docs/CreateCustomerPaymentMethodsRequest.md docs/CreateCustomerPaymentMethodsResponse.md -docs/CreateRiskRulesData.md +docs/CreateRuleWhitelistRequest.md docs/Customer.md -docs/CustomerAddress.md docs/CustomerAntifraudInfo.md docs/CustomerAntifraudInfoResponse.md +docs/CustomerDetails.md docs/CustomerFiscalEntitiesDataResponse.md -docs/CustomerFiscalEntitiesRequest.md docs/CustomerFiscalEntitiesResponse.md docs/CustomerInfo.md -docs/CustomerInfoJustCustomerId.md -docs/CustomerInfoJustCustomerIdResponse.md -docs/CustomerPaymentMethodRequest.md +docs/CustomerInfoCustomerId.md docs/CustomerPaymentMethodsData.md docs/CustomerPaymentMethodsRequest.md docs/CustomerPaymentMethodsResponse.md +docs/CustomerPortalResponse.md docs/CustomerResponse.md docs/CustomerResponseShippingContacts.md -docs/CustomerShippingContacts.md docs/CustomerShippingContactsAddress.md docs/CustomerShippingContactsDataResponse.md +docs/CustomerShippingContactsRequest.md +docs/CustomerShippingContactsRequestAddress.md docs/CustomerShippingContactsResponse.md -docs/CustomerShippingContactsResponseAddress.md -docs/CustomerUpdateFiscalEntitiesRequest.md -docs/CustomerUpdateShippingContacts.md +docs/CustomerSubscriptionResponse.md +docs/CustomerUpdateShippingContactsRequest.md docs/CustomersApi.md docs/CustomersResponse.md docs/DeleteApiKeysResponse.md docs/DeletedBlacklistRuleResponse.md docs/DeletedWhitelistRuleResponse.md -docs/Details.md docs/DetailsError.md docs/DiscountLinesDataResponse.md docs/DiscountLinesResponse.md @@ -310,6 +306,8 @@ docs/EventTypes.md docs/EventsApi.md docs/EventsResendResponse.md docs/FiscalEntityAddress.md +docs/FiscalEntityRequest.md +docs/FiscalEntityRequestAddress.md docs/GetApiKeysResponse.md docs/GetChargesResponse.md docs/GetCompaniesResponse.md @@ -323,14 +321,14 @@ docs/GetTransactionsResponse.md docs/GetTransfersResponse.md docs/GetWebhookKeysResponse.md docs/GetWebhooksResponse.md -docs/LogResponse.md +docs/LogResponseForRequest.md docs/LogsApi.md -docs/LogsResponse.md docs/LogsResponseData.md +docs/LogsResponseForRequest.md docs/OrderCaptureRequest.md docs/OrderChannelResponse.md docs/OrderChargesResponse.md -docs/OrderCustomerInfoResponse.md +docs/OrderCheckoutRequest.md docs/OrderDiscountLinesRequest.md docs/OrderDiscountLinesResponse.md docs/OrderFiscalEntityAddressResponse.md @@ -346,16 +344,16 @@ docs/OrderResponseCheckout.md docs/OrderResponseCustomerInfo.md docs/OrderResponseProducts.md docs/OrderResponseShippingContact.md +docs/OrderShippingLinesResponse.md +docs/OrderTaxLinesResponse.md docs/OrderTaxRequest.md +docs/OrderTaxResponse.md +docs/OrderUpdate.md +docs/OrderUpdateCustomerInfo.md docs/OrderUpdateFiscalEntityRequest.md -docs/OrderUpdateRequest.md -docs/OrderUpdateRequestCustomerInfo.md docs/OrdersApi.md -docs/OrdersResponse.md -docs/Page.md -docs/Pagination.md +docs/OrdersUpdateTaxesRequest.md docs/PaymentLinkApi.md -docs/PaymentMethod.md docs/PaymentMethodBankTransfer.md docs/PaymentMethodBnplPayment.md docs/PaymentMethodBnplRequest.md @@ -366,48 +364,51 @@ docs/PaymentMethodCash.md docs/PaymentMethodCashRecurrentResponse.md docs/PaymentMethodCashRequest.md docs/PaymentMethodCashResponse.md -docs/PaymentMethodCashResponseAllOfAgreements.md docs/PaymentMethodGeneralRequest.md docs/PaymentMethodPbbPayment.md docs/PaymentMethodPbbRequest.md -docs/PaymentMethodResponse.md -docs/PaymentMethodSpeiRecurrent.md +docs/PaymentMethodSpeiRecurrentResponse.md docs/PaymentMethodSpeiRequest.md docs/PaymentMethodTokenRequest.md docs/PaymentMethodsApi.md docs/Payout.md docs/PayoutMethod.md -docs/PayoutOrder.md docs/PayoutOrderPayoutsItem.md +docs/PayoutOrderRequest.md +docs/PayoutOrderRequestCustomerInfo.md docs/PayoutOrderResponse.md docs/PayoutOrderResponseCustomerInfo.md docs/PayoutOrdersApi.md docs/PayoutOrdersResponse.md docs/PlanRequest.md docs/PlanResponse.md -docs/PlanUpdateRequest.md docs/PlansApi.md docs/Product.md docs/ProductDataResponse.md docs/ProductOrderResponse.md docs/ProductsApi.md -docs/ResendRequest.md +docs/ResendEventRequest.md docs/RiskRulesData.md docs/RiskRulesList.md docs/ShippingContactsApi.md +docs/ShippingLinesDataResponse.md docs/ShippingOrderResponse.md docs/ShippingRequest.md docs/ShippingsApi.md docs/SmsCheckoutRequest.md +docs/SubscriptionDetails.md +docs/SubscriptionDetailsCard.md +docs/SubscriptionDetailsPlan.md docs/SubscriptionEventsResponse.md docs/SubscriptionRequest.md docs/SubscriptionResponse.md -docs/SubscriptionUpdateRequest.md docs/SubscriptionsApi.md +docs/SubscriptionsCustomerPortalApi.md +docs/TaxLinesDataResponse.md docs/TaxesApi.md -docs/Token.md -docs/TokenCard.md -docs/TokenCheckout.md +docs/TokenRequest.md +docs/TokenRequestCard.md +docs/TokenRequestCheckout.md docs/TokenResponse.md docs/TokenResponseCheckout.md docs/TokensApi.md @@ -422,11 +423,13 @@ docs/UpdateCustomer.md docs/UpdateCustomerAntifraudInfo.md docs/UpdateCustomerFiscalEntitiesResponse.md docs/UpdateCustomerPaymentMethodsResponse.md +docs/UpdateFiscalEntityRequest.md docs/UpdateOrderDiscountLinesRequest.md -docs/UpdateOrderTaxRequest.md -docs/UpdateOrderTaxResponse.md -docs/UpdatePaymentMethods.md +docs/UpdatePaymentMethodsCard.md +docs/UpdatePlan.md docs/UpdateProduct.md +docs/UpdateWebhook.md +docs/UpdatesASubscription.md docs/WebhookKeyCreateResponse.md docs/WebhookKeyDeleteResponse.md docs/WebhookKeyRequest.md @@ -436,7 +439,6 @@ docs/WebhookKeysApi.md docs/WebhookLog.md docs/WebhookRequest.md docs/WebhookResponse.md -docs/WebhookUpdateRequest.md docs/WebhooksApi.md docs/WhitelistlistRuleResponse.md pyproject.toml @@ -463,6 +465,7 @@ test/test_products_api.py test/test_shipping_contacts_api.py test/test_shippings_api.py test/test_subscriptions_api.py +test/test_subscriptions_customer_portal_api.py test/test_taxes_api.py test/test_tokens_api.py test/test_transactions_api.py diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 4bc5d61..0783219 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.9.0 +7.24.0 diff --git a/Makefile b/Makefile index 575ae52..7ed742b 100644 --- a/Makefile +++ b/Makefile @@ -7,8 +7,9 @@ clean: python: rm -rf docs && rm -rf test && \ rm -rf conekta/models && \ + rm -rf conekta/api && \ docker run --rm \ - -v ${PWD}:/local openapitools/openapi-generator-cli:v7.9.0 generate \ + -v ${PWD}:/local openapitools/openapi-generator-cli:v7.24.0 generate \ -i https://raw.githubusercontent.com/conekta/openapi/main/_build/api.yaml \ -g python \ -o /local \ diff --git a/README.md b/README.md index f58c369..352ad29 100644 --- a/README.md +++ b/README.md @@ -4,14 +4,14 @@ Conekta sdk This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: - API version: 2.2.0 -- Package version: 7.0.3 -- Generator version: 7.9.0 +- Package version: 7.1.0 +- Generator version: 7.24.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit [https://github.com/conekta/openapi/issues](https://github.com/conekta/openapi/issues) ## Requirements. -Python 3.7+ +Python 3.10+ ## Installation & Usage ### pip install @@ -115,6 +115,7 @@ Class | Method | HTTP request | Description *CompaniesApi* | [**get_companies**](docs/CompaniesApi.md#get_companies) | **GET** /companies | Get List of Companies *CompaniesApi* | [**get_company**](docs/CompaniesApi.md#get_company) | **GET** /companies/{id} | Get Company *CompaniesApi* | [**get_company_documents**](docs/CompaniesApi.md#get_company_documents) | **GET** /companies/{company_id}/documents | Get Company Documents +*CompaniesApi* | [**get_current_company**](docs/CompaniesApi.md#get_current_company) | **GET** /companies/current | Get Current Company *CompaniesApi* | [**update_company_document**](docs/CompaniesApi.md#update_company_document) | **PATCH** /companies/{company_id}/document | Update Company Document *CompaniesApi* | [**upload_company_document**](docs/CompaniesApi.md#upload_company_document) | **POST** /companies/{company_id}/document | Upload Company Document *CustomersApi* | [**create_customer**](docs/CustomersApi.md#create_customer) | **POST** /customers | Create customer @@ -186,6 +187,8 @@ Class | Method | HTTP request | Description *SubscriptionsApi* | [**subscriptions_get**](docs/SubscriptionsApi.md#subscriptions_get) | **GET** /customers/{customer_id}/subscriptions/{id} | Get Subscription *SubscriptionsApi* | [**subscriptions_retry**](docs/SubscriptionsApi.md#subscriptions_retry) | **POST** /customers/{customer_id}/subscriptions/{id}/retry | Retry Failed Payment *SubscriptionsApi* | [**update_subscription**](docs/SubscriptionsApi.md#update_subscription) | **PUT** /customers/{id}/subscription | Update Subscription [Deprecated] +*SubscriptionsCustomerPortalApi* | [**create_customer_portal**](docs/SubscriptionsCustomerPortalApi.md#create_customer_portal) | **POST** /subscriptions/{subscription_id}/customer_portal | Create customer portal +*SubscriptionsCustomerPortalApi* | [**get_customer_portal**](docs/SubscriptionsCustomerPortalApi.md#get_customer_portal) | **GET** /subscriptions/{subscription_id}/customer_portal | Get customer portal *TaxesApi* | [**orders_create_taxes**](docs/TaxesApi.md#orders_create_taxes) | **POST** /orders/{id}/tax_lines | Create Tax *TaxesApi* | [**orders_delete_taxes**](docs/TaxesApi.md#orders_delete_taxes) | **DELETE** /orders/{id}/tax_lines/{tax_id} | Delete Tax *TaxesApi* | [**orders_update_taxes**](docs/TaxesApi.md#orders_update_taxes) | **PUT** /orders/{id}/tax_lines/{tax_id} | Update Tax @@ -212,11 +215,11 @@ Class | Method | HTTP request | Description - [ApiKeyCreateResponse](docs/ApiKeyCreateResponse.md) - [ApiKeyRequest](docs/ApiKeyRequest.md) - [ApiKeyResponse](docs/ApiKeyResponse.md) - - [ApiKeyResponseOnDelete](docs/ApiKeyResponseOnDelete.md) - [ApiKeyUpdateRequest](docs/ApiKeyUpdateRequest.md) - - [BalanceCommonField](docs/BalanceCommonField.md) + - [BalanceCommonFielsResponse](docs/BalanceCommonFielsResponse.md) - [BalanceResponse](docs/BalanceResponse.md) - [BlacklistRuleResponse](docs/BlacklistRuleResponse.md) + - [CashAgreementsResponse](docs/CashAgreementsResponse.md) - [ChargeOrderResponse](docs/ChargeOrderResponse.md) - [ChargeOrderResponsePaymentMethod](docs/ChargeOrderResponsePaymentMethod.md) - [ChargeRequest](docs/ChargeRequest.md) @@ -227,19 +230,17 @@ Class | Method | HTTP request | Description - [ChargeResponseRefunds](docs/ChargeResponseRefunds.md) - [ChargeResponseRefundsData](docs/ChargeResponseRefundsData.md) - [ChargeUpdateRequest](docs/ChargeUpdateRequest.md) + - [ChargebackFileResponse](docs/ChargebackFileResponse.md) + - [ChargebackResponse](docs/ChargebackResponse.md) - [ChargesDataResponse](docs/ChargesDataResponse.md) - [ChargesOrderResponse](docs/ChargesOrderResponse.md) - - [ChargesOrderResponseAllOfData](docs/ChargesOrderResponseAllOfData.md) - [Checkout](docs/Checkout.md) - [CheckoutOrderTemplate](docs/CheckoutOrderTemplate.md) - - [CheckoutOrderTemplateCustomerInfo](docs/CheckoutOrderTemplateCustomerInfo.md) - - [CheckoutRequest](docs/CheckoutRequest.md) - [CheckoutResponse](docs/CheckoutResponse.md) - [CheckoutsResponse](docs/CheckoutsResponse.md) - [CompanyDocumentRequest](docs/CompanyDocumentRequest.md) - [CompanyDocumentResponse](docs/CompanyDocumentResponse.md) - [CompanyResponse](docs/CompanyResponse.md) - - [CompanyResponseDocumentsInner](docs/CompanyResponseDocumentsInner.md) - [CreateCompanyRequest](docs/CreateCompanyRequest.md) - [CreateCompanyRequestBankAccountInfo](docs/CreateCompanyRequestBankAccountInfo.md) - [CreateCompanyRequestComercialInfo](docs/CreateCompanyRequestComercialInfo.md) @@ -247,35 +248,32 @@ Class | Method | HTTP request | Description - [CreateCustomerFiscalEntitiesResponse](docs/CreateCustomerFiscalEntitiesResponse.md) - [CreateCustomerPaymentMethodsRequest](docs/CreateCustomerPaymentMethodsRequest.md) - [CreateCustomerPaymentMethodsResponse](docs/CreateCustomerPaymentMethodsResponse.md) - - [CreateRiskRulesData](docs/CreateRiskRulesData.md) + - [CreateRuleWhitelistRequest](docs/CreateRuleWhitelistRequest.md) - [Customer](docs/Customer.md) - - [CustomerAddress](docs/CustomerAddress.md) - [CustomerAntifraudInfo](docs/CustomerAntifraudInfo.md) - [CustomerAntifraudInfoResponse](docs/CustomerAntifraudInfoResponse.md) + - [CustomerDetails](docs/CustomerDetails.md) - [CustomerFiscalEntitiesDataResponse](docs/CustomerFiscalEntitiesDataResponse.md) - - [CustomerFiscalEntitiesRequest](docs/CustomerFiscalEntitiesRequest.md) - [CustomerFiscalEntitiesResponse](docs/CustomerFiscalEntitiesResponse.md) - [CustomerInfo](docs/CustomerInfo.md) - - [CustomerInfoJustCustomerId](docs/CustomerInfoJustCustomerId.md) - - [CustomerInfoJustCustomerIdResponse](docs/CustomerInfoJustCustomerIdResponse.md) - - [CustomerPaymentMethodRequest](docs/CustomerPaymentMethodRequest.md) + - [CustomerInfoCustomerId](docs/CustomerInfoCustomerId.md) - [CustomerPaymentMethodsData](docs/CustomerPaymentMethodsData.md) - [CustomerPaymentMethodsRequest](docs/CustomerPaymentMethodsRequest.md) - [CustomerPaymentMethodsResponse](docs/CustomerPaymentMethodsResponse.md) + - [CustomerPortalResponse](docs/CustomerPortalResponse.md) - [CustomerResponse](docs/CustomerResponse.md) - [CustomerResponseShippingContacts](docs/CustomerResponseShippingContacts.md) - - [CustomerShippingContacts](docs/CustomerShippingContacts.md) - [CustomerShippingContactsAddress](docs/CustomerShippingContactsAddress.md) - [CustomerShippingContactsDataResponse](docs/CustomerShippingContactsDataResponse.md) + - [CustomerShippingContactsRequest](docs/CustomerShippingContactsRequest.md) + - [CustomerShippingContactsRequestAddress](docs/CustomerShippingContactsRequestAddress.md) - [CustomerShippingContactsResponse](docs/CustomerShippingContactsResponse.md) - - [CustomerShippingContactsResponseAddress](docs/CustomerShippingContactsResponseAddress.md) - - [CustomerUpdateFiscalEntitiesRequest](docs/CustomerUpdateFiscalEntitiesRequest.md) - - [CustomerUpdateShippingContacts](docs/CustomerUpdateShippingContacts.md) + - [CustomerSubscriptionResponse](docs/CustomerSubscriptionResponse.md) + - [CustomerUpdateShippingContactsRequest](docs/CustomerUpdateShippingContactsRequest.md) - [CustomersResponse](docs/CustomersResponse.md) - [DeleteApiKeysResponse](docs/DeleteApiKeysResponse.md) - [DeletedBlacklistRuleResponse](docs/DeletedBlacklistRuleResponse.md) - [DeletedWhitelistRuleResponse](docs/DeletedWhitelistRuleResponse.md) - - [Details](docs/Details.md) - [DetailsError](docs/DetailsError.md) - [DiscountLinesDataResponse](docs/DiscountLinesDataResponse.md) - [DiscountLinesResponse](docs/DiscountLinesResponse.md) @@ -285,6 +283,8 @@ Class | Method | HTTP request | Description - [EventTypes](docs/EventTypes.md) - [EventsResendResponse](docs/EventsResendResponse.md) - [FiscalEntityAddress](docs/FiscalEntityAddress.md) + - [FiscalEntityRequest](docs/FiscalEntityRequest.md) + - [FiscalEntityRequestAddress](docs/FiscalEntityRequestAddress.md) - [GetApiKeysResponse](docs/GetApiKeysResponse.md) - [GetChargesResponse](docs/GetChargesResponse.md) - [GetCompaniesResponse](docs/GetCompaniesResponse.md) @@ -298,13 +298,13 @@ Class | Method | HTTP request | Description - [GetTransfersResponse](docs/GetTransfersResponse.md) - [GetWebhookKeysResponse](docs/GetWebhookKeysResponse.md) - [GetWebhooksResponse](docs/GetWebhooksResponse.md) - - [LogResponse](docs/LogResponse.md) - - [LogsResponse](docs/LogsResponse.md) + - [LogResponseForRequest](docs/LogResponseForRequest.md) - [LogsResponseData](docs/LogsResponseData.md) + - [LogsResponseForRequest](docs/LogsResponseForRequest.md) - [OrderCaptureRequest](docs/OrderCaptureRequest.md) - [OrderChannelResponse](docs/OrderChannelResponse.md) - [OrderChargesResponse](docs/OrderChargesResponse.md) - - [OrderCustomerInfoResponse](docs/OrderCustomerInfoResponse.md) + - [OrderCheckoutRequest](docs/OrderCheckoutRequest.md) - [OrderDiscountLinesRequest](docs/OrderDiscountLinesRequest.md) - [OrderDiscountLinesResponse](docs/OrderDiscountLinesResponse.md) - [OrderFiscalEntityAddressResponse](docs/OrderFiscalEntityAddressResponse.md) @@ -320,14 +320,14 @@ Class | Method | HTTP request | Description - [OrderResponseCustomerInfo](docs/OrderResponseCustomerInfo.md) - [OrderResponseProducts](docs/OrderResponseProducts.md) - [OrderResponseShippingContact](docs/OrderResponseShippingContact.md) + - [OrderShippingLinesResponse](docs/OrderShippingLinesResponse.md) + - [OrderTaxLinesResponse](docs/OrderTaxLinesResponse.md) - [OrderTaxRequest](docs/OrderTaxRequest.md) + - [OrderTaxResponse](docs/OrderTaxResponse.md) + - [OrderUpdate](docs/OrderUpdate.md) + - [OrderUpdateCustomerInfo](docs/OrderUpdateCustomerInfo.md) - [OrderUpdateFiscalEntityRequest](docs/OrderUpdateFiscalEntityRequest.md) - - [OrderUpdateRequest](docs/OrderUpdateRequest.md) - - [OrderUpdateRequestCustomerInfo](docs/OrderUpdateRequestCustomerInfo.md) - - [OrdersResponse](docs/OrdersResponse.md) - - [Page](docs/Page.md) - - [Pagination](docs/Pagination.md) - - [PaymentMethod](docs/PaymentMethod.md) + - [OrdersUpdateTaxesRequest](docs/OrdersUpdateTaxesRequest.md) - [PaymentMethodBankTransfer](docs/PaymentMethodBankTransfer.md) - [PaymentMethodBnplPayment](docs/PaymentMethodBnplPayment.md) - [PaymentMethodBnplRequest](docs/PaymentMethodBnplRequest.md) @@ -338,40 +338,42 @@ Class | Method | HTTP request | Description - [PaymentMethodCashRecurrentResponse](docs/PaymentMethodCashRecurrentResponse.md) - [PaymentMethodCashRequest](docs/PaymentMethodCashRequest.md) - [PaymentMethodCashResponse](docs/PaymentMethodCashResponse.md) - - [PaymentMethodCashResponseAllOfAgreements](docs/PaymentMethodCashResponseAllOfAgreements.md) - [PaymentMethodGeneralRequest](docs/PaymentMethodGeneralRequest.md) - [PaymentMethodPbbPayment](docs/PaymentMethodPbbPayment.md) - [PaymentMethodPbbRequest](docs/PaymentMethodPbbRequest.md) - - [PaymentMethodResponse](docs/PaymentMethodResponse.md) - - [PaymentMethodSpeiRecurrent](docs/PaymentMethodSpeiRecurrent.md) + - [PaymentMethodSpeiRecurrentResponse](docs/PaymentMethodSpeiRecurrentResponse.md) - [PaymentMethodSpeiRequest](docs/PaymentMethodSpeiRequest.md) - [PaymentMethodTokenRequest](docs/PaymentMethodTokenRequest.md) - [Payout](docs/Payout.md) - [PayoutMethod](docs/PayoutMethod.md) - - [PayoutOrder](docs/PayoutOrder.md) - [PayoutOrderPayoutsItem](docs/PayoutOrderPayoutsItem.md) + - [PayoutOrderRequest](docs/PayoutOrderRequest.md) + - [PayoutOrderRequestCustomerInfo](docs/PayoutOrderRequestCustomerInfo.md) - [PayoutOrderResponse](docs/PayoutOrderResponse.md) - [PayoutOrderResponseCustomerInfo](docs/PayoutOrderResponseCustomerInfo.md) - [PayoutOrdersResponse](docs/PayoutOrdersResponse.md) - [PlanRequest](docs/PlanRequest.md) - [PlanResponse](docs/PlanResponse.md) - - [PlanUpdateRequest](docs/PlanUpdateRequest.md) - [Product](docs/Product.md) - [ProductDataResponse](docs/ProductDataResponse.md) - [ProductOrderResponse](docs/ProductOrderResponse.md) - - [ResendRequest](docs/ResendRequest.md) + - [ResendEventRequest](docs/ResendEventRequest.md) - [RiskRulesData](docs/RiskRulesData.md) - [RiskRulesList](docs/RiskRulesList.md) + - [ShippingLinesDataResponse](docs/ShippingLinesDataResponse.md) - [ShippingOrderResponse](docs/ShippingOrderResponse.md) - [ShippingRequest](docs/ShippingRequest.md) - [SmsCheckoutRequest](docs/SmsCheckoutRequest.md) + - [SubscriptionDetails](docs/SubscriptionDetails.md) + - [SubscriptionDetailsCard](docs/SubscriptionDetailsCard.md) + - [SubscriptionDetailsPlan](docs/SubscriptionDetailsPlan.md) - [SubscriptionEventsResponse](docs/SubscriptionEventsResponse.md) - [SubscriptionRequest](docs/SubscriptionRequest.md) - [SubscriptionResponse](docs/SubscriptionResponse.md) - - [SubscriptionUpdateRequest](docs/SubscriptionUpdateRequest.md) - - [Token](docs/Token.md) - - [TokenCard](docs/TokenCard.md) - - [TokenCheckout](docs/TokenCheckout.md) + - [TaxLinesDataResponse](docs/TaxLinesDataResponse.md) + - [TokenRequest](docs/TokenRequest.md) + - [TokenRequestCard](docs/TokenRequestCard.md) + - [TokenRequestCheckout](docs/TokenRequestCheckout.md) - [TokenResponse](docs/TokenResponse.md) - [TokenResponseCheckout](docs/TokenResponseCheckout.md) - [TransactionResponse](docs/TransactionResponse.md) @@ -383,11 +385,13 @@ Class | Method | HTTP request | Description - [UpdateCustomerAntifraudInfo](docs/UpdateCustomerAntifraudInfo.md) - [UpdateCustomerFiscalEntitiesResponse](docs/UpdateCustomerFiscalEntitiesResponse.md) - [UpdateCustomerPaymentMethodsResponse](docs/UpdateCustomerPaymentMethodsResponse.md) + - [UpdateFiscalEntityRequest](docs/UpdateFiscalEntityRequest.md) - [UpdateOrderDiscountLinesRequest](docs/UpdateOrderDiscountLinesRequest.md) - - [UpdateOrderTaxRequest](docs/UpdateOrderTaxRequest.md) - - [UpdateOrderTaxResponse](docs/UpdateOrderTaxResponse.md) - - [UpdatePaymentMethods](docs/UpdatePaymentMethods.md) + - [UpdatePaymentMethodsCard](docs/UpdatePaymentMethodsCard.md) + - [UpdatePlan](docs/UpdatePlan.md) - [UpdateProduct](docs/UpdateProduct.md) + - [UpdateWebhook](docs/UpdateWebhook.md) + - [UpdatesASubscription](docs/UpdatesASubscription.md) - [WebhookKeyCreateResponse](docs/WebhookKeyCreateResponse.md) - [WebhookKeyDeleteResponse](docs/WebhookKeyDeleteResponse.md) - [WebhookKeyRequest](docs/WebhookKeyRequest.md) @@ -396,7 +400,6 @@ Class | Method | HTTP request | Description - [WebhookLog](docs/WebhookLog.md) - [WebhookRequest](docs/WebhookRequest.md) - [WebhookResponse](docs/WebhookResponse.md) - - [WebhookUpdateRequest](docs/WebhookUpdateRequest.md) - [WhitelistlistRuleResponse](docs/WhitelistlistRuleResponse.md) diff --git a/VERSION b/VERSION index a50da18..a3fcc71 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.0.3 +7.1.0 diff --git a/conekta/__init__.py b/conekta/__init__.py index e36c1a2..3862538 100644 --- a/conekta/__init__.py +++ b/conekta/__init__.py @@ -15,232 +15,461 @@ """ # noqa: E501 -__version__ = "7.0.3" +__version__ = "7.1.0" + +# Define package exports +__all__ = [ + "AntifraudApi", + "ApiKeysApi", + "BalancesApi", + "ChargesApi", + "CompaniesApi", + "CustomersApi", + "DiscountsApi", + "EventsApi", + "LogsApi", + "OrdersApi", + "PaymentLinkApi", + "PaymentMethodsApi", + "PayoutOrdersApi", + "PlansApi", + "ProductsApi", + "ShippingContactsApi", + "ShippingsApi", + "SubscriptionsApi", + "SubscriptionsCustomerPortalApi", + "TaxesApi", + "TokensApi", + "TransactionsApi", + "TransfersApi", + "WebhookKeysApi", + "WebhooksApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "ApiKeyCreateResponse", + "ApiKeyRequest", + "ApiKeyResponse", + "ApiKeyUpdateRequest", + "BalanceCommonFielsResponse", + "BalanceResponse", + "BlacklistRuleResponse", + "CashAgreementsResponse", + "ChargeOrderResponse", + "ChargeOrderResponsePaymentMethod", + "ChargeRequest", + "ChargeRequestPaymentMethod", + "ChargeResponse", + "ChargeResponseChannel", + "ChargeResponsePaymentMethod", + "ChargeResponseRefunds", + "ChargeResponseRefundsData", + "ChargeUpdateRequest", + "ChargebackFileResponse", + "ChargebackResponse", + "ChargesDataResponse", + "ChargesOrderResponse", + "Checkout", + "CheckoutOrderTemplate", + "CheckoutResponse", + "CheckoutsResponse", + "CompanyDocumentRequest", + "CompanyDocumentResponse", + "CompanyResponse", + "CreateCompanyRequest", + "CreateCompanyRequestBankAccountInfo", + "CreateCompanyRequestComercialInfo", + "CreateCompanyRequestFiscalInfo", + "CreateCustomerFiscalEntitiesResponse", + "CreateCustomerPaymentMethodsRequest", + "CreateCustomerPaymentMethodsResponse", + "CreateRuleWhitelistRequest", + "Customer", + "CustomerAntifraudInfo", + "CustomerAntifraudInfoResponse", + "CustomerDetails", + "CustomerFiscalEntitiesDataResponse", + "CustomerFiscalEntitiesResponse", + "CustomerInfo", + "CustomerInfoCustomerId", + "CustomerPaymentMethodsData", + "CustomerPaymentMethodsRequest", + "CustomerPaymentMethodsResponse", + "CustomerPortalResponse", + "CustomerResponse", + "CustomerResponseShippingContacts", + "CustomerShippingContactsAddress", + "CustomerShippingContactsDataResponse", + "CustomerShippingContactsRequest", + "CustomerShippingContactsRequestAddress", + "CustomerShippingContactsResponse", + "CustomerSubscriptionResponse", + "CustomerUpdateShippingContactsRequest", + "CustomersResponse", + "DeleteApiKeysResponse", + "DeletedBlacklistRuleResponse", + "DeletedWhitelistRuleResponse", + "DetailsError", + "DiscountLinesDataResponse", + "DiscountLinesResponse", + "EmailCheckoutRequest", + "Error", + "EventResponse", + "EventTypes", + "EventsResendResponse", + "FiscalEntityAddress", + "FiscalEntityRequest", + "FiscalEntityRequestAddress", + "GetApiKeysResponse", + "GetChargesResponse", + "GetCompaniesResponse", + "GetCustomerPaymentMethodDataResponse", + "GetEventsResponse", + "GetOrderDiscountLinesResponse", + "GetOrdersResponse", + "GetPaymentMethodResponse", + "GetPlansResponse", + "GetTransactionsResponse", + "GetTransfersResponse", + "GetWebhookKeysResponse", + "GetWebhooksResponse", + "LogResponseForRequest", + "LogsResponseData", + "LogsResponseForRequest", + "OrderCaptureRequest", + "OrderChannelResponse", + "OrderChargesResponse", + "OrderCheckoutRequest", + "OrderDiscountLinesRequest", + "OrderDiscountLinesResponse", + "OrderFiscalEntityAddressResponse", + "OrderFiscalEntityRequest", + "OrderFiscalEntityResponse", + "OrderNextActionResponse", + "OrderNextActionResponseRedirectToUrl", + "OrderRefundRequest", + "OrderRequest", + "OrderRequestCustomerInfo", + "OrderResponse", + "OrderResponseCheckout", + "OrderResponseCustomerInfo", + "OrderResponseProducts", + "OrderResponseShippingContact", + "OrderShippingLinesResponse", + "OrderTaxLinesResponse", + "OrderTaxRequest", + "OrderTaxResponse", + "OrderUpdate", + "OrderUpdateCustomerInfo", + "OrderUpdateFiscalEntityRequest", + "OrdersUpdateTaxesRequest", + "PaymentMethodBankTransfer", + "PaymentMethodBnplPayment", + "PaymentMethodBnplRequest", + "PaymentMethodCard", + "PaymentMethodCardRequest", + "PaymentMethodCardResponse", + "PaymentMethodCash", + "PaymentMethodCashRecurrentResponse", + "PaymentMethodCashRequest", + "PaymentMethodCashResponse", + "PaymentMethodGeneralRequest", + "PaymentMethodPbbPayment", + "PaymentMethodPbbRequest", + "PaymentMethodSpeiRecurrentResponse", + "PaymentMethodSpeiRequest", + "PaymentMethodTokenRequest", + "Payout", + "PayoutMethod", + "PayoutOrderPayoutsItem", + "PayoutOrderRequest", + "PayoutOrderRequestCustomerInfo", + "PayoutOrderResponse", + "PayoutOrderResponseCustomerInfo", + "PayoutOrdersResponse", + "PlanRequest", + "PlanResponse", + "Product", + "ProductDataResponse", + "ProductOrderResponse", + "ResendEventRequest", + "RiskRulesData", + "RiskRulesList", + "ShippingLinesDataResponse", + "ShippingOrderResponse", + "ShippingRequest", + "SmsCheckoutRequest", + "SubscriptionDetails", + "SubscriptionDetailsCard", + "SubscriptionDetailsPlan", + "SubscriptionEventsResponse", + "SubscriptionRequest", + "SubscriptionResponse", + "TaxLinesDataResponse", + "TokenRequest", + "TokenRequestCard", + "TokenRequestCheckout", + "TokenResponse", + "TokenResponseCheckout", + "TransactionResponse", + "TransferDestinationResponse", + "TransferMethodResponse", + "TransferResponse", + "TransfersResponse", + "UpdateCustomer", + "UpdateCustomerAntifraudInfo", + "UpdateCustomerFiscalEntitiesResponse", + "UpdateCustomerPaymentMethodsResponse", + "UpdateFiscalEntityRequest", + "UpdateOrderDiscountLinesRequest", + "UpdatePaymentMethodsCard", + "UpdatePlan", + "UpdateProduct", + "UpdateWebhook", + "UpdatesASubscription", + "WebhookKeyCreateResponse", + "WebhookKeyDeleteResponse", + "WebhookKeyRequest", + "WebhookKeyResponse", + "WebhookKeyUpdateRequest", + "WebhookLog", + "WebhookRequest", + "WebhookResponse", + "WhitelistlistRuleResponse", +] # import apis into sdk package -from conekta.api.antifraud_api import AntifraudApi -from conekta.api.api_keys_api import ApiKeysApi -from conekta.api.balances_api import BalancesApi -from conekta.api.charges_api import ChargesApi -from conekta.api.companies_api import CompaniesApi -from conekta.api.customers_api import CustomersApi -from conekta.api.discounts_api import DiscountsApi -from conekta.api.events_api import EventsApi -from conekta.api.logs_api import LogsApi -from conekta.api.orders_api import OrdersApi -from conekta.api.payment_link_api import PaymentLinkApi -from conekta.api.payment_methods_api import PaymentMethodsApi -from conekta.api.payout_orders_api import PayoutOrdersApi -from conekta.api.plans_api import PlansApi -from conekta.api.products_api import ProductsApi -from conekta.api.shipping_contacts_api import ShippingContactsApi -from conekta.api.shippings_api import ShippingsApi -from conekta.api.subscriptions_api import SubscriptionsApi -from conekta.api.taxes_api import TaxesApi -from conekta.api.tokens_api import TokensApi -from conekta.api.transactions_api import TransactionsApi -from conekta.api.transfers_api import TransfersApi -from conekta.api.webhook_keys_api import WebhookKeysApi -from conekta.api.webhooks_api import WebhooksApi +from conekta.api.antifraud_api import AntifraudApi as AntifraudApi +from conekta.api.api_keys_api import ApiKeysApi as ApiKeysApi +from conekta.api.balances_api import BalancesApi as BalancesApi +from conekta.api.charges_api import ChargesApi as ChargesApi +from conekta.api.companies_api import CompaniesApi as CompaniesApi +from conekta.api.customers_api import CustomersApi as CustomersApi +from conekta.api.discounts_api import DiscountsApi as DiscountsApi +from conekta.api.events_api import EventsApi as EventsApi +from conekta.api.logs_api import LogsApi as LogsApi +from conekta.api.orders_api import OrdersApi as OrdersApi +from conekta.api.payment_link_api import PaymentLinkApi as PaymentLinkApi +from conekta.api.payment_methods_api import PaymentMethodsApi as PaymentMethodsApi +from conekta.api.payout_orders_api import PayoutOrdersApi as PayoutOrdersApi +from conekta.api.plans_api import PlansApi as PlansApi +from conekta.api.products_api import ProductsApi as ProductsApi +from conekta.api.shipping_contacts_api import ShippingContactsApi as ShippingContactsApi +from conekta.api.shippings_api import ShippingsApi as ShippingsApi +from conekta.api.subscriptions_api import SubscriptionsApi as SubscriptionsApi +from conekta.api.subscriptions_customer_portal_api import SubscriptionsCustomerPortalApi as SubscriptionsCustomerPortalApi +from conekta.api.taxes_api import TaxesApi as TaxesApi +from conekta.api.tokens_api import TokensApi as TokensApi +from conekta.api.transactions_api import TransactionsApi as TransactionsApi +from conekta.api.transfers_api import TransfersApi as TransfersApi +from conekta.api.webhook_keys_api import WebhookKeysApi as WebhookKeysApi +from conekta.api.webhooks_api import WebhooksApi as WebhooksApi # import ApiClient -from conekta.api_response import ApiResponse -from conekta.api_client import ApiClient -from conekta.configuration import Configuration -from conekta.exceptions import OpenApiException -from conekta.exceptions import ApiTypeError -from conekta.exceptions import ApiValueError -from conekta.exceptions import ApiKeyError -from conekta.exceptions import ApiAttributeError -from conekta.exceptions import ApiException +from conekta.api_response import ApiResponse as ApiResponse +from conekta.api_client import ApiClient as ApiClient +from conekta.configuration import Configuration as Configuration +from conekta.exceptions import OpenApiException as OpenApiException +from conekta.exceptions import ApiTypeError as ApiTypeError +from conekta.exceptions import ApiValueError as ApiValueError +from conekta.exceptions import ApiKeyError as ApiKeyError +from conekta.exceptions import ApiAttributeError as ApiAttributeError +from conekta.exceptions import ApiException as ApiException # import models into sdk package -from conekta.models.api_key_create_response import ApiKeyCreateResponse -from conekta.models.api_key_request import ApiKeyRequest -from conekta.models.api_key_response import ApiKeyResponse -from conekta.models.api_key_response_on_delete import ApiKeyResponseOnDelete -from conekta.models.api_key_update_request import ApiKeyUpdateRequest -from conekta.models.balance_common_field import BalanceCommonField -from conekta.models.balance_response import BalanceResponse -from conekta.models.blacklist_rule_response import BlacklistRuleResponse -from conekta.models.charge_order_response import ChargeOrderResponse -from conekta.models.charge_order_response_payment_method import ChargeOrderResponsePaymentMethod -from conekta.models.charge_request import ChargeRequest -from conekta.models.charge_request_payment_method import ChargeRequestPaymentMethod -from conekta.models.charge_response import ChargeResponse -from conekta.models.charge_response_channel import ChargeResponseChannel -from conekta.models.charge_response_payment_method import ChargeResponsePaymentMethod -from conekta.models.charge_response_refunds import ChargeResponseRefunds -from conekta.models.charge_response_refunds_data import ChargeResponseRefundsData -from conekta.models.charge_update_request import ChargeUpdateRequest -from conekta.models.charges_data_response import ChargesDataResponse -from conekta.models.charges_order_response import ChargesOrderResponse -from conekta.models.charges_order_response_all_of_data import ChargesOrderResponseAllOfData -from conekta.models.checkout import Checkout -from conekta.models.checkout_order_template import CheckoutOrderTemplate -from conekta.models.checkout_order_template_customer_info import CheckoutOrderTemplateCustomerInfo -from conekta.models.checkout_request import CheckoutRequest -from conekta.models.checkout_response import CheckoutResponse -from conekta.models.checkouts_response import CheckoutsResponse -from conekta.models.company_document_request import CompanyDocumentRequest -from conekta.models.company_document_response import CompanyDocumentResponse -from conekta.models.company_response import CompanyResponse -from conekta.models.company_response_documents_inner import CompanyResponseDocumentsInner -from conekta.models.create_company_request import CreateCompanyRequest -from conekta.models.create_company_request_bank_account_info import CreateCompanyRequestBankAccountInfo -from conekta.models.create_company_request_comercial_info import CreateCompanyRequestComercialInfo -from conekta.models.create_company_request_fiscal_info import CreateCompanyRequestFiscalInfo -from conekta.models.create_customer_fiscal_entities_response import CreateCustomerFiscalEntitiesResponse -from conekta.models.create_customer_payment_methods_request import CreateCustomerPaymentMethodsRequest -from conekta.models.create_customer_payment_methods_response import CreateCustomerPaymentMethodsResponse -from conekta.models.create_risk_rules_data import CreateRiskRulesData -from conekta.models.customer import Customer -from conekta.models.customer_address import CustomerAddress -from conekta.models.customer_antifraud_info import CustomerAntifraudInfo -from conekta.models.customer_antifraud_info_response import CustomerAntifraudInfoResponse -from conekta.models.customer_fiscal_entities_data_response import CustomerFiscalEntitiesDataResponse -from conekta.models.customer_fiscal_entities_request import CustomerFiscalEntitiesRequest -from conekta.models.customer_fiscal_entities_response import CustomerFiscalEntitiesResponse -from conekta.models.customer_info import CustomerInfo -from conekta.models.customer_info_just_customer_id import CustomerInfoJustCustomerId -from conekta.models.customer_info_just_customer_id_response import CustomerInfoJustCustomerIdResponse -from conekta.models.customer_payment_method_request import CustomerPaymentMethodRequest -from conekta.models.customer_payment_methods_data import CustomerPaymentMethodsData -from conekta.models.customer_payment_methods_request import CustomerPaymentMethodsRequest -from conekta.models.customer_payment_methods_response import CustomerPaymentMethodsResponse -from conekta.models.customer_response import CustomerResponse -from conekta.models.customer_response_shipping_contacts import CustomerResponseShippingContacts -from conekta.models.customer_shipping_contacts import CustomerShippingContacts -from conekta.models.customer_shipping_contacts_address import CustomerShippingContactsAddress -from conekta.models.customer_shipping_contacts_data_response import CustomerShippingContactsDataResponse -from conekta.models.customer_shipping_contacts_response import CustomerShippingContactsResponse -from conekta.models.customer_shipping_contacts_response_address import CustomerShippingContactsResponseAddress -from conekta.models.customer_update_fiscal_entities_request import CustomerUpdateFiscalEntitiesRequest -from conekta.models.customer_update_shipping_contacts import CustomerUpdateShippingContacts -from conekta.models.customers_response import CustomersResponse -from conekta.models.delete_api_keys_response import DeleteApiKeysResponse -from conekta.models.deleted_blacklist_rule_response import DeletedBlacklistRuleResponse -from conekta.models.deleted_whitelist_rule_response import DeletedWhitelistRuleResponse -from conekta.models.details import Details -from conekta.models.details_error import DetailsError -from conekta.models.discount_lines_data_response import DiscountLinesDataResponse -from conekta.models.discount_lines_response import DiscountLinesResponse -from conekta.models.email_checkout_request import EmailCheckoutRequest -from conekta.models.error import Error -from conekta.models.event_response import EventResponse -from conekta.models.event_types import EventTypes -from conekta.models.events_resend_response import EventsResendResponse -from conekta.models.fiscal_entity_address import FiscalEntityAddress -from conekta.models.get_api_keys_response import GetApiKeysResponse -from conekta.models.get_charges_response import GetChargesResponse -from conekta.models.get_companies_response import GetCompaniesResponse -from conekta.models.get_customer_payment_method_data_response import GetCustomerPaymentMethodDataResponse -from conekta.models.get_events_response import GetEventsResponse -from conekta.models.get_order_discount_lines_response import GetOrderDiscountLinesResponse -from conekta.models.get_orders_response import GetOrdersResponse -from conekta.models.get_payment_method_response import GetPaymentMethodResponse -from conekta.models.get_plans_response import GetPlansResponse -from conekta.models.get_transactions_response import GetTransactionsResponse -from conekta.models.get_transfers_response import GetTransfersResponse -from conekta.models.get_webhook_keys_response import GetWebhookKeysResponse -from conekta.models.get_webhooks_response import GetWebhooksResponse -from conekta.models.log_response import LogResponse -from conekta.models.logs_response import LogsResponse -from conekta.models.logs_response_data import LogsResponseData -from conekta.models.order_capture_request import OrderCaptureRequest -from conekta.models.order_channel_response import OrderChannelResponse -from conekta.models.order_charges_response import OrderChargesResponse -from conekta.models.order_customer_info_response import OrderCustomerInfoResponse -from conekta.models.order_discount_lines_request import OrderDiscountLinesRequest -from conekta.models.order_discount_lines_response import OrderDiscountLinesResponse -from conekta.models.order_fiscal_entity_address_response import OrderFiscalEntityAddressResponse -from conekta.models.order_fiscal_entity_request import OrderFiscalEntityRequest -from conekta.models.order_fiscal_entity_response import OrderFiscalEntityResponse -from conekta.models.order_next_action_response import OrderNextActionResponse -from conekta.models.order_next_action_response_redirect_to_url import OrderNextActionResponseRedirectToUrl -from conekta.models.order_refund_request import OrderRefundRequest -from conekta.models.order_request import OrderRequest -from conekta.models.order_request_customer_info import OrderRequestCustomerInfo -from conekta.models.order_response import OrderResponse -from conekta.models.order_response_checkout import OrderResponseCheckout -from conekta.models.order_response_customer_info import OrderResponseCustomerInfo -from conekta.models.order_response_products import OrderResponseProducts -from conekta.models.order_response_shipping_contact import OrderResponseShippingContact -from conekta.models.order_tax_request import OrderTaxRequest -from conekta.models.order_update_fiscal_entity_request import OrderUpdateFiscalEntityRequest -from conekta.models.order_update_request import OrderUpdateRequest -from conekta.models.order_update_request_customer_info import OrderUpdateRequestCustomerInfo -from conekta.models.orders_response import OrdersResponse -from conekta.models.page import Page -from conekta.models.pagination import Pagination -from conekta.models.payment_method import PaymentMethod -from conekta.models.payment_method_bank_transfer import PaymentMethodBankTransfer -from conekta.models.payment_method_bnpl_payment import PaymentMethodBnplPayment -from conekta.models.payment_method_bnpl_request import PaymentMethodBnplRequest -from conekta.models.payment_method_card import PaymentMethodCard -from conekta.models.payment_method_card_request import PaymentMethodCardRequest -from conekta.models.payment_method_card_response import PaymentMethodCardResponse -from conekta.models.payment_method_cash import PaymentMethodCash -from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse -from conekta.models.payment_method_cash_request import PaymentMethodCashRequest -from conekta.models.payment_method_cash_response import PaymentMethodCashResponse -from conekta.models.payment_method_cash_response_all_of_agreements import PaymentMethodCashResponseAllOfAgreements -from conekta.models.payment_method_general_request import PaymentMethodGeneralRequest -from conekta.models.payment_method_pbb_payment import PaymentMethodPbbPayment -from conekta.models.payment_method_pbb_request import PaymentMethodPbbRequest -from conekta.models.payment_method_response import PaymentMethodResponse -from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent -from conekta.models.payment_method_spei_request import PaymentMethodSpeiRequest -from conekta.models.payment_method_token_request import PaymentMethodTokenRequest -from conekta.models.payout import Payout -from conekta.models.payout_method import PayoutMethod -from conekta.models.payout_order import PayoutOrder -from conekta.models.payout_order_payouts_item import PayoutOrderPayoutsItem -from conekta.models.payout_order_response import PayoutOrderResponse -from conekta.models.payout_order_response_customer_info import PayoutOrderResponseCustomerInfo -from conekta.models.payout_orders_response import PayoutOrdersResponse -from conekta.models.plan_request import PlanRequest -from conekta.models.plan_response import PlanResponse -from conekta.models.plan_update_request import PlanUpdateRequest -from conekta.models.product import Product -from conekta.models.product_data_response import ProductDataResponse -from conekta.models.product_order_response import ProductOrderResponse -from conekta.models.resend_request import ResendRequest -from conekta.models.risk_rules_data import RiskRulesData -from conekta.models.risk_rules_list import RiskRulesList -from conekta.models.shipping_order_response import ShippingOrderResponse -from conekta.models.shipping_request import ShippingRequest -from conekta.models.sms_checkout_request import SmsCheckoutRequest -from conekta.models.subscription_events_response import SubscriptionEventsResponse -from conekta.models.subscription_request import SubscriptionRequest -from conekta.models.subscription_response import SubscriptionResponse -from conekta.models.subscription_update_request import SubscriptionUpdateRequest -from conekta.models.token import Token -from conekta.models.token_card import TokenCard -from conekta.models.token_checkout import TokenCheckout -from conekta.models.token_response import TokenResponse -from conekta.models.token_response_checkout import TokenResponseCheckout -from conekta.models.transaction_response import TransactionResponse -from conekta.models.transfer_destination_response import TransferDestinationResponse -from conekta.models.transfer_method_response import TransferMethodResponse -from conekta.models.transfer_response import TransferResponse -from conekta.models.transfers_response import TransfersResponse -from conekta.models.update_customer import UpdateCustomer -from conekta.models.update_customer_antifraud_info import UpdateCustomerAntifraudInfo -from conekta.models.update_customer_fiscal_entities_response import UpdateCustomerFiscalEntitiesResponse -from conekta.models.update_customer_payment_methods_response import UpdateCustomerPaymentMethodsResponse -from conekta.models.update_order_discount_lines_request import UpdateOrderDiscountLinesRequest -from conekta.models.update_order_tax_request import UpdateOrderTaxRequest -from conekta.models.update_order_tax_response import UpdateOrderTaxResponse -from conekta.models.update_payment_methods import UpdatePaymentMethods -from conekta.models.update_product import UpdateProduct -from conekta.models.webhook_key_create_response import WebhookKeyCreateResponse -from conekta.models.webhook_key_delete_response import WebhookKeyDeleteResponse -from conekta.models.webhook_key_request import WebhookKeyRequest -from conekta.models.webhook_key_response import WebhookKeyResponse -from conekta.models.webhook_key_update_request import WebhookKeyUpdateRequest -from conekta.models.webhook_log import WebhookLog -from conekta.models.webhook_request import WebhookRequest -from conekta.models.webhook_response import WebhookResponse -from conekta.models.webhook_update_request import WebhookUpdateRequest -from conekta.models.whitelistlist_rule_response import WhitelistlistRuleResponse +from conekta.models.api_key_create_response import ApiKeyCreateResponse as ApiKeyCreateResponse +from conekta.models.api_key_request import ApiKeyRequest as ApiKeyRequest +from conekta.models.api_key_response import ApiKeyResponse as ApiKeyResponse +from conekta.models.api_key_update_request import ApiKeyUpdateRequest as ApiKeyUpdateRequest +from conekta.models.balance_common_fiels_response import BalanceCommonFielsResponse as BalanceCommonFielsResponse +from conekta.models.balance_response import BalanceResponse as BalanceResponse +from conekta.models.blacklist_rule_response import BlacklistRuleResponse as BlacklistRuleResponse +from conekta.models.cash_agreements_response import CashAgreementsResponse as CashAgreementsResponse +from conekta.models.charge_order_response import ChargeOrderResponse as ChargeOrderResponse +from conekta.models.charge_order_response_payment_method import ChargeOrderResponsePaymentMethod as ChargeOrderResponsePaymentMethod +from conekta.models.charge_request import ChargeRequest as ChargeRequest +from conekta.models.charge_request_payment_method import ChargeRequestPaymentMethod as ChargeRequestPaymentMethod +from conekta.models.charge_response import ChargeResponse as ChargeResponse +from conekta.models.charge_response_channel import ChargeResponseChannel as ChargeResponseChannel +from conekta.models.charge_response_payment_method import ChargeResponsePaymentMethod as ChargeResponsePaymentMethod +from conekta.models.charge_response_refunds import ChargeResponseRefunds as ChargeResponseRefunds +from conekta.models.charge_response_refunds_data import ChargeResponseRefundsData as ChargeResponseRefundsData +from conekta.models.charge_update_request import ChargeUpdateRequest as ChargeUpdateRequest +from conekta.models.chargeback_file_response import ChargebackFileResponse as ChargebackFileResponse +from conekta.models.chargeback_response import ChargebackResponse as ChargebackResponse +from conekta.models.charges_data_response import ChargesDataResponse as ChargesDataResponse +from conekta.models.charges_order_response import ChargesOrderResponse as ChargesOrderResponse +from conekta.models.checkout import Checkout as Checkout +from conekta.models.checkout_order_template import CheckoutOrderTemplate as CheckoutOrderTemplate +from conekta.models.checkout_response import CheckoutResponse as CheckoutResponse +from conekta.models.checkouts_response import CheckoutsResponse as CheckoutsResponse +from conekta.models.company_document_request import CompanyDocumentRequest as CompanyDocumentRequest +from conekta.models.company_document_response import CompanyDocumentResponse as CompanyDocumentResponse +from conekta.models.company_response import CompanyResponse as CompanyResponse +from conekta.models.create_company_request import CreateCompanyRequest as CreateCompanyRequest +from conekta.models.create_company_request_bank_account_info import CreateCompanyRequestBankAccountInfo as CreateCompanyRequestBankAccountInfo +from conekta.models.create_company_request_comercial_info import CreateCompanyRequestComercialInfo as CreateCompanyRequestComercialInfo +from conekta.models.create_company_request_fiscal_info import CreateCompanyRequestFiscalInfo as CreateCompanyRequestFiscalInfo +from conekta.models.create_customer_fiscal_entities_response import CreateCustomerFiscalEntitiesResponse as CreateCustomerFiscalEntitiesResponse +from conekta.models.create_customer_payment_methods_request import CreateCustomerPaymentMethodsRequest as CreateCustomerPaymentMethodsRequest +from conekta.models.create_customer_payment_methods_response import CreateCustomerPaymentMethodsResponse as CreateCustomerPaymentMethodsResponse +from conekta.models.create_rule_whitelist_request import CreateRuleWhitelistRequest as CreateRuleWhitelistRequest +from conekta.models.customer import Customer as Customer +from conekta.models.customer_antifraud_info import CustomerAntifraudInfo as CustomerAntifraudInfo +from conekta.models.customer_antifraud_info_response import CustomerAntifraudInfoResponse as CustomerAntifraudInfoResponse +from conekta.models.customer_details import CustomerDetails as CustomerDetails +from conekta.models.customer_fiscal_entities_data_response import CustomerFiscalEntitiesDataResponse as CustomerFiscalEntitiesDataResponse +from conekta.models.customer_fiscal_entities_response import CustomerFiscalEntitiesResponse as CustomerFiscalEntitiesResponse +from conekta.models.customer_info import CustomerInfo as CustomerInfo +from conekta.models.customer_info_customer_id import CustomerInfoCustomerId as CustomerInfoCustomerId +from conekta.models.customer_payment_methods_data import CustomerPaymentMethodsData as CustomerPaymentMethodsData +from conekta.models.customer_payment_methods_request import CustomerPaymentMethodsRequest as CustomerPaymentMethodsRequest +from conekta.models.customer_payment_methods_response import CustomerPaymentMethodsResponse as CustomerPaymentMethodsResponse +from conekta.models.customer_portal_response import CustomerPortalResponse as CustomerPortalResponse +from conekta.models.customer_response import CustomerResponse as CustomerResponse +from conekta.models.customer_response_shipping_contacts import CustomerResponseShippingContacts as CustomerResponseShippingContacts +from conekta.models.customer_shipping_contacts_address import CustomerShippingContactsAddress as CustomerShippingContactsAddress +from conekta.models.customer_shipping_contacts_data_response import CustomerShippingContactsDataResponse as CustomerShippingContactsDataResponse +from conekta.models.customer_shipping_contacts_request import CustomerShippingContactsRequest as CustomerShippingContactsRequest +from conekta.models.customer_shipping_contacts_request_address import CustomerShippingContactsRequestAddress as CustomerShippingContactsRequestAddress +from conekta.models.customer_shipping_contacts_response import CustomerShippingContactsResponse as CustomerShippingContactsResponse +from conekta.models.customer_subscription_response import CustomerSubscriptionResponse as CustomerSubscriptionResponse +from conekta.models.customer_update_shipping_contacts_request import CustomerUpdateShippingContactsRequest as CustomerUpdateShippingContactsRequest +from conekta.models.customers_response import CustomersResponse as CustomersResponse +from conekta.models.delete_api_keys_response import DeleteApiKeysResponse as DeleteApiKeysResponse +from conekta.models.deleted_blacklist_rule_response import DeletedBlacklistRuleResponse as DeletedBlacklistRuleResponse +from conekta.models.deleted_whitelist_rule_response import DeletedWhitelistRuleResponse as DeletedWhitelistRuleResponse +from conekta.models.details_error import DetailsError as DetailsError +from conekta.models.discount_lines_data_response import DiscountLinesDataResponse as DiscountLinesDataResponse +from conekta.models.discount_lines_response import DiscountLinesResponse as DiscountLinesResponse +from conekta.models.email_checkout_request import EmailCheckoutRequest as EmailCheckoutRequest +from conekta.models.error import Error as Error +from conekta.models.event_response import EventResponse as EventResponse +from conekta.models.event_types import EventTypes as EventTypes +from conekta.models.events_resend_response import EventsResendResponse as EventsResendResponse +from conekta.models.fiscal_entity_address import FiscalEntityAddress as FiscalEntityAddress +from conekta.models.fiscal_entity_request import FiscalEntityRequest as FiscalEntityRequest +from conekta.models.fiscal_entity_request_address import FiscalEntityRequestAddress as FiscalEntityRequestAddress +from conekta.models.get_api_keys_response import GetApiKeysResponse as GetApiKeysResponse +from conekta.models.get_charges_response import GetChargesResponse as GetChargesResponse +from conekta.models.get_companies_response import GetCompaniesResponse as GetCompaniesResponse +from conekta.models.get_customer_payment_method_data_response import GetCustomerPaymentMethodDataResponse as GetCustomerPaymentMethodDataResponse +from conekta.models.get_events_response import GetEventsResponse as GetEventsResponse +from conekta.models.get_order_discount_lines_response import GetOrderDiscountLinesResponse as GetOrderDiscountLinesResponse +from conekta.models.get_orders_response import GetOrdersResponse as GetOrdersResponse +from conekta.models.get_payment_method_response import GetPaymentMethodResponse as GetPaymentMethodResponse +from conekta.models.get_plans_response import GetPlansResponse as GetPlansResponse +from conekta.models.get_transactions_response import GetTransactionsResponse as GetTransactionsResponse +from conekta.models.get_transfers_response import GetTransfersResponse as GetTransfersResponse +from conekta.models.get_webhook_keys_response import GetWebhookKeysResponse as GetWebhookKeysResponse +from conekta.models.get_webhooks_response import GetWebhooksResponse as GetWebhooksResponse +from conekta.models.log_response_for_request import LogResponseForRequest as LogResponseForRequest +from conekta.models.logs_response_data import LogsResponseData as LogsResponseData +from conekta.models.logs_response_for_request import LogsResponseForRequest as LogsResponseForRequest +from conekta.models.order_capture_request import OrderCaptureRequest as OrderCaptureRequest +from conekta.models.order_channel_response import OrderChannelResponse as OrderChannelResponse +from conekta.models.order_charges_response import OrderChargesResponse as OrderChargesResponse +from conekta.models.order_checkout_request import OrderCheckoutRequest as OrderCheckoutRequest +from conekta.models.order_discount_lines_request import OrderDiscountLinesRequest as OrderDiscountLinesRequest +from conekta.models.order_discount_lines_response import OrderDiscountLinesResponse as OrderDiscountLinesResponse +from conekta.models.order_fiscal_entity_address_response import OrderFiscalEntityAddressResponse as OrderFiscalEntityAddressResponse +from conekta.models.order_fiscal_entity_request import OrderFiscalEntityRequest as OrderFiscalEntityRequest +from conekta.models.order_fiscal_entity_response import OrderFiscalEntityResponse as OrderFiscalEntityResponse +from conekta.models.order_next_action_response import OrderNextActionResponse as OrderNextActionResponse +from conekta.models.order_next_action_response_redirect_to_url import OrderNextActionResponseRedirectToUrl as OrderNextActionResponseRedirectToUrl +from conekta.models.order_refund_request import OrderRefundRequest as OrderRefundRequest +from conekta.models.order_request import OrderRequest as OrderRequest +from conekta.models.order_request_customer_info import OrderRequestCustomerInfo as OrderRequestCustomerInfo +from conekta.models.order_response import OrderResponse as OrderResponse +from conekta.models.order_response_checkout import OrderResponseCheckout as OrderResponseCheckout +from conekta.models.order_response_customer_info import OrderResponseCustomerInfo as OrderResponseCustomerInfo +from conekta.models.order_response_products import OrderResponseProducts as OrderResponseProducts +from conekta.models.order_response_shipping_contact import OrderResponseShippingContact as OrderResponseShippingContact +from conekta.models.order_shipping_lines_response import OrderShippingLinesResponse as OrderShippingLinesResponse +from conekta.models.order_tax_lines_response import OrderTaxLinesResponse as OrderTaxLinesResponse +from conekta.models.order_tax_request import OrderTaxRequest as OrderTaxRequest +from conekta.models.order_tax_response import OrderTaxResponse as OrderTaxResponse +from conekta.models.order_update import OrderUpdate as OrderUpdate +from conekta.models.order_update_customer_info import OrderUpdateCustomerInfo as OrderUpdateCustomerInfo +from conekta.models.order_update_fiscal_entity_request import OrderUpdateFiscalEntityRequest as OrderUpdateFiscalEntityRequest +from conekta.models.orders_update_taxes_request import OrdersUpdateTaxesRequest as OrdersUpdateTaxesRequest +from conekta.models.payment_method_bank_transfer import PaymentMethodBankTransfer as PaymentMethodBankTransfer +from conekta.models.payment_method_bnpl_payment import PaymentMethodBnplPayment as PaymentMethodBnplPayment +from conekta.models.payment_method_bnpl_request import PaymentMethodBnplRequest as PaymentMethodBnplRequest +from conekta.models.payment_method_card import PaymentMethodCard as PaymentMethodCard +from conekta.models.payment_method_card_request import PaymentMethodCardRequest as PaymentMethodCardRequest +from conekta.models.payment_method_card_response import PaymentMethodCardResponse as PaymentMethodCardResponse +from conekta.models.payment_method_cash import PaymentMethodCash as PaymentMethodCash +from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse as PaymentMethodCashRecurrentResponse +from conekta.models.payment_method_cash_request import PaymentMethodCashRequest as PaymentMethodCashRequest +from conekta.models.payment_method_cash_response import PaymentMethodCashResponse as PaymentMethodCashResponse +from conekta.models.payment_method_general_request import PaymentMethodGeneralRequest as PaymentMethodGeneralRequest +from conekta.models.payment_method_pbb_payment import PaymentMethodPbbPayment as PaymentMethodPbbPayment +from conekta.models.payment_method_pbb_request import PaymentMethodPbbRequest as PaymentMethodPbbRequest +from conekta.models.payment_method_spei_recurrent_response import PaymentMethodSpeiRecurrentResponse as PaymentMethodSpeiRecurrentResponse +from conekta.models.payment_method_spei_request import PaymentMethodSpeiRequest as PaymentMethodSpeiRequest +from conekta.models.payment_method_token_request import PaymentMethodTokenRequest as PaymentMethodTokenRequest +from conekta.models.payout import Payout as Payout +from conekta.models.payout_method import PayoutMethod as PayoutMethod +from conekta.models.payout_order_payouts_item import PayoutOrderPayoutsItem as PayoutOrderPayoutsItem +from conekta.models.payout_order_request import PayoutOrderRequest as PayoutOrderRequest +from conekta.models.payout_order_request_customer_info import PayoutOrderRequestCustomerInfo as PayoutOrderRequestCustomerInfo +from conekta.models.payout_order_response import PayoutOrderResponse as PayoutOrderResponse +from conekta.models.payout_order_response_customer_info import PayoutOrderResponseCustomerInfo as PayoutOrderResponseCustomerInfo +from conekta.models.payout_orders_response import PayoutOrdersResponse as PayoutOrdersResponse +from conekta.models.plan_request import PlanRequest as PlanRequest +from conekta.models.plan_response import PlanResponse as PlanResponse +from conekta.models.product import Product as Product +from conekta.models.product_data_response import ProductDataResponse as ProductDataResponse +from conekta.models.product_order_response import ProductOrderResponse as ProductOrderResponse +from conekta.models.resend_event_request import ResendEventRequest as ResendEventRequest +from conekta.models.risk_rules_data import RiskRulesData as RiskRulesData +from conekta.models.risk_rules_list import RiskRulesList as RiskRulesList +from conekta.models.shipping_lines_data_response import ShippingLinesDataResponse as ShippingLinesDataResponse +from conekta.models.shipping_order_response import ShippingOrderResponse as ShippingOrderResponse +from conekta.models.shipping_request import ShippingRequest as ShippingRequest +from conekta.models.sms_checkout_request import SmsCheckoutRequest as SmsCheckoutRequest +from conekta.models.subscription_details import SubscriptionDetails as SubscriptionDetails +from conekta.models.subscription_details_card import SubscriptionDetailsCard as SubscriptionDetailsCard +from conekta.models.subscription_details_plan import SubscriptionDetailsPlan as SubscriptionDetailsPlan +from conekta.models.subscription_events_response import SubscriptionEventsResponse as SubscriptionEventsResponse +from conekta.models.subscription_request import SubscriptionRequest as SubscriptionRequest +from conekta.models.subscription_response import SubscriptionResponse as SubscriptionResponse +from conekta.models.tax_lines_data_response import TaxLinesDataResponse as TaxLinesDataResponse +from conekta.models.token_request import TokenRequest as TokenRequest +from conekta.models.token_request_card import TokenRequestCard as TokenRequestCard +from conekta.models.token_request_checkout import TokenRequestCheckout as TokenRequestCheckout +from conekta.models.token_response import TokenResponse as TokenResponse +from conekta.models.token_response_checkout import TokenResponseCheckout as TokenResponseCheckout +from conekta.models.transaction_response import TransactionResponse as TransactionResponse +from conekta.models.transfer_destination_response import TransferDestinationResponse as TransferDestinationResponse +from conekta.models.transfer_method_response import TransferMethodResponse as TransferMethodResponse +from conekta.models.transfer_response import TransferResponse as TransferResponse +from conekta.models.transfers_response import TransfersResponse as TransfersResponse +from conekta.models.update_customer import UpdateCustomer as UpdateCustomer +from conekta.models.update_customer_antifraud_info import UpdateCustomerAntifraudInfo as UpdateCustomerAntifraudInfo +from conekta.models.update_customer_fiscal_entities_response import UpdateCustomerFiscalEntitiesResponse as UpdateCustomerFiscalEntitiesResponse +from conekta.models.update_customer_payment_methods_response import UpdateCustomerPaymentMethodsResponse as UpdateCustomerPaymentMethodsResponse +from conekta.models.update_fiscal_entity_request import UpdateFiscalEntityRequest as UpdateFiscalEntityRequest +from conekta.models.update_order_discount_lines_request import UpdateOrderDiscountLinesRequest as UpdateOrderDiscountLinesRequest +from conekta.models.update_payment_methods_card import UpdatePaymentMethodsCard as UpdatePaymentMethodsCard +from conekta.models.update_plan import UpdatePlan as UpdatePlan +from conekta.models.update_product import UpdateProduct as UpdateProduct +from conekta.models.update_webhook import UpdateWebhook as UpdateWebhook +from conekta.models.updates_a_subscription import UpdatesASubscription as UpdatesASubscription +from conekta.models.webhook_key_create_response import WebhookKeyCreateResponse as WebhookKeyCreateResponse +from conekta.models.webhook_key_delete_response import WebhookKeyDeleteResponse as WebhookKeyDeleteResponse +from conekta.models.webhook_key_request import WebhookKeyRequest as WebhookKeyRequest +from conekta.models.webhook_key_response import WebhookKeyResponse as WebhookKeyResponse +from conekta.models.webhook_key_update_request import WebhookKeyUpdateRequest as WebhookKeyUpdateRequest +from conekta.models.webhook_log import WebhookLog as WebhookLog +from conekta.models.webhook_request import WebhookRequest as WebhookRequest +from conekta.models.webhook_response import WebhookResponse as WebhookResponse +from conekta.models.whitelistlist_rule_response import WhitelistlistRuleResponse as WhitelistlistRuleResponse + diff --git a/conekta/api/__init__.py b/conekta/api/__init__.py index 18fb25d..cf7aca0 100644 --- a/conekta/api/__init__.py +++ b/conekta/api/__init__.py @@ -19,6 +19,7 @@ from conekta.api.shipping_contacts_api import ShippingContactsApi from conekta.api.shippings_api import ShippingsApi from conekta.api.subscriptions_api import SubscriptionsApi +from conekta.api.subscriptions_customer_portal_api import SubscriptionsCustomerPortalApi from conekta.api.taxes_api import TaxesApi from conekta.api.tokens_api import TokensApi from conekta.api.transactions_api import TransactionsApi diff --git a/conekta/api/antifraud_api.py b/conekta/api/antifraud_api.py index b48be76..fad7e89 100644 --- a/conekta/api/antifraud_api.py +++ b/conekta/api/antifraud_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -21,7 +20,7 @@ from typing import Optional from typing_extensions import Annotated from conekta.models.blacklist_rule_response import BlacklistRuleResponse -from conekta.models.create_risk_rules_data import CreateRiskRulesData +from conekta.models.create_rule_whitelist_request import CreateRuleWhitelistRequest from conekta.models.deleted_blacklist_rule_response import DeletedBlacklistRuleResponse from conekta.models.deleted_whitelist_rule_response import DeletedWhitelistRuleResponse from conekta.models.risk_rules_list import RiskRulesList @@ -48,7 +47,7 @@ def __init__(self, api_client=None) -> None: @validate_call def create_rule_blacklist( self, - create_risk_rules_data: Annotated[CreateRiskRulesData, Field(description="requested field for blacklist rule")], + create_rule_whitelist_request: Annotated[CreateRuleWhitelistRequest, Field(description="requested field for blacklist rule")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -66,8 +65,8 @@ def create_rule_blacklist( """Create blacklisted rule - :param create_risk_rules_data: requested field for blacklist rule (required) - :type create_risk_rules_data: CreateRiskRulesData + :param create_rule_whitelist_request: requested field for blacklist rule (required) + :type create_rule_whitelist_request: CreateRuleWhitelistRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -93,7 +92,7 @@ def create_rule_blacklist( """ # noqa: E501 _param = self._create_rule_blacklist_serialize( - create_risk_rules_data=create_risk_rules_data, + create_rule_whitelist_request=create_rule_whitelist_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -120,7 +119,7 @@ def create_rule_blacklist( @validate_call def create_rule_blacklist_with_http_info( self, - create_risk_rules_data: Annotated[CreateRiskRulesData, Field(description="requested field for blacklist rule")], + create_rule_whitelist_request: Annotated[CreateRuleWhitelistRequest, Field(description="requested field for blacklist rule")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -138,8 +137,8 @@ def create_rule_blacklist_with_http_info( """Create blacklisted rule - :param create_risk_rules_data: requested field for blacklist rule (required) - :type create_risk_rules_data: CreateRiskRulesData + :param create_rule_whitelist_request: requested field for blacklist rule (required) + :type create_rule_whitelist_request: CreateRuleWhitelistRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -165,7 +164,7 @@ def create_rule_blacklist_with_http_info( """ # noqa: E501 _param = self._create_rule_blacklist_serialize( - create_risk_rules_data=create_risk_rules_data, + create_rule_whitelist_request=create_rule_whitelist_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -192,7 +191,7 @@ def create_rule_blacklist_with_http_info( @validate_call def create_rule_blacklist_without_preload_content( self, - create_risk_rules_data: Annotated[CreateRiskRulesData, Field(description="requested field for blacklist rule")], + create_rule_whitelist_request: Annotated[CreateRuleWhitelistRequest, Field(description="requested field for blacklist rule")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -210,8 +209,8 @@ def create_rule_blacklist_without_preload_content( """Create blacklisted rule - :param create_risk_rules_data: requested field for blacklist rule (required) - :type create_risk_rules_data: CreateRiskRulesData + :param create_rule_whitelist_request: requested field for blacklist rule (required) + :type create_rule_whitelist_request: CreateRuleWhitelistRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -237,7 +236,7 @@ def create_rule_blacklist_without_preload_content( """ # noqa: E501 _param = self._create_rule_blacklist_serialize( - create_risk_rules_data=create_risk_rules_data, + create_rule_whitelist_request=create_rule_whitelist_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -259,7 +258,7 @@ def create_rule_blacklist_without_preload_content( def _create_rule_blacklist_serialize( self, - create_risk_rules_data, + create_rule_whitelist_request, accept_language, _request_auth, _content_type, @@ -288,8 +287,8 @@ def _create_rule_blacklist_serialize( _header_params['Accept-Language'] = accept_language # process the form parameters # process the body parameter - if create_risk_rules_data is not None: - _body_params = create_risk_rules_data + if create_rule_whitelist_request is not None: + _body_params = create_rule_whitelist_request # set the HTTP header `Accept` @@ -341,7 +340,7 @@ def _create_rule_blacklist_serialize( def create_rule_whitelist( self, accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, - create_risk_rules_data: Optional[CreateRiskRulesData] = None, + create_rule_whitelist_request: Optional[CreateRuleWhitelistRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -360,8 +359,8 @@ def create_rule_whitelist( :param accept_language: Use for knowing which language to use :type accept_language: str - :param create_risk_rules_data: - :type create_risk_rules_data: CreateRiskRulesData + :param create_rule_whitelist_request: + :type create_rule_whitelist_request: CreateRuleWhitelistRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -386,7 +385,7 @@ def create_rule_whitelist( _param = self._create_rule_whitelist_serialize( accept_language=accept_language, - create_risk_rules_data=create_risk_rules_data, + create_rule_whitelist_request=create_rule_whitelist_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -414,7 +413,7 @@ def create_rule_whitelist( def create_rule_whitelist_with_http_info( self, accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, - create_risk_rules_data: Optional[CreateRiskRulesData] = None, + create_rule_whitelist_request: Optional[CreateRuleWhitelistRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -433,8 +432,8 @@ def create_rule_whitelist_with_http_info( :param accept_language: Use for knowing which language to use :type accept_language: str - :param create_risk_rules_data: - :type create_risk_rules_data: CreateRiskRulesData + :param create_rule_whitelist_request: + :type create_rule_whitelist_request: CreateRuleWhitelistRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -459,7 +458,7 @@ def create_rule_whitelist_with_http_info( _param = self._create_rule_whitelist_serialize( accept_language=accept_language, - create_risk_rules_data=create_risk_rules_data, + create_rule_whitelist_request=create_rule_whitelist_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -487,7 +486,7 @@ def create_rule_whitelist_with_http_info( def create_rule_whitelist_without_preload_content( self, accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, - create_risk_rules_data: Optional[CreateRiskRulesData] = None, + create_rule_whitelist_request: Optional[CreateRuleWhitelistRequest] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -506,8 +505,8 @@ def create_rule_whitelist_without_preload_content( :param accept_language: Use for knowing which language to use :type accept_language: str - :param create_risk_rules_data: - :type create_risk_rules_data: CreateRiskRulesData + :param create_rule_whitelist_request: + :type create_rule_whitelist_request: CreateRuleWhitelistRequest :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -532,7 +531,7 @@ def create_rule_whitelist_without_preload_content( _param = self._create_rule_whitelist_serialize( accept_language=accept_language, - create_risk_rules_data=create_risk_rules_data, + create_rule_whitelist_request=create_rule_whitelist_request, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -555,7 +554,7 @@ def create_rule_whitelist_without_preload_content( def _create_rule_whitelist_serialize( self, accept_language, - create_risk_rules_data, + create_rule_whitelist_request, _request_auth, _content_type, _headers, @@ -583,8 +582,8 @@ def _create_rule_whitelist_serialize( _header_params['Accept-Language'] = accept_language # process the form parameters # process the body parameter - if create_risk_rules_data is not None: - _body_params = create_risk_rules_data + if create_rule_whitelist_request is not None: + _body_params = create_rule_whitelist_request # set the HTTP header `Accept` diff --git a/conekta/api/api_keys_api.py b/conekta/api/api_keys_api.py index e606dc3..d3690db 100644 --- a/conekta/api/api_keys_api.py +++ b/conekta/api/api_keys_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/balances_api.py b/conekta/api/balances_api.py index 6366bff..5188eec 100644 --- a/conekta/api/balances_api.py +++ b/conekta/api/balances_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/charges_api.py b/conekta/api/charges_api.py index 4de20a9..8edecf8 100644 --- a/conekta/api/charges_api.py +++ b/conekta/api/charges_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/companies_api.py b/conekta/api/companies_api.py index 0486db9..b6dfdd9 100644 --- a/conekta/api/companies_api.py +++ b/conekta/api/companies_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -1226,6 +1225,273 @@ def _get_company_documents_serialize( + @validate_call + def get_current_company( + self, + accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CompanyResponse: + """Get Current Company + + Retrieves information about the currently authenticated company. This endpoint returns the same data as the standard company endpoint but automatically uses the current company's context. + + :param accept_language: Use for knowing which language to use + :type accept_language: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_current_company_serialize( + accept_language=accept_language, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyResponse", + '401': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_current_company_with_http_info( + self, + accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CompanyResponse]: + """Get Current Company + + Retrieves information about the currently authenticated company. This endpoint returns the same data as the standard company endpoint but automatically uses the current company's context. + + :param accept_language: Use for knowing which language to use + :type accept_language: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_current_company_serialize( + accept_language=accept_language, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyResponse", + '401': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_current_company_without_preload_content( + self, + accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get Current Company + + Retrieves information about the currently authenticated company. This endpoint returns the same data as the standard company endpoint but automatically uses the current company's context. + + :param accept_language: Use for knowing which language to use + :type accept_language: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_current_company_serialize( + accept_language=accept_language, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CompanyResponse", + '401': "Error", + '500': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_current_company_serialize( + self, + accept_language, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if accept_language is not None: + _header_params['Accept-Language'] = accept_language + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/vnd.conekta-v2.2.0+json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/companies/current', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call def update_company_document( self, diff --git a/conekta/api/customers_api.py b/conekta/api/customers_api.py index 3123c09..d984def 100644 --- a/conekta/api/customers_api.py +++ b/conekta/api/customers_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -22,12 +21,12 @@ from typing_extensions import Annotated from conekta.models.create_customer_fiscal_entities_response import CreateCustomerFiscalEntitiesResponse from conekta.models.customer import Customer -from conekta.models.customer_fiscal_entities_request import CustomerFiscalEntitiesRequest from conekta.models.customer_response import CustomerResponse -from conekta.models.customer_update_fiscal_entities_request import CustomerUpdateFiscalEntitiesRequest from conekta.models.customers_response import CustomersResponse +from conekta.models.fiscal_entity_request import FiscalEntityRequest from conekta.models.update_customer import UpdateCustomer from conekta.models.update_customer_fiscal_entities_response import UpdateCustomerFiscalEntitiesResponse +from conekta.models.update_fiscal_entity_request import UpdateFiscalEntityRequest from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -367,7 +366,7 @@ def _create_customer_serialize( def create_customer_fiscal_entities( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - customer_fiscal_entities_request: Annotated[CustomerFiscalEntitiesRequest, Field(description="requested field for customer fiscal entities")], + fiscal_entity_request: Annotated[FiscalEntityRequest, Field(description="requested field for customer fiscal entities")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -389,8 +388,8 @@ def create_customer_fiscal_entities( :param id: Identifier of the resource (required) :type id: str - :param customer_fiscal_entities_request: requested field for customer fiscal entities (required) - :type customer_fiscal_entities_request: CustomerFiscalEntitiesRequest + :param fiscal_entity_request: requested field for customer fiscal entities (required) + :type fiscal_entity_request: FiscalEntityRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -419,7 +418,7 @@ def create_customer_fiscal_entities( _param = self._create_customer_fiscal_entities_serialize( id=id, - customer_fiscal_entities_request=customer_fiscal_entities_request, + fiscal_entity_request=fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -450,7 +449,7 @@ def create_customer_fiscal_entities( def create_customer_fiscal_entities_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - customer_fiscal_entities_request: Annotated[CustomerFiscalEntitiesRequest, Field(description="requested field for customer fiscal entities")], + fiscal_entity_request: Annotated[FiscalEntityRequest, Field(description="requested field for customer fiscal entities")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -472,8 +471,8 @@ def create_customer_fiscal_entities_with_http_info( :param id: Identifier of the resource (required) :type id: str - :param customer_fiscal_entities_request: requested field for customer fiscal entities (required) - :type customer_fiscal_entities_request: CustomerFiscalEntitiesRequest + :param fiscal_entity_request: requested field for customer fiscal entities (required) + :type fiscal_entity_request: FiscalEntityRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -502,7 +501,7 @@ def create_customer_fiscal_entities_with_http_info( _param = self._create_customer_fiscal_entities_serialize( id=id, - customer_fiscal_entities_request=customer_fiscal_entities_request, + fiscal_entity_request=fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -533,7 +532,7 @@ def create_customer_fiscal_entities_with_http_info( def create_customer_fiscal_entities_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - customer_fiscal_entities_request: Annotated[CustomerFiscalEntitiesRequest, Field(description="requested field for customer fiscal entities")], + fiscal_entity_request: Annotated[FiscalEntityRequest, Field(description="requested field for customer fiscal entities")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -555,8 +554,8 @@ def create_customer_fiscal_entities_without_preload_content( :param id: Identifier of the resource (required) :type id: str - :param customer_fiscal_entities_request: requested field for customer fiscal entities (required) - :type customer_fiscal_entities_request: CustomerFiscalEntitiesRequest + :param fiscal_entity_request: requested field for customer fiscal entities (required) + :type fiscal_entity_request: FiscalEntityRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -585,7 +584,7 @@ def create_customer_fiscal_entities_without_preload_content( _param = self._create_customer_fiscal_entities_serialize( id=id, - customer_fiscal_entities_request=customer_fiscal_entities_request, + fiscal_entity_request=fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -611,7 +610,7 @@ def create_customer_fiscal_entities_without_preload_content( def _create_customer_fiscal_entities_serialize( self, id, - customer_fiscal_entities_request, + fiscal_entity_request, accept_language, x_child_company_id, _request_auth, @@ -645,8 +644,8 @@ def _create_customer_fiscal_entities_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if customer_fiscal_entities_request is not None: - _body_params = customer_fiscal_entities_request + if fiscal_entity_request is not None: + _body_params = fiscal_entity_request # set the HTTP header `Accept` @@ -1983,7 +1982,7 @@ def update_customer_fiscal_entities( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], fiscal_entities_id: Annotated[StrictStr, Field(description="identifier")], - customer_update_fiscal_entities_request: Annotated[CustomerUpdateFiscalEntitiesRequest, Field(description="requested field for customer update fiscal entities")], + update_fiscal_entity_request: Annotated[UpdateFiscalEntityRequest, Field(description="requested field for customer update fiscal entities")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -2007,8 +2006,8 @@ def update_customer_fiscal_entities( :type id: str :param fiscal_entities_id: identifier (required) :type fiscal_entities_id: str - :param customer_update_fiscal_entities_request: requested field for customer update fiscal entities (required) - :type customer_update_fiscal_entities_request: CustomerUpdateFiscalEntitiesRequest + :param update_fiscal_entity_request: requested field for customer update fiscal entities (required) + :type update_fiscal_entity_request: UpdateFiscalEntityRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -2038,7 +2037,7 @@ def update_customer_fiscal_entities( _param = self._update_customer_fiscal_entities_serialize( id=id, fiscal_entities_id=fiscal_entities_id, - customer_update_fiscal_entities_request=customer_update_fiscal_entities_request, + update_fiscal_entity_request=update_fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -2070,7 +2069,7 @@ def update_customer_fiscal_entities_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], fiscal_entities_id: Annotated[StrictStr, Field(description="identifier")], - customer_update_fiscal_entities_request: Annotated[CustomerUpdateFiscalEntitiesRequest, Field(description="requested field for customer update fiscal entities")], + update_fiscal_entity_request: Annotated[UpdateFiscalEntityRequest, Field(description="requested field for customer update fiscal entities")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -2094,8 +2093,8 @@ def update_customer_fiscal_entities_with_http_info( :type id: str :param fiscal_entities_id: identifier (required) :type fiscal_entities_id: str - :param customer_update_fiscal_entities_request: requested field for customer update fiscal entities (required) - :type customer_update_fiscal_entities_request: CustomerUpdateFiscalEntitiesRequest + :param update_fiscal_entity_request: requested field for customer update fiscal entities (required) + :type update_fiscal_entity_request: UpdateFiscalEntityRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -2125,7 +2124,7 @@ def update_customer_fiscal_entities_with_http_info( _param = self._update_customer_fiscal_entities_serialize( id=id, fiscal_entities_id=fiscal_entities_id, - customer_update_fiscal_entities_request=customer_update_fiscal_entities_request, + update_fiscal_entity_request=update_fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -2157,7 +2156,7 @@ def update_customer_fiscal_entities_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], fiscal_entities_id: Annotated[StrictStr, Field(description="identifier")], - customer_update_fiscal_entities_request: Annotated[CustomerUpdateFiscalEntitiesRequest, Field(description="requested field for customer update fiscal entities")], + update_fiscal_entity_request: Annotated[UpdateFiscalEntityRequest, Field(description="requested field for customer update fiscal entities")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -2181,8 +2180,8 @@ def update_customer_fiscal_entities_without_preload_content( :type id: str :param fiscal_entities_id: identifier (required) :type fiscal_entities_id: str - :param customer_update_fiscal_entities_request: requested field for customer update fiscal entities (required) - :type customer_update_fiscal_entities_request: CustomerUpdateFiscalEntitiesRequest + :param update_fiscal_entity_request: requested field for customer update fiscal entities (required) + :type update_fiscal_entity_request: UpdateFiscalEntityRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -2212,7 +2211,7 @@ def update_customer_fiscal_entities_without_preload_content( _param = self._update_customer_fiscal_entities_serialize( id=id, fiscal_entities_id=fiscal_entities_id, - customer_update_fiscal_entities_request=customer_update_fiscal_entities_request, + update_fiscal_entity_request=update_fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -2239,7 +2238,7 @@ def _update_customer_fiscal_entities_serialize( self, id, fiscal_entities_id, - customer_update_fiscal_entities_request, + update_fiscal_entity_request, accept_language, x_child_company_id, _request_auth, @@ -2275,8 +2274,8 @@ def _update_customer_fiscal_entities_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if customer_update_fiscal_entities_request is not None: - _body_params = customer_update_fiscal_entities_request + if update_fiscal_entity_request is not None: + _body_params = update_fiscal_entity_request # set the HTTP header `Accept` diff --git a/conekta/api/discounts_api.py b/conekta/api/discounts_api.py index c8e5c3c..4f8df8f 100644 --- a/conekta/api/discounts_api.py +++ b/conekta/api/discounts_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/events_api.py b/conekta/api/events_api.py index 75e3bf6..3b5df2f 100644 --- a/conekta/api/events_api.py +++ b/conekta/api/events_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -23,7 +22,7 @@ from conekta.models.event_response import EventResponse from conekta.models.events_resend_response import EventsResendResponse from conekta.models.get_events_response import GetEventsResponse -from conekta.models.resend_request import ResendRequest +from conekta.models.resend_event_request import ResendEventRequest from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -694,7 +693,7 @@ def _get_events_serialize( def resend_event( self, event_id: Annotated[StrictStr, Field(description="event identifier")], - resend_request: Annotated[ResendRequest, Field(description="requested fields for resend an event")], + resend_event_request: Annotated[ResendEventRequest, Field(description="requested fields for resend an event")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -715,8 +714,8 @@ def resend_event( :param event_id: event identifier (required) :type event_id: str - :param resend_request: requested fields for resend an event (required) - :type resend_request: ResendRequest + :param resend_event_request: requested fields for resend an event (required) + :type resend_event_request: ResendEventRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -743,7 +742,7 @@ def resend_event( _param = self._resend_event_serialize( event_id=event_id, - resend_request=resend_request, + resend_event_request=resend_event_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -772,7 +771,7 @@ def resend_event( def resend_event_with_http_info( self, event_id: Annotated[StrictStr, Field(description="event identifier")], - resend_request: Annotated[ResendRequest, Field(description="requested fields for resend an event")], + resend_event_request: Annotated[ResendEventRequest, Field(description="requested fields for resend an event")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -793,8 +792,8 @@ def resend_event_with_http_info( :param event_id: event identifier (required) :type event_id: str - :param resend_request: requested fields for resend an event (required) - :type resend_request: ResendRequest + :param resend_event_request: requested fields for resend an event (required) + :type resend_event_request: ResendEventRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -821,7 +820,7 @@ def resend_event_with_http_info( _param = self._resend_event_serialize( event_id=event_id, - resend_request=resend_request, + resend_event_request=resend_event_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -850,7 +849,7 @@ def resend_event_with_http_info( def resend_event_without_preload_content( self, event_id: Annotated[StrictStr, Field(description="event identifier")], - resend_request: Annotated[ResendRequest, Field(description="requested fields for resend an event")], + resend_event_request: Annotated[ResendEventRequest, Field(description="requested fields for resend an event")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -871,8 +870,8 @@ def resend_event_without_preload_content( :param event_id: event identifier (required) :type event_id: str - :param resend_request: requested fields for resend an event (required) - :type resend_request: ResendRequest + :param resend_event_request: requested fields for resend an event (required) + :type resend_event_request: ResendEventRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -899,7 +898,7 @@ def resend_event_without_preload_content( _param = self._resend_event_serialize( event_id=event_id, - resend_request=resend_request, + resend_event_request=resend_event_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -923,7 +922,7 @@ def resend_event_without_preload_content( def _resend_event_serialize( self, event_id, - resend_request, + resend_event_request, accept_language, _request_auth, _content_type, @@ -954,8 +953,8 @@ def _resend_event_serialize( _header_params['Accept-Language'] = accept_language # process the form parameters # process the body parameter - if resend_request is not None: - _body_params = resend_request + if resend_event_request is not None: + _body_params = resend_event_request # set the HTTP header `Accept` diff --git a/conekta/api/logs_api.py b/conekta/api/logs_api.py index dd2725d..a442038 100644 --- a/conekta/api/logs_api.py +++ b/conekta/api/logs_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -20,8 +19,8 @@ from pydantic import Field, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated -from conekta.models.log_response import LogResponse -from conekta.models.logs_response import LogsResponse +from conekta.models.log_response_for_request import LogResponseForRequest +from conekta.models.logs_response_for_request import LogsResponseForRequest from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -59,7 +58,7 @@ def get_log_by_id( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> LogResponse: + ) -> LogResponseForRequest: """Get Log Get the details of a specific log @@ -103,7 +102,7 @@ def get_log_by_id( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LogResponse", + '200': "LogResponseForRequest", '401': "Error", '404': "Error", '500': "Error", @@ -137,7 +136,7 @@ def get_log_by_id_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[LogResponse]: + ) -> ApiResponse[LogResponseForRequest]: """Get Log Get the details of a specific log @@ -181,7 +180,7 @@ def get_log_by_id_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LogResponse", + '200': "LogResponseForRequest", '401': "Error", '404': "Error", '500': "Error", @@ -259,7 +258,7 @@ def get_log_by_id_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LogResponse", + '200': "LogResponseForRequest", '401': "Error", '404': "Error", '500': "Error", @@ -362,7 +361,7 @@ def get_logs( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> LogsResponse: + ) -> LogsResponseForRequest: """Get List Of Logs Get log details in the form of a list @@ -415,7 +414,7 @@ def get_logs( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LogsResponse", + '200': "LogsResponseForRequest", '401': "Error", '500': "Error", } @@ -451,7 +450,7 @@ def get_logs_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[LogsResponse]: + ) -> ApiResponse[LogsResponseForRequest]: """Get List Of Logs Get log details in the form of a list @@ -504,7 +503,7 @@ def get_logs_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LogsResponse", + '200': "LogsResponseForRequest", '401': "Error", '500': "Error", } @@ -593,7 +592,7 @@ def get_logs_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LogsResponse", + '200': "LogsResponseForRequest", '401': "Error", '500': "Error", } diff --git a/conekta/api/orders_api.py b/conekta/api/orders_api.py index ae315e8..e03419e 100644 --- a/conekta/api/orders_api.py +++ b/conekta/api/orders_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -25,7 +24,7 @@ from conekta.models.order_refund_request import OrderRefundRequest from conekta.models.order_request import OrderRequest from conekta.models.order_response import OrderResponse -from conekta.models.order_update_request import OrderUpdateRequest +from conekta.models.order_update import OrderUpdate from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -673,6 +672,7 @@ def get_order_by_id( id: Annotated[StrictStr, Field(description="Identifier of the resource")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, + client: Annotated[Optional[StrictStr], Field(description="client of the object to be retrieved")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -696,6 +696,8 @@ def get_order_by_id( :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. :type x_child_company_id: str + :param client: client of the object to be retrieved + :type client: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -722,6 +724,7 @@ def get_order_by_id( id=id, accept_language=accept_language, x_child_company_id=x_child_company_id, + client=client, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -751,6 +754,7 @@ def get_order_by_id_with_http_info( id: Annotated[StrictStr, Field(description="Identifier of the resource")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, + client: Annotated[Optional[StrictStr], Field(description="client of the object to be retrieved")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -774,6 +778,8 @@ def get_order_by_id_with_http_info( :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. :type x_child_company_id: str + :param client: client of the object to be retrieved + :type client: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -800,6 +806,7 @@ def get_order_by_id_with_http_info( id=id, accept_language=accept_language, x_child_company_id=x_child_company_id, + client=client, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -829,6 +836,7 @@ def get_order_by_id_without_preload_content( id: Annotated[StrictStr, Field(description="Identifier of the resource")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, + client: Annotated[Optional[StrictStr], Field(description="client of the object to be retrieved")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -852,6 +860,8 @@ def get_order_by_id_without_preload_content( :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. :type x_child_company_id: str + :param client: client of the object to be retrieved + :type client: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -878,6 +888,7 @@ def get_order_by_id_without_preload_content( id=id, accept_language=accept_language, x_child_company_id=x_child_company_id, + client=client, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -902,6 +913,7 @@ def _get_order_by_id_serialize( id, accept_language, x_child_company_id, + client, _request_auth, _content_type, _headers, @@ -926,6 +938,10 @@ def _get_order_by_id_serialize( if id is not None: _path_params['id'] = id # process the query parameters + if client is not None: + + _query_params.append(('client', client)) + # process the header parameters if accept_language is not None: _header_params['Accept-Language'] = accept_language @@ -2426,7 +2442,7 @@ def _orders_create_capture_serialize( def update_order( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - order_update_request: Annotated[OrderUpdateRequest, Field(description="requested field for an order")], + order_update: Annotated[OrderUpdate, Field(description="requested field for an order")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -2447,8 +2463,8 @@ def update_order( :param id: Identifier of the resource (required) :type id: str - :param order_update_request: requested field for an order (required) - :type order_update_request: OrderUpdateRequest + :param order_update: requested field for an order (required) + :type order_update: OrderUpdate :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -2475,7 +2491,7 @@ def update_order( _param = self._update_order_serialize( id=id, - order_update_request=order_update_request, + order_update=order_update, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -2505,7 +2521,7 @@ def update_order( def update_order_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - order_update_request: Annotated[OrderUpdateRequest, Field(description="requested field for an order")], + order_update: Annotated[OrderUpdate, Field(description="requested field for an order")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -2526,8 +2542,8 @@ def update_order_with_http_info( :param id: Identifier of the resource (required) :type id: str - :param order_update_request: requested field for an order (required) - :type order_update_request: OrderUpdateRequest + :param order_update: requested field for an order (required) + :type order_update: OrderUpdate :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -2554,7 +2570,7 @@ def update_order_with_http_info( _param = self._update_order_serialize( id=id, - order_update_request=order_update_request, + order_update=order_update, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -2584,7 +2600,7 @@ def update_order_with_http_info( def update_order_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - order_update_request: Annotated[OrderUpdateRequest, Field(description="requested field for an order")], + order_update: Annotated[OrderUpdate, Field(description="requested field for an order")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -2605,8 +2621,8 @@ def update_order_without_preload_content( :param id: Identifier of the resource (required) :type id: str - :param order_update_request: requested field for an order (required) - :type order_update_request: OrderUpdateRequest + :param order_update: requested field for an order (required) + :type order_update: OrderUpdate :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -2633,7 +2649,7 @@ def update_order_without_preload_content( _param = self._update_order_serialize( id=id, - order_update_request=order_update_request, + order_update=order_update, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -2658,7 +2674,7 @@ def update_order_without_preload_content( def _update_order_serialize( self, id, - order_update_request, + order_update, accept_language, _request_auth, _content_type, @@ -2689,8 +2705,8 @@ def _update_order_serialize( _header_params['Accept-Language'] = accept_language # process the form parameters # process the body parameter - if order_update_request is not None: - _body_params = order_update_request + if order_update is not None: + _body_params = order_update # set the HTTP header `Accept` diff --git a/conekta/api/payment_link_api.py b/conekta/api/payment_link_api.py index d1cfc84..0d3930d 100644 --- a/conekta/api/payment_link_api.py +++ b/conekta/api/payment_link_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/payment_methods_api.py b/conekta/api/payment_methods_api.py index a060c8f..564cfc1 100644 --- a/conekta/api/payment_methods_api.py +++ b/conekta/api/payment_methods_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -24,7 +23,7 @@ from conekta.models.create_customer_payment_methods_response import CreateCustomerPaymentMethodsResponse from conekta.models.get_payment_method_response import GetPaymentMethodResponse from conekta.models.update_customer_payment_methods_response import UpdateCustomerPaymentMethodsResponse -from conekta.models.update_payment_methods import UpdatePaymentMethods +from conekta.models.update_payment_methods_card import UpdatePaymentMethodsCard from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -1066,7 +1065,7 @@ def update_customer_payment_methods( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], payment_method_id: Annotated[StrictStr, Field(description="Identifier of the payment method")], - update_payment_methods: Annotated[UpdatePaymentMethods, Field(description="requested field for customer payment methods")], + update_payment_methods_card: Annotated[UpdatePaymentMethodsCard, Field(description="requested field for customer payment methods")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -1090,8 +1089,8 @@ def update_customer_payment_methods( :type id: str :param payment_method_id: Identifier of the payment method (required) :type payment_method_id: str - :param update_payment_methods: requested field for customer payment methods (required) - :type update_payment_methods: UpdatePaymentMethods + :param update_payment_methods_card: requested field for customer payment methods (required) + :type update_payment_methods_card: UpdatePaymentMethodsCard :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -1121,7 +1120,7 @@ def update_customer_payment_methods( _param = self._update_customer_payment_methods_serialize( id=id, payment_method_id=payment_method_id, - update_payment_methods=update_payment_methods, + update_payment_methods_card=update_payment_methods_card, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -1153,7 +1152,7 @@ def update_customer_payment_methods_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], payment_method_id: Annotated[StrictStr, Field(description="Identifier of the payment method")], - update_payment_methods: Annotated[UpdatePaymentMethods, Field(description="requested field for customer payment methods")], + update_payment_methods_card: Annotated[UpdatePaymentMethodsCard, Field(description="requested field for customer payment methods")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -1177,8 +1176,8 @@ def update_customer_payment_methods_with_http_info( :type id: str :param payment_method_id: Identifier of the payment method (required) :type payment_method_id: str - :param update_payment_methods: requested field for customer payment methods (required) - :type update_payment_methods: UpdatePaymentMethods + :param update_payment_methods_card: requested field for customer payment methods (required) + :type update_payment_methods_card: UpdatePaymentMethodsCard :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -1208,7 +1207,7 @@ def update_customer_payment_methods_with_http_info( _param = self._update_customer_payment_methods_serialize( id=id, payment_method_id=payment_method_id, - update_payment_methods=update_payment_methods, + update_payment_methods_card=update_payment_methods_card, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -1240,7 +1239,7 @@ def update_customer_payment_methods_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], payment_method_id: Annotated[StrictStr, Field(description="Identifier of the payment method")], - update_payment_methods: Annotated[UpdatePaymentMethods, Field(description="requested field for customer payment methods")], + update_payment_methods_card: Annotated[UpdatePaymentMethodsCard, Field(description="requested field for customer payment methods")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -1264,8 +1263,8 @@ def update_customer_payment_methods_without_preload_content( :type id: str :param payment_method_id: Identifier of the payment method (required) :type payment_method_id: str - :param update_payment_methods: requested field for customer payment methods (required) - :type update_payment_methods: UpdatePaymentMethods + :param update_payment_methods_card: requested field for customer payment methods (required) + :type update_payment_methods_card: UpdatePaymentMethodsCard :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -1295,7 +1294,7 @@ def update_customer_payment_methods_without_preload_content( _param = self._update_customer_payment_methods_serialize( id=id, payment_method_id=payment_method_id, - update_payment_methods=update_payment_methods, + update_payment_methods_card=update_payment_methods_card, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -1322,7 +1321,7 @@ def _update_customer_payment_methods_serialize( self, id, payment_method_id, - update_payment_methods, + update_payment_methods_card, accept_language, x_child_company_id, _request_auth, @@ -1358,8 +1357,8 @@ def _update_customer_payment_methods_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if update_payment_methods is not None: - _body_params = update_payment_methods + if update_payment_methods_card is not None: + _body_params = update_payment_methods_card # set the HTTP header `Accept` diff --git a/conekta/api/payout_orders_api.py b/conekta/api/payout_orders_api.py index 3d9e1d9..dd3b653 100644 --- a/conekta/api/payout_orders_api.py +++ b/conekta/api/payout_orders_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -20,7 +19,7 @@ from pydantic import Field, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated -from conekta.models.payout_order import PayoutOrder +from conekta.models.payout_order_request import PayoutOrderRequest from conekta.models.payout_order_response import PayoutOrderResponse from conekta.models.payout_orders_response import PayoutOrdersResponse @@ -330,7 +329,7 @@ def _cancel_payout_order_by_id_serialize( @validate_call def create_payout_order( self, - payout_order: Annotated[PayoutOrder, Field(description="requested field for payout order")], + payout_order_request: Annotated[PayoutOrderRequest, Field(description="requested field for payout order")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -349,8 +348,8 @@ def create_payout_order( Create a new payout order. - :param payout_order: requested field for payout order (required) - :type payout_order: PayoutOrder + :param payout_order_request: requested field for payout order (required) + :type payout_order_request: PayoutOrderRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -376,7 +375,7 @@ def create_payout_order( """ # noqa: E501 _param = self._create_payout_order_serialize( - payout_order=payout_order, + payout_order_request=payout_order_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -406,7 +405,7 @@ def create_payout_order( @validate_call def create_payout_order_with_http_info( self, - payout_order: Annotated[PayoutOrder, Field(description="requested field for payout order")], + payout_order_request: Annotated[PayoutOrderRequest, Field(description="requested field for payout order")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -425,8 +424,8 @@ def create_payout_order_with_http_info( Create a new payout order. - :param payout_order: requested field for payout order (required) - :type payout_order: PayoutOrder + :param payout_order_request: requested field for payout order (required) + :type payout_order_request: PayoutOrderRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -452,7 +451,7 @@ def create_payout_order_with_http_info( """ # noqa: E501 _param = self._create_payout_order_serialize( - payout_order=payout_order, + payout_order_request=payout_order_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -482,7 +481,7 @@ def create_payout_order_with_http_info( @validate_call def create_payout_order_without_preload_content( self, - payout_order: Annotated[PayoutOrder, Field(description="requested field for payout order")], + payout_order_request: Annotated[PayoutOrderRequest, Field(description="requested field for payout order")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -501,8 +500,8 @@ def create_payout_order_without_preload_content( Create a new payout order. - :param payout_order: requested field for payout order (required) - :type payout_order: PayoutOrder + :param payout_order_request: requested field for payout order (required) + :type payout_order_request: PayoutOrderRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -528,7 +527,7 @@ def create_payout_order_without_preload_content( """ # noqa: E501 _param = self._create_payout_order_serialize( - payout_order=payout_order, + payout_order_request=payout_order_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -553,7 +552,7 @@ def create_payout_order_without_preload_content( def _create_payout_order_serialize( self, - payout_order, + payout_order_request, accept_language, _request_auth, _content_type, @@ -582,8 +581,8 @@ def _create_payout_order_serialize( _header_params['Accept-Language'] = accept_language # process the form parameters # process the body parameter - if payout_order is not None: - _body_params = payout_order + if payout_order_request is not None: + _body_params = payout_order_request # set the HTTP header `Accept` diff --git a/conekta/api/plans_api.py b/conekta/api/plans_api.py index c0ccc24..899b652 100644 --- a/conekta/api/plans_api.py +++ b/conekta/api/plans_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,18 +10,19 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictStr, field_validator +from pydantic import Field, StrictInt, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated from conekta.models.get_plans_response import GetPlansResponse from conekta.models.plan_request import PlanRequest from conekta.models.plan_response import PlanResponse -from conekta.models.plan_update_request import PlanUpdateRequest +from conekta.models.update_plan import UpdatePlan from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -950,6 +949,8 @@ def get_plans( search: Annotated[Optional[StrictStr], Field(description="General order search, e.g. by mail, reference etc.")] = None, next: Annotated[Optional[StrictStr], Field(description="next page")] = None, previous: Annotated[Optional[StrictStr], Field(description="previous page")] = None, + currency: Annotated[Optional[StrictStr], Field(description="currency of the object to be retrieved")] = None, + frequency: Annotated[Optional[StrictInt], Field(description="frequency of the object to be retrieved")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -978,6 +979,10 @@ def get_plans( :type next: str :param previous: previous page :type previous: str + :param currency: currency of the object to be retrieved + :type currency: str + :param frequency: frequency of the object to be retrieved + :type frequency: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1007,6 +1012,8 @@ def get_plans( search=search, next=next, previous=previous, + currency=currency, + frequency=frequency, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1039,6 +1046,8 @@ def get_plans_with_http_info( search: Annotated[Optional[StrictStr], Field(description="General order search, e.g. by mail, reference etc.")] = None, next: Annotated[Optional[StrictStr], Field(description="next page")] = None, previous: Annotated[Optional[StrictStr], Field(description="previous page")] = None, + currency: Annotated[Optional[StrictStr], Field(description="currency of the object to be retrieved")] = None, + frequency: Annotated[Optional[StrictInt], Field(description="frequency of the object to be retrieved")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1067,6 +1076,10 @@ def get_plans_with_http_info( :type next: str :param previous: previous page :type previous: str + :param currency: currency of the object to be retrieved + :type currency: str + :param frequency: frequency of the object to be retrieved + :type frequency: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1096,6 +1109,8 @@ def get_plans_with_http_info( search=search, next=next, previous=previous, + currency=currency, + frequency=frequency, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1128,6 +1143,8 @@ def get_plans_without_preload_content( search: Annotated[Optional[StrictStr], Field(description="General order search, e.g. by mail, reference etc.")] = None, next: Annotated[Optional[StrictStr], Field(description="next page")] = None, previous: Annotated[Optional[StrictStr], Field(description="previous page")] = None, + currency: Annotated[Optional[StrictStr], Field(description="currency of the object to be retrieved")] = None, + frequency: Annotated[Optional[StrictInt], Field(description="frequency of the object to be retrieved")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1156,6 +1173,10 @@ def get_plans_without_preload_content( :type next: str :param previous: previous page :type previous: str + :param currency: currency of the object to be retrieved + :type currency: str + :param frequency: frequency of the object to be retrieved + :type frequency: int :param _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of @@ -1185,6 +1206,8 @@ def get_plans_without_preload_content( search=search, next=next, previous=previous, + currency=currency, + frequency=frequency, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1212,6 +1235,8 @@ def _get_plans_serialize( search, next, previous, + currency, + frequency, _request_auth, _content_type, _headers, @@ -1250,6 +1275,14 @@ def _get_plans_serialize( _query_params.append(('previous', previous)) + if currency is not None: + + _query_params.append(('currency', currency)) + + if frequency is not None: + + _query_params.append(('frequency', frequency)) + # process the header parameters if accept_language is not None: _header_params['Accept-Language'] = accept_language @@ -1295,7 +1328,7 @@ def _get_plans_serialize( def update_plan( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - plan_update_request: Annotated[PlanUpdateRequest, Field(description="requested field for plan")], + update_plan: Annotated[UpdatePlan, Field(description="requested field for plan")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -1316,8 +1349,8 @@ def update_plan( :param id: Identifier of the resource (required) :type id: str - :param plan_update_request: requested field for plan (required) - :type plan_update_request: PlanUpdateRequest + :param update_plan: requested field for plan (required) + :type update_plan: UpdatePlan :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -1346,7 +1379,7 @@ def update_plan( _param = self._update_plan_serialize( id=id, - plan_update_request=plan_update_request, + update_plan=update_plan, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -1377,7 +1410,7 @@ def update_plan( def update_plan_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - plan_update_request: Annotated[PlanUpdateRequest, Field(description="requested field for plan")], + update_plan: Annotated[UpdatePlan, Field(description="requested field for plan")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -1398,8 +1431,8 @@ def update_plan_with_http_info( :param id: Identifier of the resource (required) :type id: str - :param plan_update_request: requested field for plan (required) - :type plan_update_request: PlanUpdateRequest + :param update_plan: requested field for plan (required) + :type update_plan: UpdatePlan :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -1428,7 +1461,7 @@ def update_plan_with_http_info( _param = self._update_plan_serialize( id=id, - plan_update_request=plan_update_request, + update_plan=update_plan, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -1459,7 +1492,7 @@ def update_plan_with_http_info( def update_plan_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - plan_update_request: Annotated[PlanUpdateRequest, Field(description="requested field for plan")], + update_plan: Annotated[UpdatePlan, Field(description="requested field for plan")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -1480,8 +1513,8 @@ def update_plan_without_preload_content( :param id: Identifier of the resource (required) :type id: str - :param plan_update_request: requested field for plan (required) - :type plan_update_request: PlanUpdateRequest + :param update_plan: requested field for plan (required) + :type update_plan: UpdatePlan :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -1510,7 +1543,7 @@ def update_plan_without_preload_content( _param = self._update_plan_serialize( id=id, - plan_update_request=plan_update_request, + update_plan=update_plan, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -1536,7 +1569,7 @@ def update_plan_without_preload_content( def _update_plan_serialize( self, id, - plan_update_request, + update_plan, accept_language, x_child_company_id, _request_auth, @@ -1570,8 +1603,8 @@ def _update_plan_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if plan_update_request is not None: - _body_params = plan_update_request + if update_plan is not None: + _body_params = update_plan # set the HTTP header `Accept` diff --git a/conekta/api/products_api.py b/conekta/api/products_api.py index b112933..dd37acd 100644 --- a/conekta/api/products_api.py +++ b/conekta/api/products_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/shipping_contacts_api.py b/conekta/api/shipping_contacts_api.py index 78e6a1b..200e7f2 100644 --- a/conekta/api/shipping_contacts_api.py +++ b/conekta/api/shipping_contacts_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -20,9 +19,9 @@ from pydantic import Field, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated -from conekta.models.customer_shipping_contacts import CustomerShippingContacts +from conekta.models.customer_shipping_contacts_request import CustomerShippingContactsRequest from conekta.models.customer_shipping_contacts_response import CustomerShippingContactsResponse -from conekta.models.customer_update_shipping_contacts import CustomerUpdateShippingContacts +from conekta.models.customer_update_shipping_contacts_request import CustomerUpdateShippingContactsRequest from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -46,7 +45,7 @@ def __init__(self, api_client=None) -> None: def create_customer_shipping_contacts( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - customer_shipping_contacts: Annotated[CustomerShippingContacts, Field(description="requested field for customer shippings contacts")], + customer_shipping_contacts_request: Annotated[CustomerShippingContactsRequest, Field(description="requested field for customer shippings contacts")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -68,8 +67,8 @@ def create_customer_shipping_contacts( :param id: Identifier of the resource (required) :type id: str - :param customer_shipping_contacts: requested field for customer shippings contacts (required) - :type customer_shipping_contacts: CustomerShippingContacts + :param customer_shipping_contacts_request: requested field for customer shippings contacts (required) + :type customer_shipping_contacts_request: CustomerShippingContactsRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -98,7 +97,7 @@ def create_customer_shipping_contacts( _param = self._create_customer_shipping_contacts_serialize( id=id, - customer_shipping_contacts=customer_shipping_contacts, + customer_shipping_contacts_request=customer_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -129,7 +128,7 @@ def create_customer_shipping_contacts( def create_customer_shipping_contacts_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - customer_shipping_contacts: Annotated[CustomerShippingContacts, Field(description="requested field for customer shippings contacts")], + customer_shipping_contacts_request: Annotated[CustomerShippingContactsRequest, Field(description="requested field for customer shippings contacts")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -151,8 +150,8 @@ def create_customer_shipping_contacts_with_http_info( :param id: Identifier of the resource (required) :type id: str - :param customer_shipping_contacts: requested field for customer shippings contacts (required) - :type customer_shipping_contacts: CustomerShippingContacts + :param customer_shipping_contacts_request: requested field for customer shippings contacts (required) + :type customer_shipping_contacts_request: CustomerShippingContactsRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -181,7 +180,7 @@ def create_customer_shipping_contacts_with_http_info( _param = self._create_customer_shipping_contacts_serialize( id=id, - customer_shipping_contacts=customer_shipping_contacts, + customer_shipping_contacts_request=customer_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -212,7 +211,7 @@ def create_customer_shipping_contacts_with_http_info( def create_customer_shipping_contacts_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - customer_shipping_contacts: Annotated[CustomerShippingContacts, Field(description="requested field for customer shippings contacts")], + customer_shipping_contacts_request: Annotated[CustomerShippingContactsRequest, Field(description="requested field for customer shippings contacts")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -234,8 +233,8 @@ def create_customer_shipping_contacts_without_preload_content( :param id: Identifier of the resource (required) :type id: str - :param customer_shipping_contacts: requested field for customer shippings contacts (required) - :type customer_shipping_contacts: CustomerShippingContacts + :param customer_shipping_contacts_request: requested field for customer shippings contacts (required) + :type customer_shipping_contacts_request: CustomerShippingContactsRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -264,7 +263,7 @@ def create_customer_shipping_contacts_without_preload_content( _param = self._create_customer_shipping_contacts_serialize( id=id, - customer_shipping_contacts=customer_shipping_contacts, + customer_shipping_contacts_request=customer_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -290,7 +289,7 @@ def create_customer_shipping_contacts_without_preload_content( def _create_customer_shipping_contacts_serialize( self, id, - customer_shipping_contacts, + customer_shipping_contacts_request, accept_language, x_child_company_id, _request_auth, @@ -324,8 +323,8 @@ def _create_customer_shipping_contacts_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if customer_shipping_contacts is not None: - _body_params = customer_shipping_contacts + if customer_shipping_contacts_request is not None: + _body_params = customer_shipping_contacts_request # set the HTTP header `Accept` @@ -696,7 +695,7 @@ def update_customer_shipping_contacts( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], shipping_contacts_id: Annotated[StrictStr, Field(description="identifier")], - customer_update_shipping_contacts: Annotated[CustomerUpdateShippingContacts, Field(description="requested field for customer update shippings contacts")], + customer_update_shipping_contacts_request: Annotated[CustomerUpdateShippingContactsRequest, Field(description="requested field for customer update shippings contacts")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -720,8 +719,8 @@ def update_customer_shipping_contacts( :type id: str :param shipping_contacts_id: identifier (required) :type shipping_contacts_id: str - :param customer_update_shipping_contacts: requested field for customer update shippings contacts (required) - :type customer_update_shipping_contacts: CustomerUpdateShippingContacts + :param customer_update_shipping_contacts_request: requested field for customer update shippings contacts (required) + :type customer_update_shipping_contacts_request: CustomerUpdateShippingContactsRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -751,7 +750,7 @@ def update_customer_shipping_contacts( _param = self._update_customer_shipping_contacts_serialize( id=id, shipping_contacts_id=shipping_contacts_id, - customer_update_shipping_contacts=customer_update_shipping_contacts, + customer_update_shipping_contacts_request=customer_update_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -783,7 +782,7 @@ def update_customer_shipping_contacts_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], shipping_contacts_id: Annotated[StrictStr, Field(description="identifier")], - customer_update_shipping_contacts: Annotated[CustomerUpdateShippingContacts, Field(description="requested field for customer update shippings contacts")], + customer_update_shipping_contacts_request: Annotated[CustomerUpdateShippingContactsRequest, Field(description="requested field for customer update shippings contacts")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -807,8 +806,8 @@ def update_customer_shipping_contacts_with_http_info( :type id: str :param shipping_contacts_id: identifier (required) :type shipping_contacts_id: str - :param customer_update_shipping_contacts: requested field for customer update shippings contacts (required) - :type customer_update_shipping_contacts: CustomerUpdateShippingContacts + :param customer_update_shipping_contacts_request: requested field for customer update shippings contacts (required) + :type customer_update_shipping_contacts_request: CustomerUpdateShippingContactsRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -838,7 +837,7 @@ def update_customer_shipping_contacts_with_http_info( _param = self._update_customer_shipping_contacts_serialize( id=id, shipping_contacts_id=shipping_contacts_id, - customer_update_shipping_contacts=customer_update_shipping_contacts, + customer_update_shipping_contacts_request=customer_update_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -870,7 +869,7 @@ def update_customer_shipping_contacts_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], shipping_contacts_id: Annotated[StrictStr, Field(description="identifier")], - customer_update_shipping_contacts: Annotated[CustomerUpdateShippingContacts, Field(description="requested field for customer update shippings contacts")], + customer_update_shipping_contacts_request: Annotated[CustomerUpdateShippingContactsRequest, Field(description="requested field for customer update shippings contacts")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -894,8 +893,8 @@ def update_customer_shipping_contacts_without_preload_content( :type id: str :param shipping_contacts_id: identifier (required) :type shipping_contacts_id: str - :param customer_update_shipping_contacts: requested field for customer update shippings contacts (required) - :type customer_update_shipping_contacts: CustomerUpdateShippingContacts + :param customer_update_shipping_contacts_request: requested field for customer update shippings contacts (required) + :type customer_update_shipping_contacts_request: CustomerUpdateShippingContactsRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -925,7 +924,7 @@ def update_customer_shipping_contacts_without_preload_content( _param = self._update_customer_shipping_contacts_serialize( id=id, shipping_contacts_id=shipping_contacts_id, - customer_update_shipping_contacts=customer_update_shipping_contacts, + customer_update_shipping_contacts_request=customer_update_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -952,7 +951,7 @@ def _update_customer_shipping_contacts_serialize( self, id, shipping_contacts_id, - customer_update_shipping_contacts, + customer_update_shipping_contacts_request, accept_language, x_child_company_id, _request_auth, @@ -988,8 +987,8 @@ def _update_customer_shipping_contacts_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if customer_update_shipping_contacts is not None: - _body_params = customer_update_shipping_contacts + if customer_update_shipping_contacts_request is not None: + _body_params = customer_update_shipping_contacts_request # set the HTTP header `Accept` diff --git a/conekta/api/shippings_api.py b/conekta/api/shippings_api.py index 75971db..d9b6694 100644 --- a/conekta/api/shippings_api.py +++ b/conekta/api/shippings_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/subscriptions_api.py b/conekta/api/subscriptions_api.py index 27740ae..c3ebf60 100644 --- a/conekta/api/subscriptions_api.py +++ b/conekta/api/subscriptions_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -23,7 +22,7 @@ from conekta.models.subscription_events_response import SubscriptionEventsResponse from conekta.models.subscription_request import SubscriptionRequest from conekta.models.subscription_response import SubscriptionResponse -from conekta.models.subscription_update_request import SubscriptionUpdateRequest +from conekta.models.updates_a_subscription import UpdatesASubscription from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -3924,7 +3923,7 @@ def subscription_update( self, customer_id: Annotated[StrictStr, Field(description="Identifier of the customer resource")], id: Annotated[StrictStr, Field(description="Identifier of the subscription resource")], - subscription_update_request: Annotated[SubscriptionUpdateRequest, Field(description="requested field for update a subscription")], + updates_a_subscription: Annotated[UpdatesASubscription, Field(description="requested field for update a subscription")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -3948,8 +3947,8 @@ def subscription_update( :type customer_id: str :param id: Identifier of the subscription resource (required) :type id: str - :param subscription_update_request: requested field for update a subscription (required) - :type subscription_update_request: SubscriptionUpdateRequest + :param updates_a_subscription: requested field for update a subscription (required) + :type updates_a_subscription: UpdatesASubscription :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -3979,7 +3978,7 @@ def subscription_update( _param = self._subscription_update_serialize( customer_id=customer_id, id=id, - subscription_update_request=subscription_update_request, + updates_a_subscription=updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -4011,7 +4010,7 @@ def subscription_update_with_http_info( self, customer_id: Annotated[StrictStr, Field(description="Identifier of the customer resource")], id: Annotated[StrictStr, Field(description="Identifier of the subscription resource")], - subscription_update_request: Annotated[SubscriptionUpdateRequest, Field(description="requested field for update a subscription")], + updates_a_subscription: Annotated[UpdatesASubscription, Field(description="requested field for update a subscription")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -4035,8 +4034,8 @@ def subscription_update_with_http_info( :type customer_id: str :param id: Identifier of the subscription resource (required) :type id: str - :param subscription_update_request: requested field for update a subscription (required) - :type subscription_update_request: SubscriptionUpdateRequest + :param updates_a_subscription: requested field for update a subscription (required) + :type updates_a_subscription: UpdatesASubscription :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -4066,7 +4065,7 @@ def subscription_update_with_http_info( _param = self._subscription_update_serialize( customer_id=customer_id, id=id, - subscription_update_request=subscription_update_request, + updates_a_subscription=updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -4098,7 +4097,7 @@ def subscription_update_without_preload_content( self, customer_id: Annotated[StrictStr, Field(description="Identifier of the customer resource")], id: Annotated[StrictStr, Field(description="Identifier of the subscription resource")], - subscription_update_request: Annotated[SubscriptionUpdateRequest, Field(description="requested field for update a subscription")], + updates_a_subscription: Annotated[UpdatesASubscription, Field(description="requested field for update a subscription")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -4122,8 +4121,8 @@ def subscription_update_without_preload_content( :type customer_id: str :param id: Identifier of the subscription resource (required) :type id: str - :param subscription_update_request: requested field for update a subscription (required) - :type subscription_update_request: SubscriptionUpdateRequest + :param updates_a_subscription: requested field for update a subscription (required) + :type updates_a_subscription: UpdatesASubscription :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -4153,7 +4152,7 @@ def subscription_update_without_preload_content( _param = self._subscription_update_serialize( customer_id=customer_id, id=id, - subscription_update_request=subscription_update_request, + updates_a_subscription=updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -4180,7 +4179,7 @@ def _subscription_update_serialize( self, customer_id, id, - subscription_update_request, + updates_a_subscription, accept_language, x_child_company_id, _request_auth, @@ -4216,8 +4215,8 @@ def _subscription_update_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if subscription_update_request is not None: - _body_params = subscription_update_request + if updates_a_subscription is not None: + _body_params = updates_a_subscription # set the HTTP header `Accept` @@ -4647,9 +4646,9 @@ def subscriptions_retry( _response_types_map: Dict[str, Optional[str]] = { '200': "SubscriptionResponse", + '422': "Error", '401': "Error", '404': "Error", - '422': "Error", '500': "Error", } response_data = self.api_client.call_api( @@ -4730,9 +4729,9 @@ def subscriptions_retry_with_http_info( _response_types_map: Dict[str, Optional[str]] = { '200': "SubscriptionResponse", + '422': "Error", '401': "Error", '404': "Error", - '422': "Error", '500': "Error", } response_data = self.api_client.call_api( @@ -4813,9 +4812,9 @@ def subscriptions_retry_without_preload_content( _response_types_map: Dict[str, Optional[str]] = { '200': "SubscriptionResponse", + '422': "Error", '401': "Error", '404': "Error", - '422': "Error", '500': "Error", } response_data = self.api_client.call_api( @@ -4902,7 +4901,7 @@ def _subscriptions_retry_serialize( def update_subscription( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - subscription_update_request: Annotated[SubscriptionUpdateRequest, Field(description="requested field for update a subscription")], + updates_a_subscription: Annotated[UpdatesASubscription, Field(description="requested field for update a subscription")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -4924,8 +4923,8 @@ def update_subscription( :param id: Identifier of the resource (required) :type id: str - :param subscription_update_request: requested field for update a subscription (required) - :type subscription_update_request: SubscriptionUpdateRequest + :param updates_a_subscription: requested field for update a subscription (required) + :type updates_a_subscription: UpdatesASubscription :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -4955,7 +4954,7 @@ def update_subscription( _param = self._update_subscription_serialize( id=id, - subscription_update_request=subscription_update_request, + updates_a_subscription=updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -4986,7 +4985,7 @@ def update_subscription( def update_subscription_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - subscription_update_request: Annotated[SubscriptionUpdateRequest, Field(description="requested field for update a subscription")], + updates_a_subscription: Annotated[UpdatesASubscription, Field(description="requested field for update a subscription")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -5008,8 +5007,8 @@ def update_subscription_with_http_info( :param id: Identifier of the resource (required) :type id: str - :param subscription_update_request: requested field for update a subscription (required) - :type subscription_update_request: SubscriptionUpdateRequest + :param updates_a_subscription: requested field for update a subscription (required) + :type updates_a_subscription: UpdatesASubscription :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -5039,7 +5038,7 @@ def update_subscription_with_http_info( _param = self._update_subscription_serialize( id=id, - subscription_update_request=subscription_update_request, + updates_a_subscription=updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -5070,7 +5069,7 @@ def update_subscription_with_http_info( def update_subscription_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - subscription_update_request: Annotated[SubscriptionUpdateRequest, Field(description="requested field for update a subscription")], + updates_a_subscription: Annotated[UpdatesASubscription, Field(description="requested field for update a subscription")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -5092,8 +5091,8 @@ def update_subscription_without_preload_content( :param id: Identifier of the resource (required) :type id: str - :param subscription_update_request: requested field for update a subscription (required) - :type subscription_update_request: SubscriptionUpdateRequest + :param updates_a_subscription: requested field for update a subscription (required) + :type updates_a_subscription: UpdatesASubscription :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -5123,7 +5122,7 @@ def update_subscription_without_preload_content( _param = self._update_subscription_serialize( id=id, - subscription_update_request=subscription_update_request, + updates_a_subscription=updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -5149,7 +5148,7 @@ def update_subscription_without_preload_content( def _update_subscription_serialize( self, id, - subscription_update_request, + updates_a_subscription, accept_language, x_child_company_id, _request_auth, @@ -5183,8 +5182,8 @@ def _update_subscription_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if subscription_update_request is not None: - _body_params = subscription_update_request + if updates_a_subscription is not None: + _body_params = updates_a_subscription # set the HTTP header `Accept` diff --git a/conekta/api/subscriptions_customer_portal_api.py b/conekta/api/subscriptions_customer_portal_api.py new file mode 100644 index 0000000..5fb9128 --- /dev/null +++ b/conekta/api/subscriptions_customer_portal_api.py @@ -0,0 +1,636 @@ +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import warnings +from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt +from typing import Any, Dict, List, Optional, Tuple, Union +from typing_extensions import Annotated + +from pydantic import Field, StrictStr, field_validator +from typing import Optional +from typing_extensions import Annotated +from conekta.models.customer_portal_response import CustomerPortalResponse + +from conekta.api_client import ApiClient, RequestSerialized +from conekta.api_response import ApiResponse +from conekta.rest import RESTResponseType + + +class SubscriptionsCustomerPortalApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + def create_customer_portal( + self, + subscription_id: Annotated[StrictStr, Field(description="Identifier of the subscription resource")], + accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, + x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomerPortalResponse: + """Create customer portal + + Creates a customer portal for a subscription. If a portal already exists, returns the existing one. + + :param subscription_id: Identifier of the subscription resource (required) + :type subscription_id: str + :param accept_language: Use for knowing which language to use + :type accept_language: str + :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. + :type x_child_company_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_customer_portal_serialize( + subscription_id=subscription_id, + accept_language=accept_language, + x_child_company_id=x_child_company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CustomerPortalResponse", + '404': "Error", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def create_customer_portal_with_http_info( + self, + subscription_id: Annotated[StrictStr, Field(description="Identifier of the subscription resource")], + accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, + x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomerPortalResponse]: + """Create customer portal + + Creates a customer portal for a subscription. If a portal already exists, returns the existing one. + + :param subscription_id: Identifier of the subscription resource (required) + :type subscription_id: str + :param accept_language: Use for knowing which language to use + :type accept_language: str + :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. + :type x_child_company_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_customer_portal_serialize( + subscription_id=subscription_id, + accept_language=accept_language, + x_child_company_id=x_child_company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CustomerPortalResponse", + '404': "Error", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def create_customer_portal_without_preload_content( + self, + subscription_id: Annotated[StrictStr, Field(description="Identifier of the subscription resource")], + accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, + x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Create customer portal + + Creates a customer portal for a subscription. If a portal already exists, returns the existing one. + + :param subscription_id: Identifier of the subscription resource (required) + :type subscription_id: str + :param accept_language: Use for knowing which language to use + :type accept_language: str + :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. + :type x_child_company_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._create_customer_portal_serialize( + subscription_id=subscription_id, + accept_language=accept_language, + x_child_company_id=x_child_company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '201': "CustomerPortalResponse", + '404': "Error", + '401': "Error", + '422': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_customer_portal_serialize( + self, + subscription_id, + accept_language, + x_child_company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if subscription_id is not None: + _path_params['subscription_id'] = subscription_id + # process the query parameters + # process the header parameters + if accept_language is not None: + _header_params['Accept-Language'] = accept_language + if x_child_company_id is not None: + _header_params['X-Child-Company-Id'] = x_child_company_id + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/vnd.conekta-v2.2.0+json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/subscriptions/{subscription_id}/customer_portal', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + def get_customer_portal( + self, + subscription_id: Annotated[StrictStr, Field(description="Identifier of the subscription resource")], + accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, + x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> CustomerPortalResponse: + """Get customer portal + + Retrieves the customer portal for a subscription + + :param subscription_id: Identifier of the subscription resource (required) + :type subscription_id: str + :param accept_language: Use for knowing which language to use + :type accept_language: str + :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. + :type x_child_company_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_customer_portal_serialize( + subscription_id=subscription_id, + accept_language=accept_language, + x_child_company_id=x_child_company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CustomerPortalResponse", + '404': "Error", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + def get_customer_portal_with_http_info( + self, + subscription_id: Annotated[StrictStr, Field(description="Identifier of the subscription resource")], + accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, + x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[CustomerPortalResponse]: + """Get customer portal + + Retrieves the customer portal for a subscription + + :param subscription_id: Identifier of the subscription resource (required) + :type subscription_id: str + :param accept_language: Use for knowing which language to use + :type accept_language: str + :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. + :type x_child_company_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_customer_portal_serialize( + subscription_id=subscription_id, + accept_language=accept_language, + x_child_company_id=x_child_company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CustomerPortalResponse", + '404': "Error", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + def get_customer_portal_without_preload_content( + self, + subscription_id: Annotated[StrictStr, Field(description="Identifier of the subscription resource")], + accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, + x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get customer portal + + Retrieves the customer portal for a subscription + + :param subscription_id: Identifier of the subscription resource (required) + :type subscription_id: str + :param accept_language: Use for knowing which language to use + :type accept_language: str + :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. + :type x_child_company_id: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._get_customer_portal_serialize( + subscription_id=subscription_id, + accept_language=accept_language, + x_child_company_id=x_child_company_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CustomerPortalResponse", + '404': "Error", + '401': "Error", + } + response_data = self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _get_customer_portal_serialize( + self, + subscription_id, + accept_language, + x_child_company_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if subscription_id is not None: + _path_params['subscription_id'] = subscription_id + # process the query parameters + # process the header parameters + if accept_language is not None: + _header_params['Accept-Language'] = accept_language + if x_child_company_id is not None: + _header_params['X-Child-Company-Id'] = x_child_company_id + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/vnd.conekta-v2.2.0+json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + 'bearerAuth' + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/subscriptions/{subscription_id}/customer_portal', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/conekta/api/taxes_api.py b/conekta/api/taxes_api.py index ae1aab6..169e1b3 100644 --- a/conekta/api/taxes_api.py +++ b/conekta/api/taxes_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -21,8 +20,8 @@ from typing import Optional from typing_extensions import Annotated from conekta.models.order_tax_request import OrderTaxRequest -from conekta.models.update_order_tax_request import UpdateOrderTaxRequest -from conekta.models.update_order_tax_response import UpdateOrderTaxResponse +from conekta.models.order_tax_response import OrderTaxResponse +from conekta.models.orders_update_taxes_request import OrdersUpdateTaxesRequest from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -61,7 +60,7 @@ def orders_create_taxes( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> UpdateOrderTaxResponse: + ) -> OrderTaxResponse: """Create Tax Create new taxes for an existing orden @@ -108,7 +107,7 @@ def orders_create_taxes( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateOrderTaxResponse", + '200': "OrderTaxResponse", '401': "Error", '404': "Error", '500': "Error", @@ -143,7 +142,7 @@ def orders_create_taxes_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[UpdateOrderTaxResponse]: + ) -> ApiResponse[OrderTaxResponse]: """Create Tax Create new taxes for an existing orden @@ -190,7 +189,7 @@ def orders_create_taxes_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateOrderTaxResponse", + '200': "OrderTaxResponse", '401': "Error", '404': "Error", '500': "Error", @@ -272,7 +271,7 @@ def orders_create_taxes_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateOrderTaxResponse", + '200': "OrderTaxResponse", '401': "Error", '404': "Error", '500': "Error", @@ -389,7 +388,7 @@ def orders_delete_taxes( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> UpdateOrderTaxResponse: + ) -> OrderTaxResponse: """Delete Tax Delete taxes for an existing orden @@ -436,7 +435,7 @@ def orders_delete_taxes( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateOrderTaxResponse", + '200': "OrderTaxResponse", '401': "Error", '422': "Error", '404': "Error", @@ -472,7 +471,7 @@ def orders_delete_taxes_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[UpdateOrderTaxResponse]: + ) -> ApiResponse[OrderTaxResponse]: """Delete Tax Delete taxes for an existing orden @@ -519,7 +518,7 @@ def orders_delete_taxes_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateOrderTaxResponse", + '200': "OrderTaxResponse", '401': "Error", '422': "Error", '404': "Error", @@ -602,7 +601,7 @@ def orders_delete_taxes_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateOrderTaxResponse", + '200': "OrderTaxResponse", '401': "Error", '422': "Error", '404': "Error", @@ -693,7 +692,7 @@ def orders_update_taxes( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], tax_id: Annotated[StrictStr, Field(description="identifier")], - update_order_tax_request: Annotated[UpdateOrderTaxRequest, Field(description="requested field for taxes")], + orders_update_taxes_request: Annotated[OrdersUpdateTaxesRequest, Field(description="requested field for taxes")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -708,7 +707,7 @@ def orders_update_taxes( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> UpdateOrderTaxResponse: + ) -> OrderTaxResponse: """Update Tax Update taxes for an existing orden @@ -717,8 +716,8 @@ def orders_update_taxes( :type id: str :param tax_id: identifier (required) :type tax_id: str - :param update_order_tax_request: requested field for taxes (required) - :type update_order_tax_request: UpdateOrderTaxRequest + :param orders_update_taxes_request: requested field for taxes (required) + :type orders_update_taxes_request: OrdersUpdateTaxesRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -748,7 +747,7 @@ def orders_update_taxes( _param = self._orders_update_taxes_serialize( id=id, tax_id=tax_id, - update_order_tax_request=update_order_tax_request, + orders_update_taxes_request=orders_update_taxes_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -758,7 +757,7 @@ def orders_update_taxes( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateOrderTaxResponse", + '200': "OrderTaxResponse", '401': "Error", '422': "Error", '404': "Error", @@ -780,7 +779,7 @@ def orders_update_taxes_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], tax_id: Annotated[StrictStr, Field(description="identifier")], - update_order_tax_request: Annotated[UpdateOrderTaxRequest, Field(description="requested field for taxes")], + orders_update_taxes_request: Annotated[OrdersUpdateTaxesRequest, Field(description="requested field for taxes")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -795,7 +794,7 @@ def orders_update_taxes_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[UpdateOrderTaxResponse]: + ) -> ApiResponse[OrderTaxResponse]: """Update Tax Update taxes for an existing orden @@ -804,8 +803,8 @@ def orders_update_taxes_with_http_info( :type id: str :param tax_id: identifier (required) :type tax_id: str - :param update_order_tax_request: requested field for taxes (required) - :type update_order_tax_request: UpdateOrderTaxRequest + :param orders_update_taxes_request: requested field for taxes (required) + :type orders_update_taxes_request: OrdersUpdateTaxesRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -835,7 +834,7 @@ def orders_update_taxes_with_http_info( _param = self._orders_update_taxes_serialize( id=id, tax_id=tax_id, - update_order_tax_request=update_order_tax_request, + orders_update_taxes_request=orders_update_taxes_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -845,7 +844,7 @@ def orders_update_taxes_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateOrderTaxResponse", + '200': "OrderTaxResponse", '401': "Error", '422': "Error", '404': "Error", @@ -867,7 +866,7 @@ def orders_update_taxes_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], tax_id: Annotated[StrictStr, Field(description="identifier")], - update_order_tax_request: Annotated[UpdateOrderTaxRequest, Field(description="requested field for taxes")], + orders_update_taxes_request: Annotated[OrdersUpdateTaxesRequest, Field(description="requested field for taxes")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -891,8 +890,8 @@ def orders_update_taxes_without_preload_content( :type id: str :param tax_id: identifier (required) :type tax_id: str - :param update_order_tax_request: requested field for taxes (required) - :type update_order_tax_request: UpdateOrderTaxRequest + :param orders_update_taxes_request: requested field for taxes (required) + :type orders_update_taxes_request: OrdersUpdateTaxesRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -922,7 +921,7 @@ def orders_update_taxes_without_preload_content( _param = self._orders_update_taxes_serialize( id=id, tax_id=tax_id, - update_order_tax_request=update_order_tax_request, + orders_update_taxes_request=orders_update_taxes_request, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -932,7 +931,7 @@ def orders_update_taxes_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UpdateOrderTaxResponse", + '200': "OrderTaxResponse", '401': "Error", '422': "Error", '404': "Error", @@ -949,7 +948,7 @@ def _orders_update_taxes_serialize( self, id, tax_id, - update_order_tax_request, + orders_update_taxes_request, accept_language, x_child_company_id, _request_auth, @@ -985,8 +984,8 @@ def _orders_update_taxes_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if update_order_tax_request is not None: - _body_params = update_order_tax_request + if orders_update_taxes_request is not None: + _body_params = orders_update_taxes_request # set the HTTP header `Accept` diff --git a/conekta/api/tokens_api.py b/conekta/api/tokens_api.py index d0ee3e1..2ed5b15 100644 --- a/conekta/api/tokens_api.py +++ b/conekta/api/tokens_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -20,7 +19,7 @@ from pydantic import Field, StrictStr, field_validator from typing import Optional from typing_extensions import Annotated -from conekta.models.token import Token +from conekta.models.token_request import TokenRequest from conekta.models.token_response import TokenResponse from conekta.api_client import ApiClient, RequestSerialized @@ -44,7 +43,7 @@ def __init__(self, api_client=None) -> None: @validate_call def create_token( self, - token: Annotated[Token, Field(description="requested field for token")], + token_request: Annotated[TokenRequest, Field(description="requested field for token")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -61,10 +60,10 @@ def create_token( ) -> TokenResponse: """Create Token - Generate a payment token, to associate it with a card + Generate a payment token, to associate it with a card, Endpoint could be use directly only for PCI compliance account - :param token: requested field for token (required) - :type token: Token + :param token_request: requested field for token (required) + :type token_request: TokenRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -90,7 +89,7 @@ def create_token( """ # noqa: E501 _param = self._create_token_serialize( - token=token, + token_request=token_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -118,7 +117,7 @@ def create_token( @validate_call def create_token_with_http_info( self, - token: Annotated[Token, Field(description="requested field for token")], + token_request: Annotated[TokenRequest, Field(description="requested field for token")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -135,10 +134,10 @@ def create_token_with_http_info( ) -> ApiResponse[TokenResponse]: """Create Token - Generate a payment token, to associate it with a card + Generate a payment token, to associate it with a card, Endpoint could be use directly only for PCI compliance account - :param token: requested field for token (required) - :type token: Token + :param token_request: requested field for token (required) + :type token_request: TokenRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -164,7 +163,7 @@ def create_token_with_http_info( """ # noqa: E501 _param = self._create_token_serialize( - token=token, + token_request=token_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -192,7 +191,7 @@ def create_token_with_http_info( @validate_call def create_token_without_preload_content( self, - token: Annotated[Token, Field(description="requested field for token")], + token_request: Annotated[TokenRequest, Field(description="requested field for token")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, _request_timeout: Union[ None, @@ -209,10 +208,10 @@ def create_token_without_preload_content( ) -> RESTResponseType: """Create Token - Generate a payment token, to associate it with a card + Generate a payment token, to associate it with a card, Endpoint could be use directly only for PCI compliance account - :param token: requested field for token (required) - :type token: Token + :param token_request: requested field for token (required) + :type token_request: TokenRequest :param accept_language: Use for knowing which language to use :type accept_language: str :param _request_timeout: timeout setting for this request. If one @@ -238,7 +237,7 @@ def create_token_without_preload_content( """ # noqa: E501 _param = self._create_token_serialize( - token=token, + token_request=token_request, accept_language=accept_language, _request_auth=_request_auth, _content_type=_content_type, @@ -261,7 +260,7 @@ def create_token_without_preload_content( def _create_token_serialize( self, - token, + token_request, accept_language, _request_auth, _content_type, @@ -290,8 +289,8 @@ def _create_token_serialize( _header_params['Accept-Language'] = accept_language # process the form parameters # process the body parameter - if token is not None: - _body_params = token + if token_request is not None: + _body_params = token_request # set the HTTP header `Accept` diff --git a/conekta/api/transactions_api.py b/conekta/api/transactions_api.py index 54c5c51..50eeb27 100644 --- a/conekta/api/transactions_api.py +++ b/conekta/api/transactions_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/transfers_api.py b/conekta/api/transfers_api.py index 163bd3d..66544fb 100644 --- a/conekta/api/transfers_api.py +++ b/conekta/api/transfers_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/webhook_keys_api.py b/conekta/api/webhook_keys_api.py index 50d4cf3..085a64a 100644 --- a/conekta/api/webhook_keys_api.py +++ b/conekta/api/webhook_keys_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union diff --git a/conekta/api/webhooks_api.py b/conekta/api/webhooks_api.py index a6632b6..b0bb5dc 100644 --- a/conekta/api/webhooks_api.py +++ b/conekta/api/webhooks_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -21,9 +20,9 @@ from typing import Optional from typing_extensions import Annotated from conekta.models.get_webhooks_response import GetWebhooksResponse +from conekta.models.update_webhook import UpdateWebhook from conekta.models.webhook_request import WebhookRequest from conekta.models.webhook_response import WebhookResponse -from conekta.models.webhook_update_request import WebhookUpdateRequest from conekta.api_client import ApiClient, RequestSerialized from conekta.api_response import ApiResponse @@ -1573,7 +1572,7 @@ def _test_webhook_serialize( def update_webhook( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - webhook_update_request: Annotated[WebhookUpdateRequest, Field(description="requested fields in order to update a webhook")], + update_webhook: Annotated[UpdateWebhook, Field(description="requested fields in order to update a webhook")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -1595,8 +1594,8 @@ def update_webhook( :param id: Identifier of the resource (required) :type id: str - :param webhook_update_request: requested fields in order to update a webhook (required) - :type webhook_update_request: WebhookUpdateRequest + :param update_webhook: requested fields in order to update a webhook (required) + :type update_webhook: UpdateWebhook :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -1625,7 +1624,7 @@ def update_webhook( _param = self._update_webhook_serialize( id=id, - webhook_update_request=webhook_update_request, + update_webhook=update_webhook, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -1655,7 +1654,7 @@ def update_webhook( def update_webhook_with_http_info( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - webhook_update_request: Annotated[WebhookUpdateRequest, Field(description="requested fields in order to update a webhook")], + update_webhook: Annotated[UpdateWebhook, Field(description="requested fields in order to update a webhook")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -1677,8 +1676,8 @@ def update_webhook_with_http_info( :param id: Identifier of the resource (required) :type id: str - :param webhook_update_request: requested fields in order to update a webhook (required) - :type webhook_update_request: WebhookUpdateRequest + :param update_webhook: requested fields in order to update a webhook (required) + :type update_webhook: UpdateWebhook :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -1707,7 +1706,7 @@ def update_webhook_with_http_info( _param = self._update_webhook_serialize( id=id, - webhook_update_request=webhook_update_request, + update_webhook=update_webhook, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -1737,7 +1736,7 @@ def update_webhook_with_http_info( def update_webhook_without_preload_content( self, id: Annotated[StrictStr, Field(description="Identifier of the resource")], - webhook_update_request: Annotated[WebhookUpdateRequest, Field(description="requested fields in order to update a webhook")], + update_webhook: Annotated[UpdateWebhook, Field(description="requested fields in order to update a webhook")], accept_language: Annotated[Optional[StrictStr], Field(description="Use for knowing which language to use")] = None, x_child_company_id: Annotated[Optional[StrictStr], Field(description="In the case of a holding company, the company id of the child company to which will process the request.")] = None, _request_timeout: Union[ @@ -1759,8 +1758,8 @@ def update_webhook_without_preload_content( :param id: Identifier of the resource (required) :type id: str - :param webhook_update_request: requested fields in order to update a webhook (required) - :type webhook_update_request: WebhookUpdateRequest + :param update_webhook: requested fields in order to update a webhook (required) + :type update_webhook: UpdateWebhook :param accept_language: Use for knowing which language to use :type accept_language: str :param x_child_company_id: In the case of a holding company, the company id of the child company to which will process the request. @@ -1789,7 +1788,7 @@ def update_webhook_without_preload_content( _param = self._update_webhook_serialize( id=id, - webhook_update_request=webhook_update_request, + update_webhook=update_webhook, accept_language=accept_language, x_child_company_id=x_child_company_id, _request_auth=_request_auth, @@ -1814,7 +1813,7 @@ def update_webhook_without_preload_content( def _update_webhook_serialize( self, id, - webhook_update_request, + update_webhook, accept_language, x_child_company_id, _request_auth, @@ -1848,8 +1847,8 @@ def _update_webhook_serialize( _header_params['X-Child-Company-Id'] = x_child_company_id # process the form parameters # process the body parameter - if webhook_update_request is not None: - _body_params = webhook_update_request + if update_webhook is not None: + _body_params = update_webhook # set the HTTP header `Accept` diff --git a/conekta/api_client.py b/conekta/api_client.py index ea2f96b..28f9f98 100644 --- a/conekta/api_client.py +++ b/conekta/api_client.py @@ -12,7 +12,6 @@ Do not edit the class manually. """ # noqa: E501 - import datetime from dateutil.parser import parse from enum import Enum @@ -74,7 +73,7 @@ class ApiClient: 'lang': 'python', 'lang_version': platform.python_version(), 'publisher': 'conekta', - 'bindings_version': '7.0.3', + 'bindings_version': '7.1.0', 'uname': platform.uname() } _pool = None @@ -97,7 +96,7 @@ def __init__( self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'Conekta/v2 PythonBindings/7.0.3' + self.user_agent = 'Conekta/v2 PythonBindings/7.1.0' self.conekta_user_agent = json.dumps(self.data) self.client_side_validation = configuration.client_side_validation diff --git a/conekta/configuration.py b/conekta/configuration.py index 7a927d5..935e06a 100644 --- a/conekta/configuration.py +++ b/conekta/configuration.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -14,14 +12,18 @@ import copy +import http.client as httplib import logging from logging import FileHandler import multiprocessing import sys -from typing import Optional +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from urllib.parse import urlparse +from urllib.request import getproxies +from typing_extensions import NotRequired, Self + import urllib3 -import http.client as httplib JSON_SCHEMA_VALIDATION_KEYWORDS = { 'multipleOf', 'maximum', 'exclusiveMaximum', @@ -29,6 +31,107 @@ 'minLength', 'pattern', 'maxItems', 'minItems' } +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "bearerAuth": BearerAuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + class Configuration: """This class contains various settings of the API client. @@ -56,27 +159,65 @@ class Configuration: string values to replace variables in templated server configuration. The validation of enums is performed for variables with defined enum values before. + :param verify_ssl: bool - Set this to false to skip verifying SSL certificate + when calling API from https server. :param ssl_ca_cert: str - the path to a file of concatenated CA certificates in PEM format. - :param retries: Number of retries for API requests. + :param retries: int | urllib3.util.retry.Retry - Retry configuration. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. + :param assert_hostname: Set this to True/False to enable/disable SSL hostname verification. + :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. + :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. + :param proxy: Proxy URL. + :param no_proxy: Comma-separated hosts that bypass the proxy. + :param proxy_headers: Proxy headers. + :param safe_chars_for_path_param: Safe characters for path parameter encoding. + :param client_side_validation: Enable client-side validation. Default True. + :param socket_options: Options to pass down to the underlying urllib3 socket. + :param datetime_format: Datetime format string for serialization. + :param date_format: Date format string for serialization. :Example: """ - _default = None - - def __init__(self, host=None, - api_key=None, api_key_prefix=None, - username=None, password=None, - access_token=None, - server_index=None, server_variables=None, - server_operation_index=None, server_operation_variables=None, - ignore_operation_servers=False, - ssl_ca_cert=None, - retries=None, - *, - debug: Optional[bool] = None - ) -> None: + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[Union[int, urllib3.util.retry.Retry]] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, + verify_ssl: bool=True, + assert_hostname: Optional[bool]=None, + tls_server_name: Optional[str]=None, + connection_pool_maxsize: Optional[int]=None, + proxy: Optional[str]=None, + no_proxy: Optional[str]=None, + proxy_headers: Optional[Any]=None, + safe_chars_for_path_param: str='', + client_side_validation: bool=True, + socket_options: Optional[Any]=None, + datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z", + date_format: str="%Y-%m-%d", + *, + debug: Optional[bool] = None, + ) -> None: """Constructor """ self._base_path = "https://api.conekta.io" if host is None else host @@ -143,7 +284,7 @@ def __init__(self, host=None, """Debug switch """ - self.verify_ssl = True + self.verify_ssl = verify_ssl """SSL/TLS verification Set this to false to skip verifying SSL certificate when calling API from https server. @@ -151,56 +292,69 @@ def __init__(self, host=None, self.ssl_ca_cert = ssl_ca_cert """Set this to customize the certificate file to verify the peer. """ - self.cert_file = None + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file """client certificate file """ - self.key_file = None + self.key_file = key_file """client key file """ - self.assert_hostname = None + self.assert_hostname = assert_hostname """Set this to True/False to enable/disable SSL hostname verification. """ - self.tls_server_name = None + self.tls_server_name = tls_server_name """SSL/TLS Server Name Indication (SNI) Set this to the SNI value expected by the server. """ - self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 + self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else multiprocessing.cpu_count() * 5 """urllib3 connection pool's maximum number of connections saved - per pool. urllib3 uses 1 connection as default value, but this is - not the best value when you are making a lot of possibly parallel - requests to the same host, which is often the case here. - cpu_count * 5 is used as default value to increase performance. - """ - - self.proxy: Optional[str] = None + per pool. None in the constructor is coerced to cpu_count * 5. + """ + + # urllib3 does not read proxy environment variables itself: + # https://github.com/urllib3/urllib3/issues/1785 + if proxy is None or no_proxy is None: + proxies = getproxies() + if proxy is None: + scheme = urlparse(self.host).scheme + proxy = proxies.get(scheme) or proxies.get("all") + if no_proxy is None: + no_proxy = proxies.get("no") + self.proxy = proxy """Proxy URL """ - self.proxy_headers = None + self.no_proxy = no_proxy + """Hosts that bypass the proxy + """ + self.proxy_headers = proxy_headers """Proxy headers """ - self.safe_chars_for_path_param = '' + self.safe_chars_for_path_param = safe_chars_for_path_param """Safe chars for path_param """ self.retries = retries - """Adding retries to override urllib3 default value 3 + """Retry configuration """ # Enable client side validation - self.client_side_validation = True + self.client_side_validation = client_side_validation - self.socket_options = None + self.socket_options = socket_options """Options to pass down to the underlying urllib3 socket """ - self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + self.datetime_format = datetime_format """datetime format """ - self.date_format = "%Y-%m-%d" + self.date_format = date_format """date format """ - def __deepcopy__(self, memo): + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: cls = self.__class__ result = cls.__new__(cls) memo[id(self)] = result @@ -209,16 +363,16 @@ def __deepcopy__(self, memo): setattr(result, k, copy.deepcopy(v, memo)) # shallow copy of loggers result.logger = copy.copy(self.logger) - # use setters to configure loggers + # use setter to re-create the file handler (excluded from __dict__ copy) result.logger_file = self.logger_file - result.debug = self.debug + return result - def __setattr__(self, name, value): + def __setattr__(self, name: str, value: Any) -> None: object.__setattr__(self, name, value) @classmethod - def set_default(cls, default): + def set_default(cls, default: Optional[Self]) -> None: """Set default instance of configuration. It stores default configuration, which can be @@ -229,7 +383,7 @@ def set_default(cls, default): cls._default = default @classmethod - def get_default_copy(cls): + def get_default_copy(cls) -> Self: """Deprecated. Please use `get_default` instead. Deprecated. Please use `get_default` instead. @@ -239,7 +393,7 @@ def get_default_copy(cls): return cls.get_default() @classmethod - def get_default(cls): + def get_default(cls) -> Self: """Return the default configuration. This method returns newly created, based on default constructor, @@ -249,11 +403,11 @@ def get_default(cls): :return: The configuration object. """ if cls._default is None: - cls._default = Configuration() + cls._default = cls() return cls._default @property - def logger_file(self): + def logger_file(self) -> Optional[str]: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -265,7 +419,7 @@ def logger_file(self): return self.__logger_file @logger_file.setter - def logger_file(self, value): + def logger_file(self, value: Optional[str]) -> None: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -284,7 +438,7 @@ def logger_file(self, value): logger.addHandler(self.logger_file_handler) @property - def debug(self): + def debug(self) -> bool: """Debug status :param value: The debug status, True or False. @@ -293,7 +447,7 @@ def debug(self): return self.__debug @debug.setter - def debug(self, value): + def debug(self, value: bool) -> None: """Debug status :param value: The debug status, True or False. @@ -315,7 +469,7 @@ def debug(self, value): httplib.HTTPConnection.debuglevel = 0 @property - def logger_format(self): + def logger_format(self) -> str: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -326,7 +480,7 @@ def logger_format(self): return self.__logger_format @logger_format.setter - def logger_format(self, value): + def logger_format(self, value: str) -> None: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -337,7 +491,7 @@ def logger_format(self, value): self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) - def get_api_key_with_prefix(self, identifier, alias=None): + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. @@ -348,13 +502,16 @@ def get_api_key_with_prefix(self, identifier, alias=None): self.refresh_api_key_hook(self) key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) if key: - prefix = self.api_key_prefix.get(identifier) + prefix = self.api_key_prefix.get( + identifier, self.api_key_prefix.get(alias) if alias is not None else None) if prefix: return "%s %s" % (prefix, key) else: return key - def get_basic_auth_token(self): + return None + + def get_basic_auth_token(self) -> Optional[str]: """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. @@ -365,16 +522,17 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password + return urllib3.util.make_headers( basic_auth=username + ':' + password ).get('authorization') - def auth_settings(self): + def auth_settings(self)-> AuthSettings: """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ - auth = {} + auth: AuthSettings = {} if self.access_token is not None: auth['bearerAuth'] = { 'type': 'bearer', @@ -384,7 +542,7 @@ def auth_settings(self): } return auth - def to_debug_report(self): + def to_debug_report(self) -> str: """Gets the essential information for debugging. :return: The report for debugging. @@ -393,10 +551,10 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 2.2.0\n"\ - "SDK Package Version: 7.0.3".\ + "SDK Package Version: 7.1.0".\ format(env=sys.platform, pyversion=sys.version) - def get_host_settings(self): + def get_host_settings(self) -> List[HostSetting]: """Gets an array of host settings :return: An array of host settings @@ -408,7 +566,12 @@ def get_host_settings(self): } ] - def get_host_from_settings(self, index, variables=None, servers=None): + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value @@ -436,6 +599,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): variable_name, variable['default_value']) if 'enum_values' in variable \ + and variable['enum_values'] \ and used_value not in variable['enum_values']: raise ValueError( "The variable `{0}` in the host URL has invalid value " @@ -448,12 +612,12 @@ def get_host_from_settings(self, index, variables=None, servers=None): return url @property - def host(self): + def host(self) -> str: """Return generated host.""" return self.get_host_from_settings(self.server_index, variables=self.server_variables) @host.setter - def host(self, value): + def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None diff --git a/conekta/exceptions.py b/conekta/exceptions.py index 11e3dfb..9c86356 100644 --- a/conekta/exceptions.py +++ b/conekta/exceptions.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -12,6 +10,7 @@ Do not edit the class manually. """ # noqa: E501 + from typing import Any, Optional from typing_extensions import Self @@ -129,7 +128,7 @@ def __init__( self.body = http_resp.data.decode('utf-8') except Exception: pass - self.headers = http_resp.getheaders() + self.headers = http_resp.headers @classmethod def from_response( @@ -151,6 +150,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -163,8 +169,11 @@ def __str__(self): error_message += "HTTP response headers: {0}\n".format( self.headers) - if self.data or self.body: - error_message += "HTTP response body: {0}\n".format(self.data or self.body) + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) return error_message @@ -189,6 +198,16 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/conekta/models/__init__.py b/conekta/models/__init__.py index 867744b..6af4e91 100644 --- a/conekta/models/__init__.py +++ b/conekta/models/__init__.py @@ -13,16 +13,15 @@ Do not edit the class manually. """ # noqa: E501 - # import models into model package from conekta.models.api_key_create_response import ApiKeyCreateResponse from conekta.models.api_key_request import ApiKeyRequest from conekta.models.api_key_response import ApiKeyResponse -from conekta.models.api_key_response_on_delete import ApiKeyResponseOnDelete from conekta.models.api_key_update_request import ApiKeyUpdateRequest -from conekta.models.balance_common_field import BalanceCommonField +from conekta.models.balance_common_fiels_response import BalanceCommonFielsResponse from conekta.models.balance_response import BalanceResponse from conekta.models.blacklist_rule_response import BlacklistRuleResponse +from conekta.models.cash_agreements_response import CashAgreementsResponse from conekta.models.charge_order_response import ChargeOrderResponse from conekta.models.charge_order_response_payment_method import ChargeOrderResponsePaymentMethod from conekta.models.charge_request import ChargeRequest @@ -33,19 +32,17 @@ from conekta.models.charge_response_refunds import ChargeResponseRefunds from conekta.models.charge_response_refunds_data import ChargeResponseRefundsData from conekta.models.charge_update_request import ChargeUpdateRequest +from conekta.models.chargeback_file_response import ChargebackFileResponse +from conekta.models.chargeback_response import ChargebackResponse from conekta.models.charges_data_response import ChargesDataResponse from conekta.models.charges_order_response import ChargesOrderResponse -from conekta.models.charges_order_response_all_of_data import ChargesOrderResponseAllOfData from conekta.models.checkout import Checkout from conekta.models.checkout_order_template import CheckoutOrderTemplate -from conekta.models.checkout_order_template_customer_info import CheckoutOrderTemplateCustomerInfo -from conekta.models.checkout_request import CheckoutRequest from conekta.models.checkout_response import CheckoutResponse from conekta.models.checkouts_response import CheckoutsResponse from conekta.models.company_document_request import CompanyDocumentRequest from conekta.models.company_document_response import CompanyDocumentResponse from conekta.models.company_response import CompanyResponse -from conekta.models.company_response_documents_inner import CompanyResponseDocumentsInner from conekta.models.create_company_request import CreateCompanyRequest from conekta.models.create_company_request_bank_account_info import CreateCompanyRequestBankAccountInfo from conekta.models.create_company_request_comercial_info import CreateCompanyRequestComercialInfo @@ -53,35 +50,32 @@ from conekta.models.create_customer_fiscal_entities_response import CreateCustomerFiscalEntitiesResponse from conekta.models.create_customer_payment_methods_request import CreateCustomerPaymentMethodsRequest from conekta.models.create_customer_payment_methods_response import CreateCustomerPaymentMethodsResponse -from conekta.models.create_risk_rules_data import CreateRiskRulesData +from conekta.models.create_rule_whitelist_request import CreateRuleWhitelistRequest from conekta.models.customer import Customer -from conekta.models.customer_address import CustomerAddress from conekta.models.customer_antifraud_info import CustomerAntifraudInfo from conekta.models.customer_antifraud_info_response import CustomerAntifraudInfoResponse +from conekta.models.customer_details import CustomerDetails from conekta.models.customer_fiscal_entities_data_response import CustomerFiscalEntitiesDataResponse -from conekta.models.customer_fiscal_entities_request import CustomerFiscalEntitiesRequest from conekta.models.customer_fiscal_entities_response import CustomerFiscalEntitiesResponse from conekta.models.customer_info import CustomerInfo -from conekta.models.customer_info_just_customer_id import CustomerInfoJustCustomerId -from conekta.models.customer_info_just_customer_id_response import CustomerInfoJustCustomerIdResponse -from conekta.models.customer_payment_method_request import CustomerPaymentMethodRequest +from conekta.models.customer_info_customer_id import CustomerInfoCustomerId from conekta.models.customer_payment_methods_data import CustomerPaymentMethodsData from conekta.models.customer_payment_methods_request import CustomerPaymentMethodsRequest from conekta.models.customer_payment_methods_response import CustomerPaymentMethodsResponse +from conekta.models.customer_portal_response import CustomerPortalResponse from conekta.models.customer_response import CustomerResponse from conekta.models.customer_response_shipping_contacts import CustomerResponseShippingContacts -from conekta.models.customer_shipping_contacts import CustomerShippingContacts from conekta.models.customer_shipping_contacts_address import CustomerShippingContactsAddress from conekta.models.customer_shipping_contacts_data_response import CustomerShippingContactsDataResponse +from conekta.models.customer_shipping_contacts_request import CustomerShippingContactsRequest +from conekta.models.customer_shipping_contacts_request_address import CustomerShippingContactsRequestAddress from conekta.models.customer_shipping_contacts_response import CustomerShippingContactsResponse -from conekta.models.customer_shipping_contacts_response_address import CustomerShippingContactsResponseAddress -from conekta.models.customer_update_fiscal_entities_request import CustomerUpdateFiscalEntitiesRequest -from conekta.models.customer_update_shipping_contacts import CustomerUpdateShippingContacts +from conekta.models.customer_subscription_response import CustomerSubscriptionResponse +from conekta.models.customer_update_shipping_contacts_request import CustomerUpdateShippingContactsRequest from conekta.models.customers_response import CustomersResponse from conekta.models.delete_api_keys_response import DeleteApiKeysResponse from conekta.models.deleted_blacklist_rule_response import DeletedBlacklistRuleResponse from conekta.models.deleted_whitelist_rule_response import DeletedWhitelistRuleResponse -from conekta.models.details import Details from conekta.models.details_error import DetailsError from conekta.models.discount_lines_data_response import DiscountLinesDataResponse from conekta.models.discount_lines_response import DiscountLinesResponse @@ -91,6 +85,8 @@ from conekta.models.event_types import EventTypes from conekta.models.events_resend_response import EventsResendResponse from conekta.models.fiscal_entity_address import FiscalEntityAddress +from conekta.models.fiscal_entity_request import FiscalEntityRequest +from conekta.models.fiscal_entity_request_address import FiscalEntityRequestAddress from conekta.models.get_api_keys_response import GetApiKeysResponse from conekta.models.get_charges_response import GetChargesResponse from conekta.models.get_companies_response import GetCompaniesResponse @@ -104,13 +100,13 @@ from conekta.models.get_transfers_response import GetTransfersResponse from conekta.models.get_webhook_keys_response import GetWebhookKeysResponse from conekta.models.get_webhooks_response import GetWebhooksResponse -from conekta.models.log_response import LogResponse -from conekta.models.logs_response import LogsResponse +from conekta.models.log_response_for_request import LogResponseForRequest from conekta.models.logs_response_data import LogsResponseData +from conekta.models.logs_response_for_request import LogsResponseForRequest from conekta.models.order_capture_request import OrderCaptureRequest from conekta.models.order_channel_response import OrderChannelResponse from conekta.models.order_charges_response import OrderChargesResponse -from conekta.models.order_customer_info_response import OrderCustomerInfoResponse +from conekta.models.order_checkout_request import OrderCheckoutRequest from conekta.models.order_discount_lines_request import OrderDiscountLinesRequest from conekta.models.order_discount_lines_response import OrderDiscountLinesResponse from conekta.models.order_fiscal_entity_address_response import OrderFiscalEntityAddressResponse @@ -126,14 +122,14 @@ from conekta.models.order_response_customer_info import OrderResponseCustomerInfo from conekta.models.order_response_products import OrderResponseProducts from conekta.models.order_response_shipping_contact import OrderResponseShippingContact +from conekta.models.order_shipping_lines_response import OrderShippingLinesResponse +from conekta.models.order_tax_lines_response import OrderTaxLinesResponse from conekta.models.order_tax_request import OrderTaxRequest +from conekta.models.order_tax_response import OrderTaxResponse +from conekta.models.order_update import OrderUpdate +from conekta.models.order_update_customer_info import OrderUpdateCustomerInfo from conekta.models.order_update_fiscal_entity_request import OrderUpdateFiscalEntityRequest -from conekta.models.order_update_request import OrderUpdateRequest -from conekta.models.order_update_request_customer_info import OrderUpdateRequestCustomerInfo -from conekta.models.orders_response import OrdersResponse -from conekta.models.page import Page -from conekta.models.pagination import Pagination -from conekta.models.payment_method import PaymentMethod +from conekta.models.orders_update_taxes_request import OrdersUpdateTaxesRequest from conekta.models.payment_method_bank_transfer import PaymentMethodBankTransfer from conekta.models.payment_method_bnpl_payment import PaymentMethodBnplPayment from conekta.models.payment_method_bnpl_request import PaymentMethodBnplRequest @@ -144,40 +140,42 @@ from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_request import PaymentMethodCashRequest from conekta.models.payment_method_cash_response import PaymentMethodCashResponse -from conekta.models.payment_method_cash_response_all_of_agreements import PaymentMethodCashResponseAllOfAgreements from conekta.models.payment_method_general_request import PaymentMethodGeneralRequest from conekta.models.payment_method_pbb_payment import PaymentMethodPbbPayment from conekta.models.payment_method_pbb_request import PaymentMethodPbbRequest -from conekta.models.payment_method_response import PaymentMethodResponse -from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent +from conekta.models.payment_method_spei_recurrent_response import PaymentMethodSpeiRecurrentResponse from conekta.models.payment_method_spei_request import PaymentMethodSpeiRequest from conekta.models.payment_method_token_request import PaymentMethodTokenRequest from conekta.models.payout import Payout from conekta.models.payout_method import PayoutMethod -from conekta.models.payout_order import PayoutOrder from conekta.models.payout_order_payouts_item import PayoutOrderPayoutsItem +from conekta.models.payout_order_request import PayoutOrderRequest +from conekta.models.payout_order_request_customer_info import PayoutOrderRequestCustomerInfo from conekta.models.payout_order_response import PayoutOrderResponse from conekta.models.payout_order_response_customer_info import PayoutOrderResponseCustomerInfo from conekta.models.payout_orders_response import PayoutOrdersResponse from conekta.models.plan_request import PlanRequest from conekta.models.plan_response import PlanResponse -from conekta.models.plan_update_request import PlanUpdateRequest from conekta.models.product import Product from conekta.models.product_data_response import ProductDataResponse from conekta.models.product_order_response import ProductOrderResponse -from conekta.models.resend_request import ResendRequest +from conekta.models.resend_event_request import ResendEventRequest from conekta.models.risk_rules_data import RiskRulesData from conekta.models.risk_rules_list import RiskRulesList +from conekta.models.shipping_lines_data_response import ShippingLinesDataResponse from conekta.models.shipping_order_response import ShippingOrderResponse from conekta.models.shipping_request import ShippingRequest from conekta.models.sms_checkout_request import SmsCheckoutRequest +from conekta.models.subscription_details import SubscriptionDetails +from conekta.models.subscription_details_card import SubscriptionDetailsCard +from conekta.models.subscription_details_plan import SubscriptionDetailsPlan from conekta.models.subscription_events_response import SubscriptionEventsResponse from conekta.models.subscription_request import SubscriptionRequest from conekta.models.subscription_response import SubscriptionResponse -from conekta.models.subscription_update_request import SubscriptionUpdateRequest -from conekta.models.token import Token -from conekta.models.token_card import TokenCard -from conekta.models.token_checkout import TokenCheckout +from conekta.models.tax_lines_data_response import TaxLinesDataResponse +from conekta.models.token_request import TokenRequest +from conekta.models.token_request_card import TokenRequestCard +from conekta.models.token_request_checkout import TokenRequestCheckout from conekta.models.token_response import TokenResponse from conekta.models.token_response_checkout import TokenResponseCheckout from conekta.models.transaction_response import TransactionResponse @@ -189,11 +187,13 @@ from conekta.models.update_customer_antifraud_info import UpdateCustomerAntifraudInfo from conekta.models.update_customer_fiscal_entities_response import UpdateCustomerFiscalEntitiesResponse from conekta.models.update_customer_payment_methods_response import UpdateCustomerPaymentMethodsResponse +from conekta.models.update_fiscal_entity_request import UpdateFiscalEntityRequest from conekta.models.update_order_discount_lines_request import UpdateOrderDiscountLinesRequest -from conekta.models.update_order_tax_request import UpdateOrderTaxRequest -from conekta.models.update_order_tax_response import UpdateOrderTaxResponse -from conekta.models.update_payment_methods import UpdatePaymentMethods +from conekta.models.update_payment_methods_card import UpdatePaymentMethodsCard +from conekta.models.update_plan import UpdatePlan from conekta.models.update_product import UpdateProduct +from conekta.models.update_webhook import UpdateWebhook +from conekta.models.updates_a_subscription import UpdatesASubscription from conekta.models.webhook_key_create_response import WebhookKeyCreateResponse from conekta.models.webhook_key_delete_response import WebhookKeyDeleteResponse from conekta.models.webhook_key_request import WebhookKeyRequest @@ -202,5 +202,5 @@ from conekta.models.webhook_log import WebhookLog from conekta.models.webhook_request import WebhookRequest from conekta.models.webhook_response import WebhookResponse -from conekta.models.webhook_update_request import WebhookUpdateRequest from conekta.models.whitelistlist_rule_response import WhitelistlistRuleResponse + diff --git a/conekta/models/api_key_create_response.py b/conekta/models/api_key_create_response.py index 8b0c239..9a98463 100644 --- a/conekta/models/api_key_create_response.py +++ b/conekta/models/api_key_create_response.py @@ -22,27 +22,29 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ApiKeyCreateResponse(BaseModel): """ ApiKeyCreateResponse """ # noqa: E501 - active: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is active") - created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was created") - updated_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was last updated") + authentication_token: Optional[StrictStr] = Field(default=None, description="It is occupied as a user when authenticated with basic authentication, with a blank password. This value will only appear once, in the request to create a new key. Copy and save it in a safe place.", json_schema_extra={"examples": ["key_rpHzxufNgjFCdprEEFZRTKi"]}) + active: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is active", json_schema_extra={"examples": [True]}) + created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was created", json_schema_extra={"examples": [1684167881]}) + updated_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was last updated", json_schema_extra={"examples": [1684167923]}) deactivated_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was deleted") last_used_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the api key was used") - description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the api key") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is in production") - object: Optional[StrictStr] = Field(default=None, description="Object name, value is 'api_key'") - prefix: Optional[StrictStr] = Field(default=None, description="The first few characters of the authentication_token") - role: Optional[StrictStr] = Field(default=None, description="Indicates if the api key is private or public") - authentication_token: Optional[StrictStr] = Field(default=None, description="It is occupied as a user when authenticated with basic authentication, with a blank password. This value will only appear once, in the request to create a new key. Copy and save it in a safe place.") - __properties: ClassVar[List[str]] = ["active", "created_at", "updated_at", "deactivated_at", "last_used_at", "description", "id", "livemode", "object", "prefix", "role", "authentication_token"] + description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for", json_schema_extra={"examples": ["online store"]}) + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the api key", json_schema_extra={"examples": ["64625cc9f3e02c00163f5e4d"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is in production", json_schema_extra={"examples": [False]}) + object: Optional[StrictStr] = Field(default=None, description="Object name, value is 'api_key'", json_schema_extra={"examples": ["api_key"]}) + prefix: Optional[StrictStr] = Field(default=None, description="The first few characters of the authentication_token", json_schema_extra={"examples": ["key_rp"]}) + role: Optional[StrictStr] = Field(default=None, description="Indicates if the api key is private or public", json_schema_extra={"examples": ["private"]}) + __properties: ClassVar[List[str]] = ["authentication_token", "active", "created_at", "updated_at", "deactivated_at", "last_used_at", "description", "id", "livemode", "object", "prefix", "role"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -80,16 +81,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if deactivated_at (nullable) is None - # and model_fields_set contains the field - if self.deactivated_at is None and "deactivated_at" in self.model_fields_set: - _dict['deactivated_at'] = None - - # set to None if last_used_at (nullable) is None - # and model_fields_set contains the field - if self.last_used_at is None and "last_used_at" in self.model_fields_set: - _dict['last_used_at'] = None - return _dict @classmethod @@ -102,6 +93,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "authentication_token": obj.get("authentication_token"), "active": obj.get("active"), "created_at": obj.get("created_at"), "updated_at": obj.get("updated_at"), @@ -112,8 +104,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "livemode": obj.get("livemode"), "object": obj.get("object"), "prefix": obj.get("prefix"), - "role": obj.get("role"), - "authentication_token": obj.get("authentication_token") + "role": obj.get("role") }) return _obj diff --git a/conekta/models/api_key_request.py b/conekta/models/api_key_request.py index 1aad549..5307915 100644 --- a/conekta/models/api_key_request.py +++ b/conekta/models/api_key_request.py @@ -22,17 +22,19 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ApiKeyRequest(BaseModel): """ ApiKeyRequest """ # noqa: E501 - description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for") - role: StrictStr + description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for", json_schema_extra={"examples": ["online store"]}) + role: StrictStr = Field(json_schema_extra={"examples": ["private"]}) __properties: ClassVar[List[str]] = ["description", "role"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/api_key_response.py b/conekta/models/api_key_response.py index 547c285..d2848a1 100644 --- a/conekta/models/api_key_response.py +++ b/conekta/models/api_key_response.py @@ -22,26 +22,28 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ApiKeyResponse(BaseModel): """ api keys model """ # noqa: E501 - active: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is active") - created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was created") - updated_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was last updated") + active: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is active", json_schema_extra={"examples": [True]}) + created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was created", json_schema_extra={"examples": [1684167881]}) + updated_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was last updated", json_schema_extra={"examples": [1684167923]}) deactivated_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was deleted") last_used_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the api key was used") - description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the api key") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is in production") - object: Optional[StrictStr] = Field(default=None, description="Object name, value is 'api_key'") - prefix: Optional[StrictStr] = Field(default=None, description="The first few characters of the authentication_token") - role: Optional[StrictStr] = Field(default=None, description="Indicates if the api key is private or public") + description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for", json_schema_extra={"examples": ["online store"]}) + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the api key", json_schema_extra={"examples": ["64625cc9f3e02c00163f5e4d"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is in production", json_schema_extra={"examples": [False]}) + object: Optional[StrictStr] = Field(default=None, description="Object name, value is 'api_key'", json_schema_extra={"examples": ["api_key"]}) + prefix: Optional[StrictStr] = Field(default=None, description="The first few characters of the authentication_token", json_schema_extra={"examples": ["key_rp"]}) + role: Optional[StrictStr] = Field(default=None, description="Indicates if the api key is private or public", json_schema_extra={"examples": ["private"]}) __properties: ClassVar[List[str]] = ["active", "created_at", "updated_at", "deactivated_at", "last_used_at", "description", "id", "livemode", "object", "prefix", "role"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +55,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -79,16 +80,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if deactivated_at (nullable) is None - # and model_fields_set contains the field - if self.deactivated_at is None and "deactivated_at" in self.model_fields_set: - _dict['deactivated_at'] = None - - # set to None if last_used_at (nullable) is None - # and model_fields_set contains the field - if self.last_used_at is None and "last_used_at" in self.model_fields_set: - _dict['last_used_at'] = None - return _dict @classmethod diff --git a/conekta/models/api_key_response_on_delete.py b/conekta/models/api_key_response_on_delete.py deleted file mode 100644 index 417d367..0000000 --- a/conekta/models/api_key_response_on_delete.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class ApiKeyResponseOnDelete(BaseModel): - """ - api keys model - """ # noqa: E501 - active: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is active") - created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was created") - description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is in production") - prefix: Optional[StrictStr] = Field(default=None, description="The first few characters of the authentication_token") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the api key") - object: Optional[StrictStr] = Field(default=None, description="Object name, value is 'api_key'") - last_used_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the api key was used") - role: Optional[StrictStr] = Field(default=None, description="Indicates if the api key is private or public") - __properties: ClassVar[List[str]] = ["active", "created_at", "description", "livemode", "prefix", "id", "object", "last_used_at", "role"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ApiKeyResponseOnDelete from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # set to None if last_used_at (nullable) is None - # and model_fields_set contains the field - if self.last_used_at is None and "last_used_at" in self.model_fields_set: - _dict['last_used_at'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ApiKeyResponseOnDelete from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "active": obj.get("active"), - "created_at": obj.get("created_at"), - "description": obj.get("description"), - "livemode": obj.get("livemode"), - "prefix": obj.get("prefix"), - "id": obj.get("id"), - "object": obj.get("object"), - "last_used_at": obj.get("last_used_at"), - "role": obj.get("role") - }) - return _obj - - diff --git a/conekta/models/api_key_update_request.py b/conekta/models/api_key_update_request.py index f5368bb..cd30e57 100644 --- a/conekta/models/api_key_update_request.py +++ b/conekta/models/api_key_update_request.py @@ -22,17 +22,19 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ApiKeyUpdateRequest(BaseModel): """ ApiKeyUpdateRequest """ # noqa: E501 - active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is active") - description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for") + active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is active", json_schema_extra={"examples": [True]}) + description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for", json_schema_extra={"examples": ["online store"]}) __properties: ClassVar[List[str]] = ["active", "description"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/balance_common_field.py b/conekta/models/balance_common_fiels_response.py similarity index 81% rename from conekta/models/balance_common_field.py rename to conekta/models/balance_common_fiels_response.py index 5ae5c88..f374b20 100644 --- a/conekta/models/balance_common_field.py +++ b/conekta/models/balance_common_fiels_response.py @@ -22,17 +22,19 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class BalanceCommonField(BaseModel): +class BalanceCommonFielsResponse(BaseModel): """ balance common fields model """ # noqa: E501 - amount: Optional[StrictInt] = Field(default=None, description="The balance's amount") - currency: Optional[StrictStr] = Field(default=None, description="The balance's currency") + amount: Optional[StrictInt] = Field(default=None, description="The balance's amount", json_schema_extra={"examples": [100]}) + currency: Optional[StrictStr] = Field(default=None, description="The balance's currency", json_schema_extra={"examples": ["MXN"]}) __properties: ClassVar[List[str]] = ["amount", "currency"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,12 +46,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of BalanceCommonField from a JSON string""" + """Create an instance of BalanceCommonFielsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -74,7 +75,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of BalanceCommonField from a dict""" + """Create an instance of BalanceCommonFielsResponse from a dict""" if obj is None: return None diff --git a/conekta/models/balance_response.py b/conekta/models/balance_response.py index cadc9d2..d438c3b 100644 --- a/conekta/models/balance_response.py +++ b/conekta/models/balance_response.py @@ -20,28 +20,30 @@ from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.balance_common_field import BalanceCommonField +from conekta.models.balance_common_fiels_response import BalanceCommonFielsResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class BalanceResponse(BaseModel): """ balance model """ # noqa: E501 - available: Optional[List[BalanceCommonField]] = Field(default=None, description="The balance's available") - cashout_retention_amount: Optional[List[BalanceCommonField]] = Field(default=None, description="The balance's cashout retention amount") - conekta_retention: Optional[List[BalanceCommonField]] = Field(default=None, description="The balance's conekta retention") - gateway: Optional[List[BalanceCommonField]] = Field(default=None, description="The balance's gateway") - pending: Optional[List[BalanceCommonField]] = Field(default=None, description="The balance's pending") - retained: Optional[List[BalanceCommonField]] = Field(default=None, description="The balance's retained") - retention_amount: Optional[List[BalanceCommonField]] = Field(default=None, description="The balance's retention amount") + available: Optional[List[BalanceCommonFielsResponse]] = Field(default=None, description="The balance's available") + cashout_retention_amount: Optional[List[BalanceCommonFielsResponse]] = Field(default=None, description="The balance's cashout retention amount") + conekta_retention: Optional[List[BalanceCommonFielsResponse]] = Field(default=None, description="The balance's conekta retention") + gateway: Optional[List[BalanceCommonFielsResponse]] = Field(default=None, description="The balance's gateway") + pending: Optional[List[BalanceCommonFielsResponse]] = Field(default=None, description="The balance's pending") + retained: Optional[List[BalanceCommonFielsResponse]] = Field(default=None, description="The balance's retained") + retention_amount: Optional[List[BalanceCommonFielsResponse]] = Field(default=None, description="The balance's retention amount") target_collateral_amount: Optional[Dict[str, Any]] = Field(default=None, description="The balance's target collateral amount") - target_retention_amount: Optional[List[BalanceCommonField]] = Field(default=None, description="The balance's target retention amount") - temporarily_retained: Optional[List[BalanceCommonField]] = Field(default=None, description="The balance's temporarily retained") + target_retention_amount: Optional[List[BalanceCommonFielsResponse]] = Field(default=None, description="The balance's target retention amount") + temporarily_retained: Optional[List[BalanceCommonFielsResponse]] = Field(default=None, description="The balance's temporarily retained") __properties: ClassVar[List[str]] = ["available", "cashout_retention_amount", "conekta_retention", "gateway", "pending", "retained", "retention_amount", "target_collateral_amount", "target_retention_amount", "temporarily_retained"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +55,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -154,16 +155,16 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "available": [BalanceCommonField.from_dict(_item) for _item in obj["available"]] if obj.get("available") is not None else None, - "cashout_retention_amount": [BalanceCommonField.from_dict(_item) for _item in obj["cashout_retention_amount"]] if obj.get("cashout_retention_amount") is not None else None, - "conekta_retention": [BalanceCommonField.from_dict(_item) for _item in obj["conekta_retention"]] if obj.get("conekta_retention") is not None else None, - "gateway": [BalanceCommonField.from_dict(_item) for _item in obj["gateway"]] if obj.get("gateway") is not None else None, - "pending": [BalanceCommonField.from_dict(_item) for _item in obj["pending"]] if obj.get("pending") is not None else None, - "retained": [BalanceCommonField.from_dict(_item) for _item in obj["retained"]] if obj.get("retained") is not None else None, - "retention_amount": [BalanceCommonField.from_dict(_item) for _item in obj["retention_amount"]] if obj.get("retention_amount") is not None else None, + "available": [BalanceCommonFielsResponse.from_dict(_item) for _item in obj["available"]] if obj.get("available") is not None else None, + "cashout_retention_amount": [BalanceCommonFielsResponse.from_dict(_item) for _item in obj["cashout_retention_amount"]] if obj.get("cashout_retention_amount") is not None else None, + "conekta_retention": [BalanceCommonFielsResponse.from_dict(_item) for _item in obj["conekta_retention"]] if obj.get("conekta_retention") is not None else None, + "gateway": [BalanceCommonFielsResponse.from_dict(_item) for _item in obj["gateway"]] if obj.get("gateway") is not None else None, + "pending": [BalanceCommonFielsResponse.from_dict(_item) for _item in obj["pending"]] if obj.get("pending") is not None else None, + "retained": [BalanceCommonFielsResponse.from_dict(_item) for _item in obj["retained"]] if obj.get("retained") is not None else None, + "retention_amount": [BalanceCommonFielsResponse.from_dict(_item) for _item in obj["retention_amount"]] if obj.get("retention_amount") is not None else None, "target_collateral_amount": obj.get("target_collateral_amount"), - "target_retention_amount": [BalanceCommonField.from_dict(_item) for _item in obj["target_retention_amount"]] if obj.get("target_retention_amount") is not None else None, - "temporarily_retained": [BalanceCommonField.from_dict(_item) for _item in obj["temporarily_retained"]] if obj.get("temporarily_retained") is not None else None + "target_retention_amount": [BalanceCommonFielsResponse.from_dict(_item) for _item in obj["target_retention_amount"]] if obj.get("target_retention_amount") is not None else None, + "temporarily_retained": [BalanceCommonFielsResponse.from_dict(_item) for _item in obj["temporarily_retained"]] if obj.get("temporarily_retained") is not None else None }) return _obj diff --git a/conekta/models/blacklist_rule_response.py b/conekta/models/blacklist_rule_response.py index 856a60b..4cca90e 100644 --- a/conekta/models/blacklist_rule_response.py +++ b/conekta/models/blacklist_rule_response.py @@ -22,19 +22,21 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class BlacklistRuleResponse(BaseModel): """ BlacklistRuleResponse """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="Blacklist rule id") - var_field: Optional[StrictStr] = Field(default=None, description="field used for blacklists rule", alias="field") - value: Optional[StrictStr] = Field(default=None, description="value used for blacklists rule") - description: Optional[StrictStr] = Field(default=None, description="use an description for blacklisted rule") + id: Optional[StrictStr] = Field(default=None, description="Blacklist rule id", json_schema_extra={"examples": ["2fw8EWJusiRrxdPzT"]}) + var_field: Optional[StrictStr] = Field(default=None, description="field used for blacklists rule", alias="field", json_schema_extra={"examples": ["email"]}) + value: Optional[StrictStr] = Field(default=None, description="value used for blacklists rule", json_schema_extra={"examples": ["email@example.com"]}) + description: Optional[StrictStr] = Field(default=None, description="use an description for blacklisted rule", json_schema_extra={"examples": ["secure customer example@example.com"]}) __properties: ClassVar[List[str]] = ["id", "field", "value", "description"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_cash_response_all_of_agreements.py b/conekta/models/cash_agreements_response.py similarity index 80% rename from conekta/models/payment_method_cash_response_all_of_agreements.py rename to conekta/models/cash_agreements_response.py index b955506..1bde9a1 100644 --- a/conekta/models/payment_method_cash_response_all_of_agreements.py +++ b/conekta/models/cash_agreements_response.py @@ -22,17 +22,19 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class PaymentMethodCashResponseAllOfAgreements(BaseModel): +class CashAgreementsResponse(BaseModel): """ - PaymentMethodCashResponseAllOfAgreements + CashAgreementsResponse """ # noqa: E501 - agreement: Optional[StrictStr] = Field(default=None, description="Agreement number, you can use this number to pay in the store/bbva") - provider: Optional[StrictStr] = Field(default=None, description="Provider name, you can use this to know where to pay") + agreement: Optional[StrictStr] = Field(default=None, description="Agreement number, you can use this number to pay in the store/bbva", json_schema_extra={"examples": ["2409526"]}) + provider: Optional[StrictStr] = Field(default=None, description="Provider name, you can use this to know where to pay", json_schema_extra={"examples": ["bbva_cash_in"]}) __properties: ClassVar[List[str]] = ["agreement", "provider"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,12 +46,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of PaymentMethodCashResponseAllOfAgreements from a JSON string""" + """Create an instance of CashAgreementsResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -74,7 +75,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of PaymentMethodCashResponseAllOfAgreements from a dict""" + """Create an instance of CashAgreementsResponse from a dict""" if obj is None: return None diff --git a/conekta/models/charge_order_response.py b/conekta/models/charge_order_response.py index 56c0f3a..a67e3dc 100644 --- a/conekta/models/charge_order_response.py +++ b/conekta/models/charge_order_response.py @@ -24,34 +24,36 @@ from conekta.models.charge_response_channel import ChargeResponseChannel from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ChargeOrderResponse(BaseModel): """ ChargeOrderResponse """ # noqa: E501 - amount: Optional[StrictInt] = None + amount: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [4321]}) channel: Optional[ChargeResponseChannel] = None - created_at: Optional[StrictInt] = None - currency: Optional[StrictStr] = None + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1676386026]}) + currency: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["MXN"]}) customer_id: Optional[StrictStr] = None - description: Optional[StrictStr] = None - device_fingerprint: Optional[StrictStr] = None - failure_code: Optional[StrictStr] = None - failure_message: Optional[StrictStr] = None - id: Optional[StrictStr] = None - livemode: Optional[StrictBool] = None + description: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Payment from order"]}) + device_fingerprint: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6FR3chaU4Y1nGAW5NAGd1rcjAKa142Ba"]}) + failure_code: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["suspected_fraud"]}) + failure_message: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso."]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["63efa757cf65380001aec040"]}) + livemode: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) monthly_installments: Optional[StrictInt] = None object: Optional[StrictStr] = None - order_id: Optional[StrictStr] = None - paid_at: Optional[StrictInt] = None + order_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["ord_2tN73UdUSNrYRPD9r"]}) + paid_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1676390742]}) payment_method: Optional[ChargeOrderResponsePaymentMethod] = None - reference_id: Optional[StrictStr] = Field(default=None, description="Reference ID of the charge") - refunds: Optional[List[Dict[str, Any]]] = None - status: Optional[StrictStr] = None + reference_id: Optional[StrictStr] = Field(default=None, description="Reference ID of the charge", json_schema_extra={"examples": ["ref_2tN73UdUSNrYRPD9r"]}) + refunds: Optional[List[Any]] = None + status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["pending_payment"]}) __properties: ClassVar[List[str]] = ["amount", "channel", "created_at", "currency", "customer_id", "description", "device_fingerprint", "failure_code", "failure_message", "id", "livemode", "monthly_installments", "object", "order_id", "paid_at", "payment_method", "reference_id", "refunds", "status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +65,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -95,26 +96,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of payment_method if self.payment_method: _dict['payment_method'] = self.payment_method.to_dict() - # set to None if device_fingerprint (nullable) is None - # and model_fields_set contains the field - if self.device_fingerprint is None and "device_fingerprint" in self.model_fields_set: - _dict['device_fingerprint'] = None - - # set to None if monthly_installments (nullable) is None - # and model_fields_set contains the field - if self.monthly_installments is None and "monthly_installments" in self.model_fields_set: - _dict['monthly_installments'] = None - - # set to None if paid_at (nullable) is None - # and model_fields_set contains the field - if self.paid_at is None and "paid_at" in self.model_fields_set: - _dict['paid_at'] = None - - # set to None if reference_id (nullable) is None - # and model_fields_set contains the field - if self.reference_id is None and "reference_id" in self.model_fields_set: - _dict['reference_id'] = None - return _dict @classmethod diff --git a/conekta/models/charge_order_response_payment_method.py b/conekta/models/charge_order_response_payment_method.py index 537db94..fd023a3 100644 --- a/conekta/models/charge_order_response_payment_method.py +++ b/conekta/models/charge_order_response_payment_method.py @@ -116,9 +116,10 @@ def from_json(cls, json_str: str) -> Self: match = 0 # use oneOf discriminator to lookup the data type - _data_type = json.loads(json_str).get("object") + _discriminator_property = "object" + _data_type = json.loads(json_str).get(_discriminator_property) if not _data_type: - raise ValueError("Failed to lookup data type from the field `object` in the input.") + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") # check if data type is `PaymentMethodBankTransfer` if _data_type == "bank_transfer_payment": @@ -141,32 +142,7 @@ def from_json(cls, json_str: str) -> Self: return instance # check if data type is `PaymentMethodPbbPayment` - if _data_type == "pbb_payment": - instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) - return instance - - # check if data type is `PaymentMethodBankTransfer` - if _data_type == "payment_method_bank_transfer": - instance.actual_instance = PaymentMethodBankTransfer.from_json(json_str) - return instance - - # check if data type is `PaymentMethodBnplPayment` - if _data_type == "payment_method_bnpl_payment": - instance.actual_instance = PaymentMethodBnplPayment.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCard` - if _data_type == "payment_method_card": - instance.actual_instance = PaymentMethodCard.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCash` - if _data_type == "payment_method_cash": - instance.actual_instance = PaymentMethodCash.from_json(json_str) - return instance - - # check if data type is `PaymentMethodPbbPayment` - if _data_type == "payment_method_pbb_payment": + if _data_type == "pay_by_bank_payment": instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) return instance diff --git a/conekta/models/charge_request.py b/conekta/models/charge_request.py index a295f35..844ed0e 100644 --- a/conekta/models/charge_request.py +++ b/conekta/models/charge_request.py @@ -23,18 +23,20 @@ from conekta.models.charge_request_payment_method import ChargeRequestPaymentMethod from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ChargeRequest(BaseModel): """ The charges to be made """ # noqa: E501 - amount: Optional[StrictInt] = Field(default=None, description="Amount to be charged in cents") + amount: Optional[StrictInt] = Field(default=None, description="Amount to be charged in cents", json_schema_extra={"examples": [40000]}) payment_method: ChargeRequestPaymentMethod reference_id: Optional[StrictStr] = Field(default=None, description="Custom reference to add to the charge") __properties: ClassVar[List[str]] = ["amount", "payment_method", "reference_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/charge_response.py b/conekta/models/charge_response.py index 056556a..5a14bc4 100644 --- a/conekta/models/charge_response.py +++ b/conekta/models/charge_response.py @@ -23,35 +23,39 @@ from conekta.models.charge_response_channel import ChargeResponseChannel from conekta.models.charge_response_payment_method import ChargeResponsePaymentMethod from conekta.models.charge_response_refunds import ChargeResponseRefunds +from conekta.models.chargeback_response import ChargebackResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ChargeResponse(BaseModel): """ ChargeResponse """ # noqa: E501 - amount: StrictInt + amount: StrictInt = Field(json_schema_extra={"examples": [4321]}) channel: Optional[ChargeResponseChannel] = None - created_at: StrictInt - currency: StrictStr + created_at: StrictInt = Field(json_schema_extra={"examples": [1676386026]}) + currency: StrictStr = Field(json_schema_extra={"examples": ["MXN"]}) customer_id: Optional[StrictStr] = None - description: Optional[StrictStr] = None - device_fingerprint: Optional[StrictStr] = None - failure_code: Optional[StrictStr] = None - failure_message: Optional[StrictStr] = None - id: StrictStr = Field(description="Charge ID") - livemode: StrictBool = Field(description="Whether the charge was made in live mode or not") - object: StrictStr - order_id: StrictStr = Field(description="Order ID") - paid_at: Optional[StrictInt] = Field(default=None, description="Payment date") + description: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Payment from order"]}) + device_fingerprint: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6FR3chaU4Y1nGAW5NAGd1rcjAKa142Ba"]}) + failure_code: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["suspected_fraud"]}) + failure_message: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso."]}) + id: StrictStr = Field(description="Charge ID", json_schema_extra={"examples": ["63efa757cf65380001aec040"]}) + livemode: StrictBool = Field(description="Whether the charge was made in live mode or not", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(json_schema_extra={"examples": ["charge"]}) + order_id: StrictStr = Field(description="Order ID", json_schema_extra={"examples": ["ord_2tN73UdUSNrYRPD9r"]}) + paid_at: Optional[StrictInt] = Field(default=None, description="charge Payment date", json_schema_extra={"examples": [1676390742]}) payment_method: Optional[ChargeResponsePaymentMethod] = None - reference_id: Optional[StrictStr] = Field(default=None, description="Reference ID of the charge") + reference_id: Optional[StrictStr] = Field(default=None, description="Reference ID of the charge", json_schema_extra={"examples": ["ref_2tN73UdUSNrYRPD9r"]}) refunds: Optional[ChargeResponseRefunds] = None - status: StrictStr = Field(description="Charge status") - __properties: ClassVar[List[str]] = ["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"] + chargeback: Optional[ChargebackResponse] = None + status: StrictStr = Field(description="Charge status", json_schema_extra={"examples": ["pending_payment"]}) + __properties: ClassVar[List[str]] = ["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", "chargeback", "status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +67,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -98,21 +101,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of refunds if self.refunds: _dict['refunds'] = self.refunds.to_dict() - # set to None if paid_at (nullable) is None - # and model_fields_set contains the field - if self.paid_at is None and "paid_at" in self.model_fields_set: - _dict['paid_at'] = None - - # set to None if reference_id (nullable) is None - # and model_fields_set contains the field - if self.reference_id is None and "reference_id" in self.model_fields_set: - _dict['reference_id'] = None - - # set to None if refunds (nullable) is None - # and model_fields_set contains the field - if self.refunds is None and "refunds" in self.model_fields_set: - _dict['refunds'] = None - + # override the default output from pydantic by calling `to_dict()` of chargeback + if self.chargeback: + _dict['chargeback'] = self.chargeback.to_dict() return _dict @classmethod @@ -142,6 +133,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "payment_method": ChargeResponsePaymentMethod.from_dict(obj["payment_method"]) if obj.get("payment_method") is not None else None, "reference_id": obj.get("reference_id"), "refunds": ChargeResponseRefunds.from_dict(obj["refunds"]) if obj.get("refunds") is not None else None, + "chargeback": ChargebackResponse.from_dict(obj["chargeback"]) if obj.get("chargeback") is not None else None, "status": obj.get("status") }) return _obj diff --git a/conekta/models/charge_response_channel.py b/conekta/models/charge_response_channel.py index a13181c..ee1d720 100644 --- a/conekta/models/charge_response_channel.py +++ b/conekta/models/charge_response_channel.py @@ -18,23 +18,25 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ChargeResponseChannel(BaseModel): """ ChargeResponseChannel """ # noqa: E501 - segment: Optional[StrictStr] = None - checkout_request_id: Optional[StrictStr] = None - checkout_request_type: Optional[StrictStr] = None - id: Optional[StrictStr] = None + segment: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Checkout"]}) + checkout_request_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6fca054a-8519-4c43-971e-cea35cc519bb"]}) + checkout_request_type: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["HostedPayment"]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["channel_2tNDzhA4Akmzj11AU"]}) __properties: ClassVar[List[str]] = ["segment", "checkout_request_id", "checkout_request_type", "id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/charge_response_payment_method.py b/conekta/models/charge_response_payment_method.py index 6ec7f01..8f46c63 100644 --- a/conekta/models/charge_response_payment_method.py +++ b/conekta/models/charge_response_payment_method.py @@ -116,9 +116,10 @@ def from_json(cls, json_str: str) -> Self: match = 0 # use oneOf discriminator to lookup the data type - _data_type = json.loads(json_str).get("object") + _discriminator_property = "object" + _data_type = json.loads(json_str).get(_discriminator_property) if not _data_type: - raise ValueError("Failed to lookup data type from the field `object` in the input.") + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") # check if data type is `PaymentMethodBankTransfer` if _data_type == "bank_transfer_payment": @@ -145,31 +146,6 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) return instance - # check if data type is `PaymentMethodBankTransfer` - if _data_type == "payment_method_bank_transfer": - instance.actual_instance = PaymentMethodBankTransfer.from_json(json_str) - return instance - - # check if data type is `PaymentMethodBnplPayment` - if _data_type == "payment_method_bnpl_payment": - instance.actual_instance = PaymentMethodBnplPayment.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCard` - if _data_type == "payment_method_card": - instance.actual_instance = PaymentMethodCard.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCash` - if _data_type == "payment_method_cash": - instance.actual_instance = PaymentMethodCash.from_json(json_str) - return instance - - # check if data type is `PaymentMethodPbbPayment` - if _data_type == "payment_method_pbb_payment": - instance.actual_instance = PaymentMethodPbbPayment.from_json(json_str) - return instance - # deserialize data into PaymentMethodCash try: instance.actual_instance = PaymentMethodCash.from_json(json_str) diff --git a/conekta/models/charge_response_refunds.py b/conekta/models/charge_response_refunds.py index 41ed877..03ac566 100644 --- a/conekta/models/charge_response_refunds.py +++ b/conekta/models/charge_response_refunds.py @@ -23,20 +23,22 @@ from conekta.models.charge_response_refunds_data import ChargeResponseRefundsData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ChargeResponseRefunds(BaseModel): """ ChargeResponseRefunds """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[ChargeResponseRefundsData]] = Field(default=None, description="refunds") __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/charge_response_refunds_data.py b/conekta/models/charge_response_refunds_data.py index cfe2102..e1d16a8 100644 --- a/conekta/models/charge_response_refunds_data.py +++ b/conekta/models/charge_response_refunds_data.py @@ -22,22 +22,24 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ChargeResponseRefundsData(BaseModel): """ ChargeResponseRefundsData """ # noqa: E501 - amount: StrictInt - auth_code: Optional[StrictStr] = None - created_at: StrictInt - expires_at: Optional[StrictInt] = Field(default=None, description="refund expiration date") - id: StrictStr - object: StrictStr - status: Optional[StrictStr] = Field(default=None, description="refund status") + amount: StrictInt = Field(json_schema_extra={"examples": [-15000]}) + auth_code: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["867372"]}) + created_at: StrictInt = Field(json_schema_extra={"examples": [1678226878]}) + expires_at: Optional[StrictInt] = Field(default=None, description="refund expiration date", json_schema_extra={"examples": [1678226878]}) + id: StrictStr = Field(json_schema_extra={"examples": ["6407b5bee1329a000175ba11"]}) + object: StrictStr = Field(json_schema_extra={"examples": ["refund"]}) + status: Optional[StrictStr] = Field(default=None, description="refund status", json_schema_extra={"examples": ["pending"]}) __properties: ClassVar[List[str]] = ["amount", "auth_code", "created_at", "expires_at", "id", "object", "status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/charge_update_request.py b/conekta/models/charge_update_request.py index 97747d3..2632ee6 100644 --- a/conekta/models/charge_update_request.py +++ b/conekta/models/charge_update_request.py @@ -22,16 +22,18 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ChargeUpdateRequest(BaseModel): """ requested field for update a charge """ # noqa: E501 - reference_id: Optional[StrictStr] = Field(default=None, description="custom reference id") + reference_id: Optional[StrictStr] = Field(default=None, description="custom reference id", json_schema_extra={"examples": ["278482642"]}) __properties: ClassVar[List[str]] = ["reference_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/chargeback_file_response.py b/conekta/models/chargeback_file_response.py new file mode 100644 index 0000000..fa320d7 --- /dev/null +++ b/conekta/models/chargeback_file_response.py @@ -0,0 +1,95 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ChargebackFileResponse(BaseModel): + """ + A file associated with a chargeback (e.g. evidence document) + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["chbkf_2zPxWFUnGNLySoums"]}) + file_name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["20251221500000000000201.pdf"]}) + url: Optional[StrictStr] = None + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1768846800]}) + __properties: ClassVar[List[str]] = ["id", "file_name", "url", "created_at"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ChargebackFileResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ChargebackFileResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "file_name": obj.get("file_name"), + "url": obj.get("url"), + "created_at": obj.get("created_at") + }) + return _obj + + diff --git a/conekta/models/chargeback_response.py b/conekta/models/chargeback_response.py new file mode 100644 index 0000000..7602086 --- /dev/null +++ b/conekta/models/chargeback_response.py @@ -0,0 +1,147 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from conekta.models.chargeback_file_response import ChargebackFileResponse +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ChargebackResponse(BaseModel): + """ + Chargeback object + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["chbk_2zPxWFUnGNLySoumn"]}) + status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["lost"]}) + reason: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["unrecognized"]}) + note: Optional[StrictStr] = None + followup_status: Optional[StrictStr] = None + response_from_client: Optional[StrictStr] = None + files: Optional[List[ChargebackFileResponse]] = None + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["chargeback"]}) + charge_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6966a06c044243000156c24d"]}) + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1768846800]}) + evidence_due_by: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1769126399]}) + __properties: ClassVar[List[str]] = ["id", "status", "reason", "note", "followup_status", "response_from_client", "files", "object", "charge_id", "created_at", "evidence_due_by"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['won', 'lost', 'action_required', 'pending_review', 'under_review', 'covered', 'rt', 'rt_sent', 'represented']): + raise ValueError("must be one of enum values ('won', 'lost', 'action_required', 'pending_review', 'under_review', 'covered', 'rt', 'rt_sent', 'represented')") + return value + + @field_validator('reason') + def reason_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['unrecognized', 'unauthorized', 'unauthorized_by_client', 'unrecognized_like_fraud', 'insufficient_evidence', 'illegible_evidence', 'general', 'late_evidence', 'incorrect_exchange', 'fraudulent_business', 'billing', 'twice_transaction', 'transaction_not_refunded', 'bank_doc_request', 'unrecognized_purchase', 'subscription_canceled', 'copy_of_purchase', 'differents_amounts', 'subscription_not_requested', 'damaged_products', 'show_documents', 'duplicate', 'fraudulent', 'service_canceled', 'product_unacceptable', 'product_not_received', 'incorrect_amount', 'chip_liabiliaty_shift', 'credit_not_processed']): + raise ValueError("must be one of enum values ('unrecognized', 'unauthorized', 'unauthorized_by_client', 'unrecognized_like_fraud', 'insufficient_evidence', 'illegible_evidence', 'general', 'late_evidence', 'incorrect_exchange', 'fraudulent_business', 'billing', 'twice_transaction', 'transaction_not_refunded', 'bank_doc_request', 'unrecognized_purchase', 'subscription_canceled', 'copy_of_purchase', 'differents_amounts', 'subscription_not_requested', 'damaged_products', 'show_documents', 'duplicate', 'fraudulent', 'service_canceled', 'product_unacceptable', 'product_not_received', 'incorrect_amount', 'chip_liabiliaty_shift', 'credit_not_processed')") + return value + + @field_validator('followup_status') + def followup_status_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['customer_uncontacted', 'customer_contacted', 'customer_unreachable']): + raise ValueError("must be one of enum values ('customer_uncontacted', 'customer_contacted', 'customer_unreachable')") + return value + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ChargebackResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in files (list) + _items = [] + if self.files: + for _item_files in self.files: + if _item_files: + _items.append(_item_files.to_dict()) + _dict['files'] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ChargebackResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "status": obj.get("status"), + "reason": obj.get("reason"), + "note": obj.get("note"), + "followup_status": obj.get("followup_status"), + "response_from_client": obj.get("response_from_client"), + "files": [ChargebackFileResponse.from_dict(_item) for _item in obj["files"]] if obj.get("files") is not None else None, + "object": obj.get("object"), + "charge_id": obj.get("charge_id"), + "created_at": obj.get("created_at"), + "evidence_due_by": obj.get("evidence_due_by") + }) + return _obj + + diff --git a/conekta/models/charges_data_response.py b/conekta/models/charges_data_response.py index cd1dc00..c8966db 100644 --- a/conekta/models/charges_data_response.py +++ b/conekta/models/charges_data_response.py @@ -23,35 +23,39 @@ from conekta.models.charge_response_channel import ChargeResponseChannel from conekta.models.charge_response_payment_method import ChargeResponsePaymentMethod from conekta.models.charge_response_refunds import ChargeResponseRefunds +from conekta.models.chargeback_response import ChargebackResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ChargesDataResponse(BaseModel): """ ChargesDataResponse """ # noqa: E501 - amount: StrictInt + amount: StrictInt = Field(json_schema_extra={"examples": [4321]}) channel: Optional[ChargeResponseChannel] = None - created_at: StrictInt - currency: StrictStr + created_at: StrictInt = Field(json_schema_extra={"examples": [1676386026]}) + currency: StrictStr = Field(json_schema_extra={"examples": ["MXN"]}) customer_id: Optional[StrictStr] = None - description: Optional[StrictStr] = None - device_fingerprint: Optional[StrictStr] = None - failure_code: Optional[StrictStr] = None - failure_message: Optional[StrictStr] = None - id: StrictStr = Field(description="Charge ID") - livemode: StrictBool = Field(description="Whether the charge was made in live mode or not") - object: StrictStr - order_id: StrictStr = Field(description="Order ID") - paid_at: Optional[StrictInt] = Field(default=None, description="Payment date") + description: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Payment from order"]}) + device_fingerprint: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6FR3chaU4Y1nGAW5NAGd1rcjAKa142Ba"]}) + failure_code: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["suspected_fraud"]}) + failure_message: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Este cargo ha sido declinado porque el comportamiento del comprador es sospechoso."]}) + id: StrictStr = Field(description="Charge ID", json_schema_extra={"examples": ["63efa757cf65380001aec040"]}) + livemode: StrictBool = Field(description="Whether the charge was made in live mode or not", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(json_schema_extra={"examples": ["charge"]}) + order_id: StrictStr = Field(description="Order ID", json_schema_extra={"examples": ["ord_2tN73UdUSNrYRPD9r"]}) + paid_at: Optional[StrictInt] = Field(default=None, description="charge Payment date", json_schema_extra={"examples": [1676390742]}) payment_method: Optional[ChargeResponsePaymentMethod] = None - reference_id: Optional[StrictStr] = Field(default=None, description="Reference ID of the charge") + reference_id: Optional[StrictStr] = Field(default=None, description="Reference ID of the charge", json_schema_extra={"examples": ["ref_2tN73UdUSNrYRPD9r"]}) refunds: Optional[ChargeResponseRefunds] = None - status: StrictStr = Field(description="Charge status") - __properties: ClassVar[List[str]] = ["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"] + chargeback: Optional[ChargebackResponse] = None + status: StrictStr = Field(description="Charge status", json_schema_extra={"examples": ["pending_payment"]}) + __properties: ClassVar[List[str]] = ["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", "chargeback", "status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +67,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -98,21 +101,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of refunds if self.refunds: _dict['refunds'] = self.refunds.to_dict() - # set to None if paid_at (nullable) is None - # and model_fields_set contains the field - if self.paid_at is None and "paid_at" in self.model_fields_set: - _dict['paid_at'] = None - - # set to None if reference_id (nullable) is None - # and model_fields_set contains the field - if self.reference_id is None and "reference_id" in self.model_fields_set: - _dict['reference_id'] = None - - # set to None if refunds (nullable) is None - # and model_fields_set contains the field - if self.refunds is None and "refunds" in self.model_fields_set: - _dict['refunds'] = None - + # override the default output from pydantic by calling `to_dict()` of chargeback + if self.chargeback: + _dict['chargeback'] = self.chargeback.to_dict() return _dict @classmethod @@ -142,6 +133,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "payment_method": ChargeResponsePaymentMethod.from_dict(obj["payment_method"]) if obj.get("payment_method") is not None else None, "reference_id": obj.get("reference_id"), "refunds": ChargeResponseRefunds.from_dict(obj["refunds"]) if obj.get("refunds") is not None else None, + "chargeback": ChargebackResponse.from_dict(obj["chargeback"]) if obj.get("chargeback") is not None else None, "status": obj.get("status") }) return _obj diff --git a/conekta/models/charges_order_response.py b/conekta/models/charges_order_response.py index f5cac19..205789e 100644 --- a/conekta/models/charges_order_response.py +++ b/conekta/models/charges_order_response.py @@ -20,21 +20,25 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.charges_order_response_all_of_data import ChargesOrderResponseAllOfData +from conekta.models.charge_response import ChargeResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ChargesOrderResponse(BaseModel): """ The charges associated with the order """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - data: Optional[List[ChargesOrderResponseAllOfData]] = None - __properties: ClassVar[List[str]] = ["has_more", "object", "data"] + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) + data: Optional[List[ChargeResponse]] = None + __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -93,7 +96,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "has_more": obj.get("has_more"), "object": obj.get("object"), - "data": [ChargesOrderResponseAllOfData.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None + "next_page_url": obj.get("next_page_url"), + "previous_page_url": obj.get("previous_page_url"), + "data": [ChargeResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None }) return _obj diff --git a/conekta/models/charges_order_response_all_of_data.py b/conekta/models/charges_order_response_all_of_data.py deleted file mode 100644 index c82003e..0000000 --- a/conekta/models/charges_order_response_all_of_data.py +++ /dev/null @@ -1,149 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.charge_response_channel import ChargeResponseChannel -from conekta.models.charge_response_payment_method import ChargeResponsePaymentMethod -from conekta.models.charge_response_refunds import ChargeResponseRefunds -from typing import Optional, Set -from typing_extensions import Self - -class ChargesOrderResponseAllOfData(BaseModel): - """ - ChargesOrderResponseAllOfData - """ # noqa: E501 - amount: StrictInt - channel: Optional[ChargeResponseChannel] = None - created_at: StrictInt - currency: StrictStr - customer_id: Optional[StrictStr] = None - description: Optional[StrictStr] = None - device_fingerprint: Optional[StrictStr] = None - failure_code: Optional[StrictStr] = None - failure_message: Optional[StrictStr] = None - id: StrictStr = Field(description="Charge ID") - livemode: StrictBool = Field(description="Whether the charge was made in live mode or not") - object: StrictStr - order_id: StrictStr = Field(description="Order ID") - paid_at: Optional[StrictInt] = Field(default=None, description="Payment date") - payment_method: Optional[ChargeResponsePaymentMethod] = None - reference_id: Optional[StrictStr] = Field(default=None, description="Reference ID of the charge") - refunds: Optional[ChargeResponseRefunds] = None - status: StrictStr = Field(description="Charge status") - __properties: ClassVar[List[str]] = ["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"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ChargesOrderResponseAllOfData from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of channel - if self.channel: - _dict['channel'] = self.channel.to_dict() - # override the default output from pydantic by calling `to_dict()` of payment_method - if self.payment_method: - _dict['payment_method'] = self.payment_method.to_dict() - # override the default output from pydantic by calling `to_dict()` of refunds - if self.refunds: - _dict['refunds'] = self.refunds.to_dict() - # set to None if paid_at (nullable) is None - # and model_fields_set contains the field - if self.paid_at is None and "paid_at" in self.model_fields_set: - _dict['paid_at'] = None - - # set to None if reference_id (nullable) is None - # and model_fields_set contains the field - if self.reference_id is None and "reference_id" in self.model_fields_set: - _dict['reference_id'] = None - - # set to None if refunds (nullable) is None - # and model_fields_set contains the field - if self.refunds is None and "refunds" in self.model_fields_set: - _dict['refunds'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ChargesOrderResponseAllOfData from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "amount": obj.get("amount"), - "channel": ChargeResponseChannel.from_dict(obj["channel"]) if obj.get("channel") is not None else None, - "created_at": obj.get("created_at"), - "currency": obj.get("currency"), - "customer_id": obj.get("customer_id"), - "description": obj.get("description"), - "device_fingerprint": obj.get("device_fingerprint"), - "failure_code": obj.get("failure_code"), - "failure_message": obj.get("failure_message"), - "id": obj.get("id"), - "livemode": obj.get("livemode"), - "object": obj.get("object"), - "order_id": obj.get("order_id"), - "paid_at": obj.get("paid_at"), - "payment_method": ChargeResponsePaymentMethod.from_dict(obj["payment_method"]) if obj.get("payment_method") is not None else None, - "reference_id": obj.get("reference_id"), - "refunds": ChargeResponseRefunds.from_dict(obj["refunds"]) if obj.get("refunds") is not None else None, - "status": obj.get("status") - }) - return _obj - - diff --git a/conekta/models/checkout.py b/conekta/models/checkout.py index e3bcf55..22139fa 100644 --- a/conekta/models/checkout.py +++ b/conekta/models/checkout.py @@ -18,32 +18,49 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from conekta.models.checkout_order_template import CheckoutOrderTemplate from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Checkout(BaseModel): """ It is a sub-resource of the Order model that can be stipulated in order to configure its corresponding checkout """ # noqa: E501 - allowed_payment_methods: List[StrictStr] = Field(description="Those are the payment methods that will be available for the link") - expires_at: StrictInt = Field(description="It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 2 to 365 days (the valid range will be taken from the next day of the creation date at 00:01 hrs) ") - monthly_installments_enabled: Optional[StrictBool] = Field(default=None, description="This flag allows you to specify if months without interest will be active.") - monthly_installments_options: Optional[List[StrictInt]] = Field(default=None, description="This field allows you to specify the number of months without interest.") - three_ds_mode: Optional[StrictStr] = Field(default=None, description="Indicates the 3DS2 mode for the order, either smart or strict.") - name: StrictStr = Field(description="Reason for charge") - needs_shipping_contact: Optional[StrictBool] = Field(default=None, description="This flag allows you to fill in the shipping information at checkout.") - on_demand_enabled: Optional[StrictBool] = Field(default=None, description="This flag allows you to specify if the link will be on demand.") + allowed_payment_methods: List[StrictStr] = Field(description="Those are the payment methods that will be available for the link", json_schema_extra={"examples": [["cash", "card", "bank_transfer", "bnpl", "pay_by_bank"]]}) + exclude_card_networks: Optional[List[StrictStr]] = Field(default=None, description="List of card networks to exclude from the checkout. This field is only applicable for card payments.", json_schema_extra={"examples": [["visa", "amex"]]}) + expires_at: Annotated[int, Field(strict=True, ge=1)] = Field(description="It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 5 minutes to 365 days from the creation date. ", json_schema_extra={"examples": [1680397724]}) + monthly_installments_enabled: Optional[StrictBool] = Field(default=None, description="This flag allows you to specify if months without interest will be active.", json_schema_extra={"examples": [True]}) + monthly_installments_options: Optional[List[StrictInt]] = Field(default=None, description="This field allows you to specify the number of months without interest.", json_schema_extra={"examples": [[3, 6, 12]]}) + three_ds_mode: Optional[StrictStr] = Field(default=None, description="Indicates the 3DS2 mode for the order, either smart or strict. This property is only applicable when 3DS is enabled. When 3DS is disabled, this field should be null.") + name: StrictStr = Field(description="Reason for charge", json_schema_extra={"examples": ["Payment Link Name 1594138857"]}) + needs_shipping_contact: Optional[StrictBool] = Field(default=None, description="This flag allows you to fill in the shipping information at checkout.", json_schema_extra={"examples": [False]}) + on_demand_enabled: Optional[StrictBool] = Field(default=None, description="This flag allows you to specify if the link will be on demand.", json_schema_extra={"examples": [True]}) + plan_ids: Optional[List[StrictStr]] = Field(default=None, description="It is a list of plan IDs that will be associated with the order.", json_schema_extra={"examples": [["plan_123", "plan_456"]]}) order_template: CheckoutOrderTemplate - payments_limit_count: Optional[StrictInt] = Field(default=None, description="It is the number of payments that can be made through the link.") - recurrent: StrictBool = Field(description="false: single use. true: multiple payments") - type: StrictStr = Field(description="It is the type of link that will be created. It must be a valid type.") - __properties: ClassVar[List[str]] = ["allowed_payment_methods", "expires_at", "monthly_installments_enabled", "monthly_installments_options", "three_ds_mode", "name", "needs_shipping_contact", "on_demand_enabled", "order_template", "payments_limit_count", "recurrent", "type"] + payments_limit_count: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="It is the number of payments that can be made through the link.", json_schema_extra={"examples": [5]}) + success_url: Optional[StrictStr] = Field(default=None, description="The URL to redirect to after a successful payment.", json_schema_extra={"examples": ["https://www.conekta.com/success"]}) + recurrent: StrictBool = Field(description="false: single use. true: multiple payments", json_schema_extra={"examples": [False]}) + type: StrictStr = Field(description="It is the type of link that will be created. It must be a valid type.", json_schema_extra={"examples": ["PaymentLink"]}) + __properties: ClassVar[List[str]] = ["allowed_payment_methods", "exclude_card_networks", "expires_at", "monthly_installments_enabled", "monthly_installments_options", "three_ds_mode", "name", "needs_shipping_contact", "on_demand_enabled", "plan_ids", "order_template", "payments_limit_count", "success_url", "recurrent", "type"] + + @field_validator('exclude_card_networks') + def exclude_card_networks_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['visa', 'mastercard', 'amex']): + raise ValueError("each list item must be one of ('visa', 'mastercard', 'amex')") + return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +72,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -84,11 +100,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of order_template if self.order_template: _dict['order_template'] = self.order_template.to_dict() - # set to None if on_demand_enabled (nullable) is None - # and model_fields_set contains the field - if self.on_demand_enabled is None and "on_demand_enabled" in self.model_fields_set: - _dict['on_demand_enabled'] = None - return _dict @classmethod @@ -102,6 +113,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "allowed_payment_methods": obj.get("allowed_payment_methods"), + "exclude_card_networks": obj.get("exclude_card_networks"), "expires_at": obj.get("expires_at"), "monthly_installments_enabled": obj.get("monthly_installments_enabled"), "monthly_installments_options": obj.get("monthly_installments_options"), @@ -109,8 +121,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "name": obj.get("name"), "needs_shipping_contact": obj.get("needs_shipping_contact"), "on_demand_enabled": obj.get("on_demand_enabled"), + "plan_ids": obj.get("plan_ids"), "order_template": CheckoutOrderTemplate.from_dict(obj["order_template"]) if obj.get("order_template") is not None else None, "payments_limit_count": obj.get("payments_limit_count"), + "success_url": obj.get("success_url"), "recurrent": obj.get("recurrent"), "type": obj.get("type") }) diff --git a/conekta/models/checkout_order_template.py b/conekta/models/checkout_order_template.py index ebe2a7d..01151a8 100644 --- a/conekta/models/checkout_order_template.py +++ b/conekta/models/checkout_order_template.py @@ -18,27 +18,32 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated -from conekta.models.checkout_order_template_customer_info import CheckoutOrderTemplateCustomerInfo +from conekta.models.order_discount_lines_request import OrderDiscountLinesRequest +from conekta.models.order_request_customer_info import OrderRequestCustomerInfo +from conekta.models.order_tax_request import OrderTaxRequest from conekta.models.product import Product from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CheckoutOrderTemplate(BaseModel): """ It maintains the attributes with which the order will be created when receiving a new payment. """ # noqa: E501 - currency: Annotated[str, Field(strict=True, max_length=3)] = Field(description="It is the currency in which the order will be created. It must be a valid ISO 4217 currency code.") - customer_info: Optional[CheckoutOrderTemplateCustomerInfo] = None + currency: Annotated[str, Field(strict=True, max_length=3)] = Field(description="It is the currency in which the order will be created. It must be a valid ISO 4217 currency code.", json_schema_extra={"examples": ["MXN"]}) + customer_info: Optional[OrderRequestCustomerInfo] = None line_items: List[Product] = Field(description="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.") - plan_ids: Optional[List[StrictStr]] = Field(default=None, description="It is a list of plan IDs that will be associated with the order.") - metadata: Optional[Dict[str, Any]] = Field(default=None, description="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.") - __properties: ClassVar[List[str]] = ["currency", "customer_info", "line_items", "plan_ids", "metadata"] + metadata: Optional[Dict[str, Any]] = Field(default=None, description="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.", json_schema_extra={"examples": [{"key": "value"}]}) + tax_lines: Optional[List[OrderTaxRequest]] = Field(default=None, description="List of [taxes](https://developers.conekta.com/v2.2.0/reference/orderscreatetaxes) that are applied to the order.") + discount_lines: Optional[List[OrderDiscountLinesRequest]] = Field(default=None, description="List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order.") + __properties: ClassVar[List[str]] = ["currency", "customer_info", "line_items", "metadata", "tax_lines", "discount_lines"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +55,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -86,6 +90,20 @@ def to_dict(self) -> Dict[str, Any]: if _item_line_items: _items.append(_item_line_items.to_dict()) _dict['line_items'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in tax_lines (list) + _items = [] + if self.tax_lines: + for _item_tax_lines in self.tax_lines: + if _item_tax_lines: + _items.append(_item_tax_lines.to_dict()) + _dict['tax_lines'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in discount_lines (list) + _items = [] + if self.discount_lines: + for _item_discount_lines in self.discount_lines: + if _item_discount_lines: + _items.append(_item_discount_lines.to_dict()) + _dict['discount_lines'] = _items return _dict @classmethod @@ -99,10 +117,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "currency": obj.get("currency"), - "customer_info": CheckoutOrderTemplateCustomerInfo.from_dict(obj["customer_info"]) if obj.get("customer_info") is not None else None, + "customer_info": OrderRequestCustomerInfo.from_dict(obj["customer_info"]) if obj.get("customer_info") is not None else None, "line_items": [Product.from_dict(_item) for _item in obj["line_items"]] if obj.get("line_items") is not None else None, - "plan_ids": obj.get("plan_ids"), - "metadata": obj.get("metadata") + "metadata": obj.get("metadata"), + "tax_lines": [OrderTaxRequest.from_dict(_item) for _item in obj["tax_lines"]] if obj.get("tax_lines") is not None else None, + "discount_lines": [OrderDiscountLinesRequest.from_dict(_item) for _item in obj["discount_lines"]] if obj.get("discount_lines") is not None else None }) return _obj diff --git a/conekta/models/checkout_order_template_customer_info.py b/conekta/models/checkout_order_template_customer_info.py deleted file mode 100644 index 801efe8..0000000 --- a/conekta/models/checkout_order_template_customer_info.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import json -import pprint -from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator -from typing import Any, List, Optional -from conekta.models.customer_info import CustomerInfo -from conekta.models.customer_info_just_customer_id import CustomerInfoJustCustomerId -from pydantic import StrictStr, Field -from typing import Union, List, Set, Optional, Dict -from typing_extensions import Literal, Self - -CHECKOUTORDERTEMPLATECUSTOMERINFO_ONE_OF_SCHEMAS = ["CustomerInfo", "CustomerInfoJustCustomerId"] - -class CheckoutOrderTemplateCustomerInfo(BaseModel): - """ - It is the information of the customer who will be created when receiving a new payment. - """ - # data type: CustomerInfo - oneof_schema_1_validator: Optional[CustomerInfo] = None - # data type: CustomerInfoJustCustomerId - oneof_schema_2_validator: Optional[CustomerInfoJustCustomerId] = None - actual_instance: Optional[Union[CustomerInfo, CustomerInfoJustCustomerId]] = None - one_of_schemas: Set[str] = { "CustomerInfo", "CustomerInfoJustCustomerId" } - - model_config = ConfigDict( - validate_assignment=True, - protected_namespaces=(), - ) - - - def __init__(self, *args, **kwargs) -> None: - if args: - if len(args) > 1: - raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`") - if kwargs: - raise ValueError("If a position argument is used, keyword arguments cannot be used.") - super().__init__(actual_instance=args[0]) - else: - super().__init__(**kwargs) - - @field_validator('actual_instance') - def actual_instance_must_validate_oneof(cls, v): - instance = CheckoutOrderTemplateCustomerInfo.model_construct() - error_messages = [] - match = 0 - # validate data type: CustomerInfo - if not isinstance(v, CustomerInfo): - error_messages.append(f"Error! Input type `{type(v)}` is not `CustomerInfo`") - else: - match += 1 - # validate data type: CustomerInfoJustCustomerId - if not isinstance(v, CustomerInfoJustCustomerId): - error_messages.append(f"Error! Input type `{type(v)}` is not `CustomerInfoJustCustomerId`") - else: - match += 1 - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in CheckoutOrderTemplateCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when setting `actual_instance` in CheckoutOrderTemplateCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) - else: - return v - - @classmethod - def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self: - return cls.from_json(json.dumps(obj)) - - @classmethod - def from_json(cls, json_str: str) -> Self: - """Returns the object represented by the json string""" - instance = cls.model_construct() - error_messages = [] - match = 0 - - # deserialize data into CustomerInfo - try: - instance.actual_instance = CustomerInfo.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - # deserialize data into CustomerInfoJustCustomerId - try: - instance.actual_instance = CustomerInfoJustCustomerId.from_json(json_str) - match += 1 - except (ValidationError, ValueError) as e: - error_messages.append(str(e)) - - if match > 1: - # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into CheckoutOrderTemplateCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) - elif match == 0: - # no match - raise ValueError("No match found when deserializing the JSON string into CheckoutOrderTemplateCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) - else: - return instance - - def to_json(self) -> str: - """Returns the JSON representation of the actual instance""" - if self.actual_instance is None: - return "null" - - if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json): - return self.actual_instance.to_json() - else: - return json.dumps(self.actual_instance) - - def to_dict(self) -> Optional[Union[Dict[str, Any], CustomerInfo, CustomerInfoJustCustomerId]]: - """Returns the dict representation of the actual instance""" - if self.actual_instance is None: - return None - - if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict): - return self.actual_instance.to_dict() - else: - # primitive type - return self.actual_instance - - def to_str(self) -> str: - """Returns the string representation of the actual instance""" - return pprint.pformat(self.model_dump()) - - diff --git a/conekta/models/checkout_response.py b/conekta/models/checkout_response.py index f1f0c48..3982d87 100644 --- a/conekta/models/checkout_response.py +++ b/conekta/models/checkout_response.py @@ -18,45 +18,58 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CheckoutResponse(BaseModel): """ checkout response """ # noqa: E501 - allowed_payment_methods: Optional[List[StrictStr]] = Field(default=None, description="Are the payment methods available for this link") - plan_ids: Optional[List[StrictStr]] = Field(default=None, description="List of plan IDs that are available for subscription") - can_not_expire: Optional[StrictBool] = None - emails_sent: Optional[StrictInt] = None - exclude_card_networks: Optional[List[Dict[str, Any]]] = None - expires_at: Optional[StrictInt] = None - failure_url: Optional[StrictStr] = None - force_3ds_flow: Optional[StrictBool] = None - id: StrictStr - livemode: StrictBool - metadata: Optional[Dict[str, Any]] = None - monthly_installments_enabled: Optional[StrictBool] = None - monthly_installments_options: Optional[List[StrictInt]] = None - name: StrictStr = Field(description="Reason for charge") - needs_shipping_contact: Optional[StrictBool] = None - object: StrictStr - paid_payments_count: Optional[StrictInt] = None - payments_limit_count: Optional[StrictInt] = None - recurrent: Optional[StrictBool] = None - slug: Optional[StrictStr] = None - sms_sent: Optional[StrictInt] = None - starts_at: Optional[StrictInt] = None - status: Optional[StrictStr] = None - success_url: Optional[StrictStr] = None - type: Optional[StrictStr] = None - url: Optional[StrictStr] = None + allowed_payment_methods: Optional[List[StrictStr]] = Field(default=None, description="Are the payment methods available for this link", json_schema_extra={"examples": [["cash", "card", "bank_transfer", "bnpl", "pay_by_bank"]]}) + plan_ids: Optional[List[StrictStr]] = Field(default=None, description="List of plan IDs that are available for subscription", json_schema_extra={"examples": [["plan_123", "plan_456"]]}) + can_not_expire: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + emails_sent: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) + exclude_card_networks: Optional[List[StrictStr]] = Field(default=None, json_schema_extra={"examples": [["visa", "amex"]]}) + expires_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1680397724]}) + failure_url: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["https://pay.conekta.com/failure"]}) + force_3ds_flow: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + id: StrictStr = Field(json_schema_extra={"examples": ["b0bf16c4-18b9-445e-ba24-01604f329dbf"]}) + livemode: StrictBool = Field(json_schema_extra={"examples": [True]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"key": "value"}]}) + monthly_installments_enabled: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + monthly_installments_options: Optional[List[StrictInt]] = Field(default=None, json_schema_extra={"examples": [[3, 6, 12]]}) + name: StrictStr = Field(description="Reason for charge", json_schema_extra={"examples": ["Payment Link Name 1594138857"]}) + needs_shipping_contact: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + object: StrictStr = Field(json_schema_extra={"examples": ["checkout"]}) + paid_payments_count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) + payments_limit_count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [5]}) + recurrent: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + slug: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["b0bf16c418b9445eba2401604f329dbf"]}) + sms_sent: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) + starts_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677650400]}) + status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Issued"]}) + success_url: Optional[StrictStr] = Field(default=None, description="The URL to redirect to after a successful payment.", json_schema_extra={"examples": ["https://pay.conekta.com/success"]}) + type: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["PaymentLink"]}) + url: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["https://pay.conekta.com/link/b0bf16c418b9445eba2401604f329dbf"]}) __properties: ClassVar[List[str]] = ["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"] + @field_validator('exclude_card_networks') + def exclude_card_networks_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['visa', 'mastercard', 'amex']): + raise ValueError("each list item must be one of ('visa', 'mastercard', 'amex')") + return value + model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -68,8 +81,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -94,11 +106,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if payments_limit_count (nullable) is None - # and model_fields_set contains the field - if self.payments_limit_count is None and "payments_limit_count" in self.model_fields_set: - _dict['payments_limit_count'] = None - return _dict @classmethod diff --git a/conekta/models/checkouts_response.py b/conekta/models/checkouts_response.py index 0ba46c9..2bcac3d 100644 --- a/conekta/models/checkouts_response.py +++ b/conekta/models/checkouts_response.py @@ -23,20 +23,22 @@ from conekta.models.checkout_response import CheckoutResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CheckoutsResponse(BaseModel): """ CheckoutsResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[CheckoutResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/company_document_request.py b/conekta/models/company_document_request.py index 2f55c49..a7e3d97 100644 --- a/conekta/models/company_document_request.py +++ b/conekta/models/company_document_request.py @@ -22,16 +22,17 @@ from typing import Any, ClassVar, Dict, List, Optional, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CompanyDocumentRequest(BaseModel): """ Request body for uploading a company document. """ # noqa: E501 - file_classification: StrictStr = Field(description="Classification of the document. | Tipo de archivo | Descripción | | :--------------------------- | :-------------------------------------------------------- | | `id_legal_representative` | identificación oficial frente | | `id_legal_representative_back` | identificación oficial atrás | | `cfdi` | Prueba de situación fiscal | | `constitutive_act_basic` | Acta constitutiva | | `proof_of_address` | Comprobante de domicilio del negocio | | `power_of_attonery` | Poderes de representación | | `deposit_account_cover` | Carátula de la cuenta de depósito | | `permit_casino` | Permiso ante SEGOB | | `license_sanitation` | Licencia sanitaria de COFEPRIS | | `registration_tourism` | Inscripción ante el Registro Nacional de Turismo (SECTUR) | ") - content_type: StrictStr = Field(description="MIME type of the file. Allowed values depend on the `file_classification`. - `image/jpeg` - `image/png` - `application/pdf` ") - international: Optional[StrictBool] = Field(default=None, description="Indicates if the document is international. Defaults to false.") - file_name: StrictStr = Field(description="Name of the file being uploaded.") - file_data: Union[StrictBytes, StrictStr] = Field(description="Base64 encoded content of the file.") + file_classification: StrictStr = Field(description="Classification of the document. | Tipo de archivo | Descripción | | :--------------------------- | :-------------------------------------------------------- | | `id_legal_representative` | identificación oficial frente | | `id_legal_representative_back` | identificación oficial atrás | | `cfdi` | Prueba de situación fiscal | | `constitutive_act_basic` | Acta constitutiva | | `proof_of_address` | Comprobante de domicilio del negocio | | `power_of_attonery` | Poderes de representación | | `deposit_account_cover` | Carátula de la cuenta de depósito | | `permit_casino` | Permiso ante SEGOB | | `license_sanitation` | Licencia sanitaria de COFEPRIS | | `registration_tourism` | Inscripción ante el Registro Nacional de Turismo (SECTUR) | ", json_schema_extra={"examples": ["id_legal_representative"]}) + content_type: StrictStr = Field(description="MIME type of the file. Allowed values depend on the `file_classification`. - `image/jpeg` - `image/png` - `application/pdf` ", json_schema_extra={"examples": ["application/pdf"]}) + international: Optional[StrictBool] = Field(default=None, description="Indicates if the document is international. Defaults to false.", json_schema_extra={"examples": [False]}) + file_name: StrictStr = Field(description="Name of the file being uploaded.", json_schema_extra={"examples": ["example_document.pdf"]}) + file_data: Union[StrictBytes, StrictStr] = Field(description="Base64 encoded content of the file.", json_schema_extra={"examples": ["VGhpcyBpcyBhIHRlc3QgZmlsZSBkYXRhIGluIGJhc2UgNjQu"]}) __properties: ClassVar[List[str]] = ["file_classification", "content_type", "international", "file_name", "file_data"] @field_validator('file_classification') @@ -42,7 +43,8 @@ def file_classification_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/company_document_response.py b/conekta/models/company_document_response.py index 473edf3..97b723e 100644 --- a/conekta/models/company_document_response.py +++ b/conekta/models/company_document_response.py @@ -22,14 +22,15 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CompanyDocumentResponse(BaseModel): """ Response body after uploading a company document. """ # noqa: E501 - file_classification: StrictStr = Field(description="Classification of the document. | Tipo de archivo | Descripción | | :--------------------------- | :-------------------------------------------------------- | | `id_legal_representative` | identificación oficial frente | | `id_legal_representative_back` | identificación oficial atrás | | `cfdi` | Prueba de situación fiscal | | `constitutive_act_basic` | Acta constitutiva | | `proof_of_address` | Comprobante de domicilio del negocio | | `power_of_attonery` | Poderes de representación | | `deposit_account_cover` | Carátula de la cuenta de depósito | | `permit_casino` | Permiso ante SEGOB | | `license_sanitation` | Licencia sanitaria de COFEPRIS | | `registration_tourism` | Inscripción ante el Registro Nacional de Turismo (SECTUR) | ") - file_name: StrictStr = Field(description="Name of the file as stored or processed.") - status: StrictStr = Field(description="Current status of the document.") + file_classification: StrictStr = Field(description="Classification of the document. | Tipo de archivo | Descripción | | :--------------------------- | :-------------------------------------------------------- | | `id_legal_representative` | identificación oficial frente | | `id_legal_representative_back` | identificación oficial atrás | | `cfdi` | Prueba de situación fiscal | | `constitutive_act_basic` | Acta constitutiva | | `proof_of_address` | Comprobante de domicilio del negocio | | `power_of_attonery` | Poderes de representación | | `deposit_account_cover` | Carátula de la cuenta de depósito | | `permit_casino` | Permiso ante SEGOB | | `license_sanitation` | Licencia sanitaria de COFEPRIS | | `registration_tourism` | Inscripción ante el Registro Nacional de Turismo (SECTUR) | ", json_schema_extra={"examples": ["id_legal_representative"]}) + file_name: StrictStr = Field(description="Name of the file as stored or processed.", json_schema_extra={"examples": ["prueba3.pdf"]}) + status: StrictStr = Field(description="Current status of the document.", json_schema_extra={"examples": ["uploaded"]}) __properties: ClassVar[List[str]] = ["file_classification", "file_name", "status"] @field_validator('file_classification') @@ -40,7 +41,8 @@ def file_classification_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/company_response.py b/conekta/models/company_response.py index 713df1d..0abdc1f 100644 --- a/conekta/models/company_response.py +++ b/conekta/models/company_response.py @@ -18,29 +18,43 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.company_response_documents_inner import CompanyResponseDocumentsInner +from conekta.models.company_document_response import CompanyDocumentResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CompanyResponse(BaseModel): """ CompanyResponse """ # noqa: E501 - id: StrictStr = Field(description="The unique identifier for the company.") - name: StrictStr = Field(description="The name of the company.") - active: StrictBool = Field(description="Indicates if the company is active.") - account_status: StrictStr = Field(description="The current status of the company's account.") - parent_company_id: Optional[StrictStr] = Field(default=None, description="The identifier of the parent company, if any.") - onboarding_status: StrictStr = Field(description="The current status of the company's onboarding process.") - documents: List[CompanyResponseDocumentsInner] = Field(description="A list of documents related to the company.") - created_at: StrictInt = Field(description="Timestamp of when the company was created.") - object: StrictStr = Field(description="The type of object, typically \"company\".") - __properties: ClassVar[List[str]] = ["id", "name", "active", "account_status", "parent_company_id", "onboarding_status", "documents", "created_at", "object"] + id: StrictStr = Field(description="The unique identifier for the company.", json_schema_extra={"examples": ["6827305a1ec60400015eb116"]}) + name: StrictStr = Field(description="The name of the company.", json_schema_extra={"examples": ["test"]}) + active: StrictBool = Field(description="Indicates if the company is active.", json_schema_extra={"examples": [False]}) + account_status: StrictStr = Field(description="The current status of the company's account.", json_schema_extra={"examples": ["signed_up"]}) + parent_company_id: Optional[StrictStr] = Field(default=None, description="The identifier of the parent company, if any.", json_schema_extra={"examples": ["680bf1da38716d00013543bc"]}) + onboarding_status: StrictStr = Field(description="The current status of the company's onboarding process.", json_schema_extra={"examples": ["pending"]}) + documents: List[CompanyDocumentResponse] = Field(description="A list of documents related to the company.") + created_at: StrictInt = Field(description="Timestamp of when the company was created.", json_schema_extra={"examples": [1748968241]}) + object: StrictStr = Field(description="The type of object, typically \"company\".", json_schema_extra={"examples": ["company"]}) + three_ds_enabled: Optional[StrictBool] = Field(default=None, description="Indicates if 3DS authentication is enabled for the company.", json_schema_extra={"examples": [True]}) + three_ds_mode: Optional[StrictStr] = Field(default=None, description="The 3DS mode for the company, either 'smart' or 'strict'. This property is only applicable when three_ds_enabled is true. When three_ds_enabled is false, this field will be null.", json_schema_extra={"examples": ["strict"]}) + __properties: ClassVar[List[str]] = ["id", "name", "active", "account_status", "parent_company_id", "onboarding_status", "documents", "created_at", "object", "three_ds_enabled", "three_ds_mode"] + + @field_validator('three_ds_mode') + def three_ds_mode_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['smart', 'strict']): + raise ValueError("must be one of enum values ('smart', 'strict')") + return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +66,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -85,11 +98,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_documents: _items.append(_item_documents.to_dict()) _dict['documents'] = _items - # set to None if parent_company_id (nullable) is None - # and model_fields_set contains the field - if self.parent_company_id is None and "parent_company_id" in self.model_fields_set: - _dict['parent_company_id'] = None - return _dict @classmethod @@ -108,9 +116,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "account_status": obj.get("account_status"), "parent_company_id": obj.get("parent_company_id"), "onboarding_status": obj.get("onboarding_status"), - "documents": [CompanyResponseDocumentsInner.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None, + "documents": [CompanyDocumentResponse.from_dict(_item) for _item in obj["documents"]] if obj.get("documents") is not None else None, "created_at": obj.get("created_at"), - "object": obj.get("object") + "object": obj.get("object"), + "three_ds_enabled": obj.get("three_ds_enabled"), + "three_ds_mode": obj.get("three_ds_mode") }) return _obj diff --git a/conekta/models/company_response_documents_inner.py b/conekta/models/company_response_documents_inner.py deleted file mode 100644 index f58ce00..0000000 --- a/conekta/models/company_response_documents_inner.py +++ /dev/null @@ -1,107 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class CompanyResponseDocumentsInner(BaseModel): - """ - CompanyResponseDocumentsInner - """ # noqa: E501 - file_classification: Optional[StrictStr] = Field(default=None, description="Classification of the document. | Tipo de archivo | Descripción | | :--------------------------- | :-------------------------------------------------------- | | `id_legal_representative` | identificación oficial frente | | `id_legal_representative_back` | identificación oficial atrás | | `cfdi` | Prueba de situación fiscal | | `constitutive_act_basic` | Acta constitutiva | | `proof_of_address` | Comprobante de domicilio del negocio | | `power_of_attonery` | Poderes de representación | | `deposit_account_cover` | Carátula de la cuenta de depósito | | `permit_casino` | Permiso ante SEGOB | | `license_sanitation` | Licencia sanitaria de COFEPRIS | | `registration_tourism` | Inscripción ante el Registro Nacional de Turismo (SECTUR) | ") - status: Optional[StrictStr] = Field(default=None, description="The status of the document.") - file_name: Optional[StrictStr] = Field(default=None, description="The name of the file.") - __properties: ClassVar[List[str]] = ["file_classification", "status", "file_name"] - - @field_validator('file_classification') - def file_classification_validate_enum(cls, value): - """Validates the enum""" - if value is None: - return value - - if value not in set(['id_legal_representative', 'id_legal_representative_back', 'cfdi', 'constitutive_act_basic', 'proof_of_address', 'power_of_attonery', 'deposit_account_cover', 'permit_casino', 'license_sanitation', 'registration_tourism']): - raise ValueError("must be one of enum values ('id_legal_representative', 'id_legal_representative_back', 'cfdi', 'constitutive_act_basic', 'proof_of_address', 'power_of_attonery', 'deposit_account_cover', 'permit_casino', 'license_sanitation', 'registration_tourism')") - return value - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CompanyResponseDocumentsInner from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # set to None if file_name (nullable) is None - # and model_fields_set contains the field - if self.file_name is None and "file_name" in self.model_fields_set: - _dict['file_name'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CompanyResponseDocumentsInner from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "file_classification": obj.get("file_classification"), - "status": obj.get("status"), - "file_name": obj.get("file_name") - }) - return _obj - - diff --git a/conekta/models/create_company_request.py b/conekta/models/create_company_request.py index ed456a7..2c7dc12 100644 --- a/conekta/models/create_company_request.py +++ b/conekta/models/create_company_request.py @@ -25,20 +25,22 @@ from conekta.models.create_company_request_fiscal_info import CreateCompanyRequestFiscalInfo from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CreateCompanyRequest(BaseModel): """ CreateCompanyRequest """ # noqa: E501 - name: Optional[StrictStr] = Field(default=None, description="The name of the company.") - type_company: Optional[StrictStr] = Field(default=None, description="The type of company, 'owner'") + name: Optional[StrictStr] = Field(default=None, description="The name of the company.", json_schema_extra={"examples": ["test"]}) + type_company: Optional[StrictStr] = Field(default=None, description="The type of company, 'owner'", json_schema_extra={"examples": ["owner"]}) comercial_info: Optional[CreateCompanyRequestComercialInfo] = None fiscal_info: Optional[CreateCompanyRequestFiscalInfo] = None bank_account_info: Optional[CreateCompanyRequestBankAccountInfo] = None __properties: ClassVar[List[str]] = ["name", "type_company", "comercial_info", "fiscal_info", "bank_account_info"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/create_company_request_bank_account_info.py b/conekta/models/create_company_request_bank_account_info.py index 272a030..fd79774 100644 --- a/conekta/models/create_company_request_bank_account_info.py +++ b/conekta/models/create_company_request_bank_account_info.py @@ -22,16 +22,18 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CreateCompanyRequestBankAccountInfo(BaseModel): """ Bank account information for the company. """ # noqa: E501 - clabe: Optional[StrictStr] = Field(default=None, description="The 18-digit CLABE for the bank account.") + clabe: Optional[StrictStr] = Field(default=None, description="The 18-digit CLABE for the bank account.", json_schema_extra={"examples": ["002010077777777771"]}) __properties: ClassVar[List[str]] = ["clabe"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/create_company_request_comercial_info.py b/conekta/models/create_company_request_comercial_info.py index cb150d3..106943a 100644 --- a/conekta/models/create_company_request_comercial_info.py +++ b/conekta/models/create_company_request_comercial_info.py @@ -22,19 +22,21 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CreateCompanyRequestComercialInfo(BaseModel): """ Commercial information for the company. """ # noqa: E501 - website: Optional[StrictStr] = Field(default=None, description="The company's website URL.") - mcc: Optional[StrictStr] = Field(default=None, description="The Merchant Category Code (MCC) for the company.") - merchant_support_email: Optional[StrictStr] = Field(default=None, description="Email address for merchant support.") - merchant_support_phone: Optional[StrictStr] = Field(default=None, description="Phone number for merchant support.") + website: Optional[StrictStr] = Field(default=None, description="The company's website URL.", json_schema_extra={"examples": ["http://www.test.com"]}) + mcc: Optional[StrictStr] = Field(default=None, description="The Merchant Category Code (MCC) for the company.", json_schema_extra={"examples": ["5812"]}) + merchant_support_email: Optional[StrictStr] = Field(default=None, description="Email address for merchant support.", json_schema_extra={"examples": ["test@test.com"]}) + merchant_support_phone: Optional[StrictStr] = Field(default=None, description="Phone number for merchant support.", json_schema_extra={"examples": ["5300000000"]}) __properties: ClassVar[List[str]] = ["website", "mcc", "merchant_support_email", "merchant_support_phone"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/create_company_request_fiscal_info.py b/conekta/models/create_company_request_fiscal_info.py index 11423f8..a9a0481 100644 --- a/conekta/models/create_company_request_fiscal_info.py +++ b/conekta/models/create_company_request_fiscal_info.py @@ -22,17 +22,19 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CreateCompanyRequestFiscalInfo(BaseModel): """ Fiscal information for the company. """ # noqa: E501 - business_phone: Optional[StrictStr] = Field(default=None, description="The business phone number for fiscal purposes.") - fiscal_type: Optional[StrictStr] = Field(default=None, description="The fiscal type of the company (e.g., 'moral', 'persona_fisica').") + business_phone: Optional[StrictStr] = Field(default=None, description="The business phone number for fiscal purposes.", json_schema_extra={"examples": ["5300000000"]}) + fiscal_type: Optional[StrictStr] = Field(default=None, description="The fiscal type of the company (e.g., 'moral', 'persona_fisica').", json_schema_extra={"examples": ["moral"]}) __properties: ClassVar[List[str]] = ["business_phone", "fiscal_type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/create_customer_fiscal_entities_response.py b/conekta/models/create_customer_fiscal_entities_response.py index d4d518c..3229d86 100644 --- a/conekta/models/create_customer_fiscal_entities_response.py +++ b/conekta/models/create_customer_fiscal_entities_response.py @@ -18,31 +18,33 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_address import CustomerAddress +from conekta.models.fiscal_entity_request_address import FiscalEntityRequestAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CreateCustomerFiscalEntitiesResponse(BaseModel): """ CreateCustomerFiscalEntitiesResponse """ # noqa: E501 - address: CustomerAddress + address: FiscalEntityRequestAddress tax_id: Optional[StrictStr] = None email: Optional[StrictStr] = None phone: Optional[StrictStr] = None - metadata: Optional[Dict[str, Dict[str, Any]]] = None - company_name: Optional[StrictStr] = None - id: StrictStr - object: StrictStr - created_at: StrictInt - parent_id: Optional[StrictStr] = None + metadata: Optional[Any] = None + company_name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["conekta"]}) + id: StrictStr = Field(json_schema_extra={"examples": ["ship_cont_2tKZsTYcsryyu7Ah8"]}) + object: StrictStr = Field(json_schema_extra={"examples": ["shipping_contact"]}) + created_at: StrictInt = Field(json_schema_extra={"examples": [1675715413]}) + parent_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2tKcHxhTz7xU5SymF"]}) default: Optional[StrictBool] = None __properties: ClassVar[List[str]] = ["address", "tax_id", "email", "phone", "metadata", "company_name", "id", "object", "created_at", "parent_id", "default"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -83,6 +84,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + return _dict @classmethod @@ -95,11 +101,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "address": CustomerAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": FiscalEntityRequestAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "tax_id": obj.get("tax_id"), "email": obj.get("email"), "phone": obj.get("phone"), - "metadata": obj.get("metadata"), "company_name": obj.get("company_name"), "id": obj.get("id"), "object": obj.get("object"), diff --git a/conekta/models/create_customer_payment_methods_response.py b/conekta/models/create_customer_payment_methods_response.py index 8922f5c..385592f 100644 --- a/conekta/models/create_customer_payment_methods_response.py +++ b/conekta/models/create_customer_payment_methods_response.py @@ -21,12 +21,12 @@ from conekta.models.payment_method_card_response import PaymentMethodCardResponse from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_response import PaymentMethodCashResponse -from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent +from conekta.models.payment_method_spei_recurrent_response import PaymentMethodSpeiRecurrentResponse from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -CREATECUSTOMERPAYMENTMETHODSRESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] +CREATECUSTOMERPAYMENTMETHODSRESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrentResponse"] class CreateCustomerPaymentMethodsResponse(BaseModel): """ @@ -38,10 +38,10 @@ class CreateCustomerPaymentMethodsResponse(BaseModel): oneof_schema_2_validator: Optional[PaymentMethodCashRecurrentResponse] = None # data type: PaymentMethodCardResponse oneof_schema_3_validator: Optional[PaymentMethodCardResponse] = None - # data type: PaymentMethodSpeiRecurrent - oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrent] = None - actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None - one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } + # data type: PaymentMethodSpeiRecurrentResponse + oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrentResponse] = None + actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse]] = None + one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrentResponse" } model_config = ConfigDict( validate_assignment=True, @@ -82,17 +82,17 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCardResponse`") else: match += 1 - # validate data type: PaymentMethodSpeiRecurrent - if not isinstance(v, PaymentMethodSpeiRecurrent): - error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodSpeiRecurrent`") + # validate data type: PaymentMethodSpeiRecurrentResponse + if not isinstance(v, PaymentMethodSpeiRecurrentResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodSpeiRecurrentResponse`") else: match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) else: return v @@ -108,9 +108,10 @@ def from_json(cls, json_str: str) -> Self: match = 0 # use oneOf discriminator to lookup the data type - _data_type = json.loads(json_str).get("type") + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) if not _data_type: - raise ValueError("Failed to lookup data type from the field `type` in the input.") + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") # check if data type is `PaymentMethodCardResponse` if _data_type == "card": @@ -127,29 +128,9 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) return instance - # check if data type is `PaymentMethodSpeiRecurrent` + # check if data type is `PaymentMethodSpeiRecurrentResponse` if _data_type == "spei_recurrent": - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCardResponse` - if _data_type == "payment_method_card_response": - instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashRecurrentResponse` - if _data_type == "payment_method_cash_recurrent_response": - instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashResponse` - if _data_type == "payment_method_cash_response": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodSpeiRecurrent` - if _data_type == "payment_method_spei_recurrent": - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) + instance.actual_instance = PaymentMethodSpeiRecurrentResponse.from_json(json_str) return instance # deserialize data into PaymentMethodCashResponse @@ -170,19 +151,19 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into PaymentMethodSpeiRecurrent + # deserialize data into PaymentMethodSpeiRecurrentResponse try: - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) + instance.actual_instance = PaymentMethodSpeiRecurrentResponse.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into CreateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) else: return instance @@ -196,7 +177,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/create_risk_rules_data.py b/conekta/models/create_rule_whitelist_request.py similarity index 76% rename from conekta/models/create_risk_rules_data.py rename to conekta/models/create_rule_whitelist_request.py index 29e0018..d32f69f 100644 --- a/conekta/models/create_risk_rules_data.py +++ b/conekta/models/create_rule_whitelist_request.py @@ -22,18 +22,20 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CreateRiskRulesData(BaseModel): +class CreateRuleWhitelistRequest(BaseModel): """ - CreateRiskRulesData + CreateRuleWhitelistRequest """ # noqa: E501 - description: StrictStr = Field(description="Description of the rule") - var_field: StrictStr = Field(description="Field to be used for the rule", alias="field") - value: StrictStr = Field(description="Value to be used for the rule") + description: StrictStr = Field(description="Description of the rule", json_schema_extra={"examples": ["this client email was verified at 20/09/22 by internal process"]}) + var_field: StrictStr = Field(description="Field to be used for the rule", alias="field", json_schema_extra={"examples": ["email | phone | card_token"]}) + value: StrictStr = Field(description="Value to be used for the rule", json_schema_extra={"examples": ["email@example.com | 818081808180 | src_2qUCNd5AyQqfPMBuV"]}) __properties: ClassVar[List[str]] = ["description", "field", "value"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,12 +47,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CreateRiskRulesData from a JSON string""" + """Create an instance of CreateRuleWhitelistRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -75,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CreateRiskRulesData from a dict""" + """Create an instance of CreateRuleWhitelistRequest from a dict""" if obj is None: return None diff --git a/conekta/models/customer.py b/conekta/models/customer.py index f82eaac..0639b6c 100644 --- a/conekta/models/customer.py +++ b/conekta/models/customer.py @@ -21,37 +21,39 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional from conekta.models.customer_antifraud_info import CustomerAntifraudInfo -from conekta.models.customer_fiscal_entities_request import CustomerFiscalEntitiesRequest from conekta.models.customer_payment_methods_request import CustomerPaymentMethodsRequest -from conekta.models.customer_shipping_contacts import CustomerShippingContacts +from conekta.models.customer_shipping_contacts_request import CustomerShippingContactsRequest +from conekta.models.fiscal_entity_request import FiscalEntityRequest from conekta.models.subscription_request import SubscriptionRequest from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Customer(BaseModel): """ a customer """ # noqa: E501 antifraud_info: Optional[CustomerAntifraudInfo] = None - corporate: Optional[StrictBool] = Field(default=False, description="It is a value that allows identifying if the email is corporate or not.") + corporate: Optional[StrictBool] = Field(default=False, description="It is a value that allows identifying if the email is corporate or not.", json_schema_extra={"examples": [False]}) custom_reference: Optional[StrictStr] = Field(default=None, description="It is an undefined value.") - date_of_birth: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the date of birth of the client.") - email: StrictStr = Field(description="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: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id)") - default_shipping_contact_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact)") - fiscal_entities: Optional[List[CustomerFiscalEntitiesRequest]] = None + date_of_birth: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the date of birth of the client.", json_schema_extra={"examples": ["24/07/1992"]}) + email: StrictStr = Field(description="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).", json_schema_extra={"examples": ["miguel@gmail.com"]}) + default_payment_source_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id)", json_schema_extra={"examples": ["src_1a2b3c4d5e6f7g8h"]}) + default_shipping_contact_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact)", json_schema_extra={"examples": ["ship_cont_1a2b3c4d5e6f7g8h"]}) + fiscal_entities: Optional[List[FiscalEntityRequest]] = None metadata: Optional[Dict[str, Any]] = None - name: StrictStr = Field(description="Client's name") - national_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the national identification number of the client.") + name: StrictStr = Field(description="Client's name", json_schema_extra={"examples": ["miguel"]}) + national_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the national identification number of the client.", json_schema_extra={"examples": ["HEGG560427MVZRRL04"]}) payment_sources: Optional[List[CustomerPaymentMethodsRequest]] = Field(default=None, description="Contains details of the payment methods that the customer has active or has used in Conekta") - phone: StrictStr = Field(description="Is the customer's phone number") - plan_id: Optional[StrictStr] = Field(default=None, description="Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription") - shipping_contacts: Optional[List[CustomerShippingContacts]] = Field(default=None, description="Contains the detail of the shipping addresses that the client has active or has used in Conekta") + phone: StrictStr = Field(description="Is the customer's phone number", json_schema_extra={"examples": ["+5215555555555"]}) + plan_id: Optional[StrictStr] = Field(default=None, description="Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription", json_schema_extra={"examples": ["plan_987234823"]}) + shipping_contacts: Optional[List[CustomerShippingContactsRequest]] = Field(default=None, description="Contains the detail of the shipping addresses that the client has active or has used in Conekta") subscription: Optional[SubscriptionRequest] = None __properties: ClassVar[List[str]] = ["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"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +65,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -116,11 +117,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of subscription if self.subscription: _dict['subscription'] = self.subscription.to_dict() - # set to None if antifraud_info (nullable) is None - # and model_fields_set contains the field - if self.antifraud_info is None and "antifraud_info" in self.model_fields_set: - _dict['antifraud_info'] = None - return _dict @classmethod @@ -140,14 +136,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "email": obj.get("email"), "default_payment_source_id": obj.get("default_payment_source_id"), "default_shipping_contact_id": obj.get("default_shipping_contact_id"), - "fiscal_entities": [CustomerFiscalEntitiesRequest.from_dict(_item) for _item in obj["fiscal_entities"]] if obj.get("fiscal_entities") is not None else None, + "fiscal_entities": [FiscalEntityRequest.from_dict(_item) for _item in obj["fiscal_entities"]] if obj.get("fiscal_entities") is not None else None, "metadata": obj.get("metadata"), "name": obj.get("name"), "national_id": obj.get("national_id"), "payment_sources": [CustomerPaymentMethodsRequest.from_dict(_item) for _item in obj["payment_sources"]] if obj.get("payment_sources") is not None else None, "phone": obj.get("phone"), "plan_id": obj.get("plan_id"), - "shipping_contacts": [CustomerShippingContacts.from_dict(_item) for _item in obj["shipping_contacts"]] if obj.get("shipping_contacts") is not None else None, + "shipping_contacts": [CustomerShippingContactsRequest.from_dict(_item) for _item in obj["shipping_contacts"]] if obj.get("shipping_contacts") is not None else None, "subscription": SubscriptionRequest.from_dict(obj["subscription"]) if obj.get("subscription") is not None else None }) return _obj diff --git a/conekta/models/customer_antifraud_info.py b/conekta/models/customer_antifraud_info.py index fe8b611..d41a1b1 100644 --- a/conekta/models/customer_antifraud_info.py +++ b/conekta/models/customer_antifraud_info.py @@ -18,21 +18,23 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictInt from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerAntifraudInfo(BaseModel): """ CustomerAntifraudInfo """ # noqa: E501 - account_created_at: Optional[StrictInt] = None - first_paid_at: Optional[StrictInt] = None + account_created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1484040996]}) + first_paid_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1485151007]}) __properties: ClassVar[List[str]] = ["account_created_at", "first_paid_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/customer_antifraud_info_response.py b/conekta/models/customer_antifraud_info_response.py index e9b63a2..fe9c9ba 100644 --- a/conekta/models/customer_antifraud_info_response.py +++ b/conekta/models/customer_antifraud_info_response.py @@ -18,21 +18,23 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictInt from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerAntifraudInfoResponse(BaseModel): """ CustomerAntifraudInfoResponse """ # noqa: E501 - first_paid_at: Optional[StrictInt] = None - account_created_at: Optional[StrictInt] = None + first_paid_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1485151007]}) + account_created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1484040996]}) __properties: ClassVar[List[str]] = ["first_paid_at", "account_created_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_response.py b/conekta/models/customer_details.py similarity index 66% rename from conekta/models/payment_method_response.py rename to conekta/models/customer_details.py index 7bac8fe..3a385f9 100644 --- a/conekta/models/payment_method_response.py +++ b/conekta/models/customer_details.py @@ -18,24 +18,25 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class PaymentMethodResponse(BaseModel): +class CustomerDetails(BaseModel): """ - PaymentMethodResponse + Customer details for customer portal """ # noqa: E501 - type: StrictStr - id: StrictStr - object: StrictStr - created_at: StrictInt - parent_id: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["type", "id", "object", "created_at", "parent_id"] + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2yDzKtEAD3khH8Sga"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["customer"]}) + name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["mao"]}) + email: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["maoarroya@gmail.com"]}) + __properties: ClassVar[List[str]] = ["id", "object", "name", "email"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,12 +48,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of PaymentMethodResponse from a JSON string""" + """Create an instance of CustomerDetails from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -77,7 +77,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of PaymentMethodResponse from a dict""" + """Create an instance of CustomerDetails from a dict""" if obj is None: return None @@ -85,11 +85,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "type": obj.get("type"), "id": obj.get("id"), "object": obj.get("object"), - "created_at": obj.get("created_at"), - "parent_id": obj.get("parent_id") + "name": obj.get("name"), + "email": obj.get("email") }) return _obj diff --git a/conekta/models/customer_fiscal_entities_data_response.py b/conekta/models/customer_fiscal_entities_data_response.py index 830e240..3874530 100644 --- a/conekta/models/customer_fiscal_entities_data_response.py +++ b/conekta/models/customer_fiscal_entities_data_response.py @@ -18,31 +18,33 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_address import CustomerAddress +from conekta.models.fiscal_entity_request_address import FiscalEntityRequestAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerFiscalEntitiesDataResponse(BaseModel): """ CustomerFiscalEntitiesDataResponse """ # noqa: E501 - address: CustomerAddress + address: FiscalEntityRequestAddress tax_id: Optional[StrictStr] = None email: Optional[StrictStr] = None phone: Optional[StrictStr] = None - metadata: Optional[Dict[str, Dict[str, Any]]] = None - company_name: Optional[StrictStr] = None - id: StrictStr - object: StrictStr - created_at: StrictInt - parent_id: Optional[StrictStr] = None + metadata: Optional[Any] = None + company_name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["conekta"]}) + id: StrictStr = Field(json_schema_extra={"examples": ["ship_cont_2tKZsTYcsryyu7Ah8"]}) + object: StrictStr = Field(json_schema_extra={"examples": ["shipping_contact"]}) + created_at: StrictInt = Field(json_schema_extra={"examples": [1675715413]}) + parent_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2tKcHxhTz7xU5SymF"]}) default: Optional[StrictBool] = None __properties: ClassVar[List[str]] = ["address", "tax_id", "email", "phone", "metadata", "company_name", "id", "object", "created_at", "parent_id", "default"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -83,6 +84,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + return _dict @classmethod @@ -95,11 +101,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "address": CustomerAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": FiscalEntityRequestAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "tax_id": obj.get("tax_id"), "email": obj.get("email"), "phone": obj.get("phone"), - "metadata": obj.get("metadata"), "company_name": obj.get("company_name"), "id": obj.get("id"), "object": obj.get("object"), diff --git a/conekta/models/customer_fiscal_entities_response.py b/conekta/models/customer_fiscal_entities_response.py index 2f567ae..630450a 100644 --- a/conekta/models/customer_fiscal_entities_response.py +++ b/conekta/models/customer_fiscal_entities_response.py @@ -23,18 +23,20 @@ from conekta.models.customer_fiscal_entities_data_response import CustomerFiscalEntitiesDataResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerFiscalEntitiesResponse(BaseModel): """ CustomerFiscalEntitiesResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) data: Optional[List[CustomerFiscalEntitiesDataResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/customer_info.py b/conekta/models/customer_info.py index 893be9e..0425d9a 100644 --- a/conekta/models/customer_info.py +++ b/conekta/models/customer_info.py @@ -18,24 +18,26 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerInfo(BaseModel): """ CustomerInfo """ # noqa: E501 - name: StrictStr - email: StrictStr - phone: StrictStr + name: StrictStr = Field(json_schema_extra={"examples": ["DevTest"]}) + email: StrictStr = Field(json_schema_extra={"examples": ["test@conekta.com"]}) + phone: StrictStr = Field(json_schema_extra={"examples": ["5522997233"]}) corporate: Optional[StrictBool] = None - object: Optional[StrictStr] = None + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["customer_info"]}) __properties: ClassVar[List[str]] = ["name", "email", "phone", "corporate", "object"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/customer_info_just_customer_id.py b/conekta/models/customer_info_customer_id.py similarity index 78% rename from conekta/models/customer_info_just_customer_id.py rename to conekta/models/customer_info_customer_id.py index 71fe272..d3443e2 100644 --- a/conekta/models/customer_info_just_customer_id.py +++ b/conekta/models/customer_info_customer_id.py @@ -18,20 +18,22 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CustomerInfoJustCustomerId(BaseModel): +class CustomerInfoCustomerId(BaseModel): """ - CustomerInfoJustCustomerId + CustomerInfoCustomerId """ # noqa: E501 - customer_id: StrictStr + customer_id: StrictStr = Field(json_schema_extra={"examples": ["cus_23874283647"]}) __properties: ClassVar[List[str]] = ["customer_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,12 +45,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomerInfoJustCustomerId from a JSON string""" + """Create an instance of CustomerInfoCustomerId from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,7 +74,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomerInfoJustCustomerId from a dict""" + """Create an instance of CustomerInfoCustomerId from a dict""" if obj is None: return None diff --git a/conekta/models/customer_payment_method_request.py b/conekta/models/customer_payment_method_request.py deleted file mode 100644 index d4a7fcc..0000000 --- a/conekta/models/customer_payment_method_request.py +++ /dev/null @@ -1,88 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing import Any, ClassVar, Dict, List -from typing import Optional, Set -from typing_extensions import Self - -class CustomerPaymentMethodRequest(BaseModel): - """ - Contains details of the payment methods that the customer has active or has used in Conekta - """ # noqa: E501 - type: StrictStr = Field(description="Type of payment method") - __properties: ClassVar[List[str]] = ["type"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomerPaymentMethodRequest from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomerPaymentMethodRequest from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "type": obj.get("type") - }) - return _obj - - diff --git a/conekta/models/customer_payment_methods_data.py b/conekta/models/customer_payment_methods_data.py index 2a78e90..bd5db9a 100644 --- a/conekta/models/customer_payment_methods_data.py +++ b/conekta/models/customer_payment_methods_data.py @@ -21,12 +21,12 @@ from conekta.models.payment_method_card_response import PaymentMethodCardResponse from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_response import PaymentMethodCashResponse -from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent +from conekta.models.payment_method_spei_recurrent_response import PaymentMethodSpeiRecurrentResponse from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -CUSTOMERPAYMENTMETHODSDATA_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] +CUSTOMERPAYMENTMETHODSDATA_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrentResponse"] class CustomerPaymentMethodsData(BaseModel): """ @@ -38,10 +38,10 @@ class CustomerPaymentMethodsData(BaseModel): oneof_schema_2_validator: Optional[PaymentMethodCashRecurrentResponse] = None # data type: PaymentMethodCardResponse oneof_schema_3_validator: Optional[PaymentMethodCardResponse] = None - # data type: PaymentMethodSpeiRecurrent - oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrent] = None - actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None - one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } + # data type: PaymentMethodSpeiRecurrentResponse + oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrentResponse] = None + actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse]] = None + one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrentResponse" } model_config = ConfigDict( validate_assignment=True, @@ -82,17 +82,17 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCardResponse`") else: match += 1 - # validate data type: PaymentMethodSpeiRecurrent - if not isinstance(v, PaymentMethodSpeiRecurrent): - error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodSpeiRecurrent`") + # validate data type: PaymentMethodSpeiRecurrentResponse + if not isinstance(v, PaymentMethodSpeiRecurrentResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodSpeiRecurrentResponse`") else: match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) else: return v @@ -108,9 +108,10 @@ def from_json(cls, json_str: str) -> Self: match = 0 # use oneOf discriminator to lookup the data type - _data_type = json.loads(json_str).get("type") + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) if not _data_type: - raise ValueError("Failed to lookup data type from the field `type` in the input.") + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") # check if data type is `PaymentMethodCardResponse` if _data_type == "card": @@ -127,29 +128,9 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) return instance - # check if data type is `PaymentMethodSpeiRecurrent` + # check if data type is `PaymentMethodSpeiRecurrentResponse` if _data_type == "spei_recurrent": - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCardResponse` - if _data_type == "payment_method_card_response": - instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashRecurrentResponse` - if _data_type == "payment_method_cash_recurrent_response": - instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashResponse` - if _data_type == "payment_method_cash_response": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodSpeiRecurrent` - if _data_type == "payment_method_spei_recurrent": - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) + instance.actual_instance = PaymentMethodSpeiRecurrentResponse.from_json(json_str) return instance # deserialize data into PaymentMethodCashResponse @@ -170,19 +151,19 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into PaymentMethodSpeiRecurrent + # deserialize data into PaymentMethodSpeiRecurrentResponse try: - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) + instance.actual_instance = PaymentMethodSpeiRecurrentResponse.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into CustomerPaymentMethodsData with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) else: return instance @@ -196,7 +177,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/customer_payment_methods_response.py b/conekta/models/customer_payment_methods_response.py index 0a9195d..4881508 100644 --- a/conekta/models/customer_payment_methods_response.py +++ b/conekta/models/customer_payment_methods_response.py @@ -23,20 +23,22 @@ from conekta.models.customer_payment_methods_data import CustomerPaymentMethodsData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerPaymentMethodsResponse(BaseModel): """ CustomerPaymentMethodsResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[CustomerPaymentMethodsData]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/customer_portal_response.py b/conekta/models/customer_portal_response.py new file mode 100644 index 0000000..33fc6aa --- /dev/null +++ b/conekta/models/customer_portal_response.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from conekta.models.customer_details import CustomerDetails +from conekta.models.subscription_details import SubscriptionDetails +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CustomerPortalResponse(BaseModel): + """ + Customer portal model + """ # noqa: E501 + slug: Optional[StrictStr] = Field(default=None, description="Unique slug identifier for the portal", json_schema_extra={"examples": ["agIvD4QSBl4Nunq4TmuozMw2ThtyVC"]}) + subscription_id: Optional[StrictStr] = Field(default=None, description="Associated subscription ID", json_schema_extra={"examples": ["sub_2yYsQuYtXAbP1fdYu"]}) + customer_id: Optional[StrictStr] = Field(default=None, description="Associated customer ID", json_schema_extra={"examples": ["cus_2yDzKtEAD3khH8Sga"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Whether this is a live or test mode portal", json_schema_extra={"examples": [False]}) + subscription: Optional[SubscriptionDetails] = None + customer: Optional[CustomerDetails] = None + id: Optional[StrictStr] = Field(default=None, description="Customer portal ID", json_schema_extra={"examples": ["scp_2ym7QbU9dTh7Froti"]}) + company_id: Optional[StrictStr] = Field(default=None, description="Associated company ID", json_schema_extra={"examples": ["63dad459920de10001d177b3"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["customer_portal"]}) + created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp of creation", json_schema_extra={"examples": [1759108828]}) + updated_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp of last update", json_schema_extra={"examples": [1759108828]}) + portal_url: Optional[StrictStr] = Field(default=None, description="URL to access the customer portal", json_schema_extra={"examples": ["https://pay.stg.conekta.io/subscription/management/agIvD4QSBl4Nunq4TmuozMw2ThtyVC"]}) + __properties: ClassVar[List[str]] = ["slug", "subscription_id", "customer_id", "livemode", "subscription", "customer", "id", "company_id", "object", "created_at", "updated_at", "portal_url"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerPortalResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of subscription + if self.subscription: + _dict['subscription'] = self.subscription.to_dict() + # override the default output from pydantic by calling `to_dict()` of customer + if self.customer: + _dict['customer'] = self.customer.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerPortalResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "slug": obj.get("slug"), + "subscription_id": obj.get("subscription_id"), + "customer_id": obj.get("customer_id"), + "livemode": obj.get("livemode"), + "subscription": SubscriptionDetails.from_dict(obj["subscription"]) if obj.get("subscription") is not None else None, + "customer": CustomerDetails.from_dict(obj["customer"]) if obj.get("customer") is not None else None, + "id": obj.get("id"), + "company_id": obj.get("company_id"), + "object": obj.get("object"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at"), + "portal_url": obj.get("portal_url") + }) + return _obj + + diff --git a/conekta/models/customer_response.py b/conekta/models/customer_response.py index 16f6c20..4366d68 100644 --- a/conekta/models/customer_response.py +++ b/conekta/models/customer_response.py @@ -24,9 +24,10 @@ from conekta.models.customer_fiscal_entities_response import CustomerFiscalEntitiesResponse from conekta.models.customer_payment_methods_response import CustomerPaymentMethodsResponse from conekta.models.customer_response_shipping_contacts import CustomerResponseShippingContacts -from conekta.models.subscription_response import SubscriptionResponse +from conekta.models.customer_subscription_response import CustomerSubscriptionResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerResponse(BaseModel): """ @@ -34,28 +35,29 @@ class CustomerResponse(BaseModel): """ # noqa: E501 antifraud_info: Optional[CustomerAntifraudInfoResponse] = None corporate: Optional[StrictBool] = Field(default=None, description="true if the customer is a company") - created_at: StrictInt = Field(description="Creation date of the object") - custom_reference: Optional[StrictStr] = Field(default=None, description="Custom reference") - date_of_birth: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the date of birth of the client.") - default_fiscal_entity_id: Optional[StrictStr] = None - default_shipping_contact_id: Optional[StrictStr] = None - default_payment_source_id: Optional[StrictStr] = None - email: Optional[StrictStr] = None + created_at: StrictInt = Field(description="Creation date of the object", json_schema_extra={"examples": [1485151007]}) + custom_reference: Optional[StrictStr] = Field(default=None, description="Custom reference", json_schema_extra={"examples": ["custom_reference"]}) + date_of_birth: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the date of birth of the client.", json_schema_extra={"examples": ["24/07/1992"]}) + default_fiscal_entity_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["fis_ent_2tKqqAfqPi21oCmEJ"]}) + default_shipping_contact_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["ship_cont_2tKZsTYcsryyu7Ah8"]}) + default_payment_source_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["src_2tHJfJ79KyUwpxTio"]}) + email: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Felipe@gmail.com"]}) fiscal_entities: Optional[CustomerFiscalEntitiesResponse] = None - id: StrictStr = Field(description="Customer's ID") - livemode: StrictBool = Field(description="true if the object exists in live mode or the value false if the object exists in test mode") - name: StrictStr = Field(description="Customer's name") - national_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the national identification number of the client.") + id: StrictStr = Field(description="Customer's ID", json_schema_extra={"examples": ["cus_2tHJfJ79KyUwpxTik"]}) + livemode: StrictBool = Field(description="true if the object exists in live mode or the value false if the object exists in test mode", json_schema_extra={"examples": [True]}) + name: StrictStr = Field(description="Customer's name", json_schema_extra={"examples": ["Felipe"]}) + national_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the national identification number of the client.", json_schema_extra={"examples": ["HEGG560427MVZRRL04"]}) metadata: Optional[Dict[str, Any]] = None - object: StrictStr + object: StrictStr = Field(json_schema_extra={"examples": ["customer"]}) payment_sources: Optional[CustomerPaymentMethodsResponse] = None - phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number") + phone: Optional[StrictStr] = Field(default=None, description="Customer's phone number", json_schema_extra={"examples": ["+5215555555555"]}) shipping_contacts: Optional[CustomerResponseShippingContacts] = None - subscription: Optional[SubscriptionResponse] = None + subscription: Optional[CustomerSubscriptionResponse] = None __properties: ClassVar[List[str]] = ["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"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -67,8 +69,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -108,21 +109,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of subscription if self.subscription: _dict['subscription'] = self.subscription.to_dict() - # set to None if antifraud_info (nullable) is None - # and model_fields_set contains the field - if self.antifraud_info is None and "antifraud_info" in self.model_fields_set: - _dict['antifraud_info'] = None - - # set to None if default_fiscal_entity_id (nullable) is None - # and model_fields_set contains the field - if self.default_fiscal_entity_id is None and "default_fiscal_entity_id" in self.model_fields_set: - _dict['default_fiscal_entity_id'] = None - - # set to None if default_payment_source_id (nullable) is None - # and model_fields_set contains the field - if self.default_payment_source_id is None and "default_payment_source_id" in self.model_fields_set: - _dict['default_payment_source_id'] = None - return _dict @classmethod @@ -154,7 +140,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "payment_sources": CustomerPaymentMethodsResponse.from_dict(obj["payment_sources"]) if obj.get("payment_sources") is not None else None, "phone": obj.get("phone"), "shipping_contacts": CustomerResponseShippingContacts.from_dict(obj["shipping_contacts"]) if obj.get("shipping_contacts") is not None else None, - "subscription": SubscriptionResponse.from_dict(obj["subscription"]) if obj.get("subscription") is not None else None + "subscription": CustomerSubscriptionResponse.from_dict(obj["subscription"]) if obj.get("subscription") is not None else None }) return _obj diff --git a/conekta/models/customer_response_shipping_contacts.py b/conekta/models/customer_response_shipping_contacts.py index 9434587..0e8ce3f 100644 --- a/conekta/models/customer_response_shipping_contacts.py +++ b/conekta/models/customer_response_shipping_contacts.py @@ -23,18 +23,20 @@ from conekta.models.customer_shipping_contacts_data_response import CustomerShippingContactsDataResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerResponseShippingContacts(BaseModel): """ CustomerResponseShippingContacts """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) data: Optional[List[CustomerShippingContactsDataResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/customer_shipping_contacts_address.py b/conekta/models/customer_shipping_contacts_address.py index c02af66..5e0a4be 100644 --- a/conekta/models/customer_shipping_contacts_address.py +++ b/conekta/models/customer_shipping_contacts_address.py @@ -22,22 +22,25 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerShippingContactsAddress(BaseModel): """ - Address of the person who will receive the order + CustomerShippingContactsAddress """ # noqa: E501 - street1: Optional[StrictStr] = None - street2: Optional[StrictStr] = None - postal_code: Optional[StrictStr] = None - city: Optional[StrictStr] = None - state: Optional[StrictStr] = None - country: Optional[StrictStr] = Field(default=None, description="this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)") - residential: Optional[StrictBool] = None - __properties: ClassVar[List[str]] = ["street1", "street2", "postal_code", "city", "state", "country", "residential"] + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["shipping_address"]}) + street1: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Nuevo Leon 254"]}) + street2: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Departamento 404"]}) + postal_code: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["06100"]}) + city: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Ciudad de Mexico"]}) + state: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Ciudad de Mexico"]}) + country: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["MX"]}) + residential: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["object", "street1", "street2", "postal_code", "city", "state", "country", "residential"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -75,11 +77,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if residential (nullable) is None - # and model_fields_set contains the field - if self.residential is None and "residential" in self.model_fields_set: - _dict['residential'] = None - return _dict @classmethod @@ -92,6 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "object": obj.get("object"), "street1": obj.get("street1"), "street2": obj.get("street2"), "postal_code": obj.get("postal_code"), diff --git a/conekta/models/customer_shipping_contacts_data_response.py b/conekta/models/customer_shipping_contacts_data_response.py index 69e625d..8f6b0d5 100644 --- a/conekta/models/customer_shipping_contacts_data_response.py +++ b/conekta/models/customer_shipping_contacts_data_response.py @@ -20,29 +20,31 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_shipping_contacts_address import CustomerShippingContactsAddress +from conekta.models.customer_shipping_contacts_request_address import CustomerShippingContactsRequestAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerShippingContactsDataResponse(BaseModel): """ CustomerShippingContactsDataResponse """ # noqa: E501 - phone: Optional[StrictStr] = Field(default=None, description="Phone contact") - receiver: Optional[StrictStr] = Field(default=None, description="Name of the person who will receive the order") - between_streets: Optional[StrictStr] = Field(default=None, description="The street names between which the order will be delivered.") - address: CustomerShippingContactsAddress + phone: Optional[StrictStr] = Field(default=None, description="Phone contact", json_schema_extra={"examples": ["+525511223344"]}) + receiver: Optional[StrictStr] = Field(default=None, description="Name of the person who will receive the order", json_schema_extra={"examples": ["Marvin Fuller"]}) + between_streets: Optional[StrictStr] = Field(default=None, description="The street names between which the order will be delivered.", json_schema_extra={"examples": ["Ackerman Crescent"]}) + address: CustomerShippingContactsRequestAddress parent_id: Optional[StrictStr] = None default: Optional[StrictBool] = None deleted: Optional[StrictBool] = None metadata: Optional[Dict[str, Any]] = Field(default=None, description="Metadata associated with the shipping contact") - id: StrictStr - object: StrictStr - created_at: StrictInt + id: StrictStr = Field(json_schema_extra={"examples": ["ship_cont_2tKZsTYcsryyu7Ah8"]}) + object: StrictStr = Field(json_schema_extra={"examples": ["shipping_contact"]}) + created_at: StrictInt = Field(json_schema_extra={"examples": [1675715413]}) __properties: ClassVar[List[str]] = ["phone", "receiver", "between_streets", "address", "parent_id", "default", "deleted", "metadata", "id", "object", "created_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -83,16 +84,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() - # set to None if default (nullable) is None - # and model_fields_set contains the field - if self.default is None and "default" in self.model_fields_set: - _dict['default'] = None - - # set to None if deleted (nullable) is None - # and model_fields_set contains the field - if self.deleted is None and "deleted" in self.model_fields_set: - _dict['deleted'] = None - return _dict @classmethod @@ -108,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "phone": obj.get("phone"), "receiver": obj.get("receiver"), "between_streets": obj.get("between_streets"), - "address": CustomerShippingContactsAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": CustomerShippingContactsRequestAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "parent_id": obj.get("parent_id"), "default": obj.get("default"), "deleted": obj.get("deleted"), diff --git a/conekta/models/customer_shipping_contacts.py b/conekta/models/customer_shipping_contacts_request.py similarity index 74% rename from conekta/models/customer_shipping_contacts.py rename to conekta/models/customer_shipping_contacts_request.py index 59b628b..a363166 100644 --- a/conekta/models/customer_shipping_contacts.py +++ b/conekta/models/customer_shipping_contacts_request.py @@ -20,18 +20,19 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_shipping_contacts_address import CustomerShippingContactsAddress +from conekta.models.customer_shipping_contacts_request_address import CustomerShippingContactsRequestAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CustomerShippingContacts(BaseModel): +class CustomerShippingContactsRequest(BaseModel): """ [Shipping](https://developers.conekta.com/v2.2.0/reference/createcustomershippingcontacts) details, required in case of sending a shipping. If we do not receive a shipping_contact on the order, the default shipping_contact of the customer will be used. """ # noqa: E501 - phone: Optional[StrictStr] = Field(default=None, description="Phone contact") - receiver: Optional[StrictStr] = Field(default=None, description="Name of the person who will receive the order") - between_streets: Optional[StrictStr] = Field(default=None, description="The street names between which the order will be delivered.") - address: CustomerShippingContactsAddress + phone: Optional[StrictStr] = Field(default=None, description="Phone contact", json_schema_extra={"examples": ["+525511223344"]}) + receiver: Optional[StrictStr] = Field(default=None, description="Name of the person who will receive the order", json_schema_extra={"examples": ["Marvin Fuller"]}) + between_streets: Optional[StrictStr] = Field(default=None, description="The street names between which the order will be delivered.", json_schema_extra={"examples": ["Ackerman Crescent"]}) + address: CustomerShippingContactsRequestAddress parent_id: Optional[StrictStr] = None default: Optional[StrictBool] = None deleted: Optional[StrictBool] = None @@ -39,7 +40,8 @@ class CustomerShippingContacts(BaseModel): __properties: ClassVar[List[str]] = ["phone", "receiver", "between_streets", "address", "parent_id", "default", "deleted", "metadata"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,12 +53,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomerShippingContacts from a JSON string""" + """Create an instance of CustomerShippingContactsRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -80,21 +81,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() - # set to None if default (nullable) is None - # and model_fields_set contains the field - if self.default is None and "default" in self.model_fields_set: - _dict['default'] = None - - # set to None if deleted (nullable) is None - # and model_fields_set contains the field - if self.deleted is None and "deleted" in self.model_fields_set: - _dict['deleted'] = None - return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomerShippingContacts from a dict""" + """Create an instance of CustomerShippingContactsRequest from a dict""" if obj is None: return None @@ -105,7 +96,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "phone": obj.get("phone"), "receiver": obj.get("receiver"), "between_streets": obj.get("between_streets"), - "address": CustomerShippingContactsAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": CustomerShippingContactsRequestAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "parent_id": obj.get("parent_id"), "default": obj.get("default"), "deleted": obj.get("deleted"), diff --git a/conekta/models/customer_shipping_contacts_response_address.py b/conekta/models/customer_shipping_contacts_request_address.py similarity index 59% rename from conekta/models/customer_shipping_contacts_response_address.py rename to conekta/models/customer_shipping_contacts_request_address.py index db0c5ce..bf12bf0 100644 --- a/conekta/models/customer_shipping_contacts_response_address.py +++ b/conekta/models/customer_shipping_contacts_request_address.py @@ -18,27 +18,28 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CustomerShippingContactsResponseAddress(BaseModel): +class CustomerShippingContactsRequestAddress(BaseModel): """ - CustomerShippingContactsResponseAddress + Address of the person who will receive the order """ # noqa: E501 - object: Optional[StrictStr] = None - street1: Optional[StrictStr] = None - street2: Optional[StrictStr] = None - postal_code: Optional[StrictStr] = None - city: Optional[StrictStr] = None - state: Optional[StrictStr] = None - country: Optional[StrictStr] = None - residential: Optional[StrictBool] = None - __properties: ClassVar[List[str]] = ["object", "street1", "street2", "postal_code", "city", "state", "country", "residential"] + street1: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Nuevo Leon 254"]}) + street2: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Departamento 404"]}) + postal_code: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["06100"]}) + city: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Ciudad de Mexico"]}) + state: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Ciudad de Mexico"]}) + country: Optional[StrictStr] = Field(default=None, description="this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)", json_schema_extra={"examples": ["MX"]}) + residential: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + __properties: ClassVar[List[str]] = ["street1", "street2", "postal_code", "city", "state", "country", "residential"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,12 +51,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomerShippingContactsResponseAddress from a JSON string""" + """Create an instance of CustomerShippingContactsRequestAddress from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -76,16 +76,11 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if residential (nullable) is None - # and model_fields_set contains the field - if self.residential is None and "residential" in self.model_fields_set: - _dict['residential'] = None - return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomerShippingContactsResponseAddress from a dict""" + """Create an instance of CustomerShippingContactsRequestAddress from a dict""" if obj is None: return None @@ -93,7 +88,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "object": obj.get("object"), "street1": obj.get("street1"), "street2": obj.get("street2"), "postal_code": obj.get("postal_code"), diff --git a/conekta/models/customer_shipping_contacts_response.py b/conekta/models/customer_shipping_contacts_response.py index fa644f9..ea00522 100644 --- a/conekta/models/customer_shipping_contacts_response.py +++ b/conekta/models/customer_shipping_contacts_response.py @@ -20,29 +20,31 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_shipping_contacts_response_address import CustomerShippingContactsResponseAddress +from conekta.models.customer_shipping_contacts_address import CustomerShippingContactsAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomerShippingContactsResponse(BaseModel): """ Contains the detail of the shipping addresses that the client has active or has used in Conekta """ # noqa: E501 - phone: Optional[StrictStr] = None - receiver: Optional[StrictStr] = None - between_streets: Optional[StrictStr] = None - address: Optional[CustomerShippingContactsResponseAddress] = None + phone: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["+525511223344"]}) + receiver: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Marvin Fuller"]}) + between_streets: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Ackerman Crescent"]}) + address: Optional[CustomerShippingContactsAddress] = None parent_id: Optional[StrictStr] = None - default: Optional[StrictBool] = None - id: Optional[StrictStr] = None - created_at: Optional[StrictInt] = None + default: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["adr_1234567890"]}) + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1675715413]}) metadata: Optional[Dict[str, Any]] = Field(default=None, description="Metadata associated with the shipping contact") - object: Optional[StrictStr] = None - deleted: Optional[StrictBool] = None + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["shipping_contact"]}) + deleted: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) __properties: ClassVar[List[str]] = ["phone", "receiver", "between_streets", "address", "parent_id", "default", "id", "created_at", "metadata", "object", "deleted"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -83,11 +84,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() - # set to None if between_streets (nullable) is None - # and model_fields_set contains the field - if self.between_streets is None and "between_streets" in self.model_fields_set: - _dict['between_streets'] = None - return _dict @classmethod @@ -103,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "phone": obj.get("phone"), "receiver": obj.get("receiver"), "between_streets": obj.get("between_streets"), - "address": CustomerShippingContactsResponseAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": CustomerShippingContactsAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "parent_id": obj.get("parent_id"), "default": obj.get("default"), "id": obj.get("id"), diff --git a/conekta/models/customer_subscription_response.py b/conekta/models/customer_subscription_response.py new file mode 100644 index 0000000..7c7e579 --- /dev/null +++ b/conekta/models/customer_subscription_response.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class CustomerSubscriptionResponse(BaseModel): + """ + subscription model + """ # noqa: E501 + billing_cycle_start: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626827]}) + billing_cycle_end: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626827]}) + canceled_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1678258162]}) + canceled_reason: Optional[StrictStr] = Field(default=None, description="Reason for cancellation. This field appears when the subscription status is 'canceled'.", json_schema_extra={"examples": ["user_cancelation"]}) + card_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["src_2tKcHxhTz7xU5SymL"]}) + charge_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["2tKcHxhTz7xU5SymL"]}) + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626837]}) + customer_custom_reference: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["dotnet_123456"]}) + customer_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2tKcHxhTz7xU5SymF"]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["gold-plan"]}) + last_billing_cycle_order_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["ord_2tSoMP7bZJbLiq4z8"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["subscription"]}) + paused_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1678258162]}) + plan_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["plan_2tXx672QLQ68CkmMn"]}) + status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["past_due"]}) + subscription_start: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626837]}) + trial_start: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626837]}) + trial_end: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626837]}) + __properties: ClassVar[List[str]] = ["billing_cycle_start", "billing_cycle_end", "canceled_at", "canceled_reason", "card_id", "charge_id", "created_at", "customer_custom_reference", "customer_id", "id", "last_billing_cycle_order_id", "object", "paused_at", "plan_id", "status", "subscription_start", "trial_start", "trial_end"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CustomerSubscriptionResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CustomerSubscriptionResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "billing_cycle_start": obj.get("billing_cycle_start"), + "billing_cycle_end": obj.get("billing_cycle_end"), + "canceled_at": obj.get("canceled_at"), + "canceled_reason": obj.get("canceled_reason"), + "card_id": obj.get("card_id"), + "charge_id": obj.get("charge_id"), + "created_at": obj.get("created_at"), + "customer_custom_reference": obj.get("customer_custom_reference"), + "customer_id": obj.get("customer_id"), + "id": obj.get("id"), + "last_billing_cycle_order_id": obj.get("last_billing_cycle_order_id"), + "object": obj.get("object"), + "paused_at": obj.get("paused_at"), + "plan_id": obj.get("plan_id"), + "status": obj.get("status"), + "subscription_start": obj.get("subscription_start"), + "trial_start": obj.get("trial_start"), + "trial_end": obj.get("trial_end") + }) + return _obj + + diff --git a/conekta/models/customer_update_shipping_contacts.py b/conekta/models/customer_update_shipping_contacts_request.py similarity index 73% rename from conekta/models/customer_update_shipping_contacts.py rename to conekta/models/customer_update_shipping_contacts_request.py index eb33e0a..4a3a4ad 100644 --- a/conekta/models/customer_update_shipping_contacts.py +++ b/conekta/models/customer_update_shipping_contacts_request.py @@ -20,25 +20,27 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_shipping_contacts_address import CustomerShippingContactsAddress +from conekta.models.customer_shipping_contacts_request_address import CustomerShippingContactsRequestAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CustomerUpdateShippingContacts(BaseModel): +class CustomerUpdateShippingContactsRequest(BaseModel): """ [Shipping](https://developers.conekta.com/v2.2.0/reference/createcustomershippingcontacts) details, required in case of sending a shipping. If we do not receive a shipping_contact on the order, the default shipping_contact of the customer will be used. """ # noqa: E501 - phone: Optional[StrictStr] = Field(default=None, description="Phone contact") - receiver: Optional[StrictStr] = Field(default=None, description="Name of the person who will receive the order") - between_streets: Optional[StrictStr] = Field(default=None, description="The street names between which the order will be delivered.") - address: Optional[CustomerShippingContactsAddress] = None + phone: Optional[StrictStr] = Field(default=None, description="Phone contact", json_schema_extra={"examples": ["+525511223344"]}) + receiver: Optional[StrictStr] = Field(default=None, description="Name of the person who will receive the order", json_schema_extra={"examples": ["Marvin Fuller"]}) + between_streets: Optional[StrictStr] = Field(default=None, description="The street names between which the order will be delivered.", json_schema_extra={"examples": ["Ackerman Crescent"]}) + address: Optional[CustomerShippingContactsRequestAddress] = None parent_id: Optional[StrictStr] = None default: Optional[StrictBool] = None deleted: Optional[StrictBool] = None __properties: ClassVar[List[str]] = ["phone", "receiver", "between_streets", "address", "parent_id", "default", "deleted"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,12 +52,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomerUpdateShippingContacts from a JSON string""" + """Create an instance of CustomerUpdateShippingContactsRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -79,21 +80,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() - # set to None if default (nullable) is None - # and model_fields_set contains the field - if self.default is None and "default" in self.model_fields_set: - _dict['default'] = None - - # set to None if deleted (nullable) is None - # and model_fields_set contains the field - if self.deleted is None and "deleted" in self.model_fields_set: - _dict['deleted'] = None - return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomerUpdateShippingContacts from a dict""" + """Create an instance of CustomerUpdateShippingContactsRequest from a dict""" if obj is None: return None @@ -104,7 +95,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "phone": obj.get("phone"), "receiver": obj.get("receiver"), "between_streets": obj.get("between_streets"), - "address": CustomerShippingContactsAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": CustomerShippingContactsRequestAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "parent_id": obj.get("parent_id"), "default": obj.get("default"), "deleted": obj.get("deleted") diff --git a/conekta/models/customers_response.py b/conekta/models/customers_response.py index d6a0964..4432e7f 100644 --- a/conekta/models/customers_response.py +++ b/conekta/models/customers_response.py @@ -23,20 +23,22 @@ from conekta.models.customer_response import CustomerResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class CustomersResponse(BaseModel): """ CustomersResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") data: Optional[List[CustomerResponse]] = None - __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) + __properties: ClassVar[List[str]] = ["data", "has_more", "object", "next_page_url", "previous_page_url"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod @@ -103,11 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "data": [CustomerResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, "has_more": obj.get("has_more"), "object": obj.get("object"), "next_page_url": obj.get("next_page_url"), - "previous_page_url": obj.get("previous_page_url"), - "data": [CustomerResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None + "previous_page_url": obj.get("previous_page_url") }) return _obj diff --git a/conekta/models/delete_api_keys_response.py b/conekta/models/delete_api_keys_response.py index b27bc8b..674092a 100644 --- a/conekta/models/delete_api_keys_response.py +++ b/conekta/models/delete_api_keys_response.py @@ -22,25 +22,27 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DeleteApiKeysResponse(BaseModel): """ DeleteApiKeysResponse """ # noqa: E501 - active: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is active") - created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was created") - description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is in production") - prefix: Optional[StrictStr] = Field(default=None, description="The first few characters of the authentication_token") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the api key") - object: Optional[StrictStr] = Field(default=None, description="Object name, value is 'api_key'") + active: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is active", json_schema_extra={"examples": [True]}) + created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds of when the api key was created", json_schema_extra={"examples": [1684167881]}) + description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this api key is used for", json_schema_extra={"examples": ["online store"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the api key is in production", json_schema_extra={"examples": [False]}) + prefix: Optional[StrictStr] = Field(default=None, description="The first few characters of the authentication_token", json_schema_extra={"examples": ["key_rp"]}) + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the api key", json_schema_extra={"examples": ["64625cc9f3e02c00163f5e4d"]}) + object: Optional[StrictStr] = Field(default=None, description="Object name, value is 'api_key'", json_schema_extra={"examples": ["api_key"]}) last_used_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the api key was used") - role: Optional[StrictStr] = Field(default=None, description="Indicates if the api key is private or public") - deleted: Optional[StrictBool] = None + role: Optional[StrictStr] = Field(default=None, description="Indicates if the api key is private or public", json_schema_extra={"examples": ["private"]}) + deleted: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) __properties: ClassVar[List[str]] = ["active", "created_at", "description", "livemode", "prefix", "id", "object", "last_used_at", "role", "deleted"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,11 +79,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if last_used_at (nullable) is None - # and model_fields_set contains the field - if self.last_used_at is None and "last_used_at" in self.model_fields_set: - _dict['last_used_at'] = None - return _dict @classmethod diff --git a/conekta/models/deleted_blacklist_rule_response.py b/conekta/models/deleted_blacklist_rule_response.py index f337f1e..9e728f9 100644 --- a/conekta/models/deleted_blacklist_rule_response.py +++ b/conekta/models/deleted_blacklist_rule_response.py @@ -22,19 +22,21 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DeletedBlacklistRuleResponse(BaseModel): """ DeletedBlacklistRuleResponse """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="Blacklist rule id") - var_field: Optional[StrictStr] = Field(default=None, description="field used for blacklists rule deleted", alias="field") - value: Optional[StrictStr] = Field(default=None, description="value used for blacklists rule deleted") - description: Optional[StrictStr] = Field(default=None, description="use an description for blacklisted rule") + id: Optional[StrictStr] = Field(default=None, description="Blacklist rule id", json_schema_extra={"examples": ["2fw8EWJusiRrxdPzT"]}) + var_field: Optional[StrictStr] = Field(default=None, description="field used for blacklists rule deleted", alias="field", json_schema_extra={"examples": ["email"]}) + value: Optional[StrictStr] = Field(default=None, description="value used for blacklists rule deleted", json_schema_extra={"examples": ["email@example.com"]}) + description: Optional[StrictStr] = Field(default=None, description="use an description for blacklisted rule", json_schema_extra={"examples": ["banned customer example@example.com"]}) __properties: ClassVar[List[str]] = ["id", "field", "value", "description"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/deleted_whitelist_rule_response.py b/conekta/models/deleted_whitelist_rule_response.py index 5d354b0..cefbd7d 100644 --- a/conekta/models/deleted_whitelist_rule_response.py +++ b/conekta/models/deleted_whitelist_rule_response.py @@ -22,19 +22,21 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DeletedWhitelistRuleResponse(BaseModel): """ DeletedWhitelistRuleResponse """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="Whitelist rule id") - var_field: Optional[StrictStr] = Field(default=None, description="field used for whitelists rule deleted", alias="field") - value: Optional[StrictStr] = Field(default=None, description="value used for whitelists rule deleted") - description: Optional[StrictStr] = Field(default=None, description="use an description for whitelisted rule") + id: Optional[StrictStr] = Field(default=None, description="Whitelist rule id", json_schema_extra={"examples": ["2fw8EWJusiRrxdPzT"]}) + var_field: Optional[StrictStr] = Field(default=None, description="field used for whitelists rule deleted", alias="field", json_schema_extra={"examples": ["email"]}) + value: Optional[StrictStr] = Field(default=None, description="value used for whitelists rule deleted", json_schema_extra={"examples": ["email@example.com"]}) + description: Optional[StrictStr] = Field(default=None, description="use an description for whitelisted rule", json_schema_extra={"examples": ["secure customer example@example.com"]}) __properties: ClassVar[List[str]] = ["id", "field", "value", "description"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/details.py b/conekta/models/details.py deleted file mode 100644 index 326c040..0000000 --- a/conekta/models/details.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict -from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.details_error import DetailsError -from typing import Optional, Set -from typing_extensions import Self - -class Details(BaseModel): - """ - Details - """ # noqa: E501 - details: Optional[List[DetailsError]] = None - __properties: ClassVar[List[str]] = ["details"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of Details from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # override the default output from pydantic by calling `to_dict()` of each item in details (list) - _items = [] - if self.details: - for _item_details in self.details: - if _item_details: - _items.append(_item_details.to_dict()) - _dict['details'] = _items - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of Details from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "details": [DetailsError.from_dict(_item) for _item in obj["details"]] if obj.get("details") is not None else None - }) - return _obj - - diff --git a/conekta/models/details_error.py b/conekta/models/details_error.py index 1205f9e..b02c668 100644 --- a/conekta/models/details_error.py +++ b/conekta/models/details_error.py @@ -18,23 +18,25 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DetailsError(BaseModel): """ DetailsError """ # noqa: E501 - code: Optional[StrictStr] = None + code: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["conekta.errors.authentication.missing_key"]}) param: Optional[StrictStr] = None - message: Optional[StrictStr] = None - debug_message: Optional[StrictStr] = None + message: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Acceso no autorizado."]}) + debug_message: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Please include your access key in your request."]}) __properties: ClassVar[List[str]] = ["code", "param", "message", "debug_message"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -72,11 +73,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if param (nullable) is None - # and model_fields_set contains the field - if self.param is None and "param" in self.model_fields_set: - _dict['param'] = None - return _dict @classmethod diff --git a/conekta/models/discount_lines_data_response.py b/conekta/models/discount_lines_data_response.py index e455046..3afc6d2 100644 --- a/conekta/models/discount_lines_data_response.py +++ b/conekta/models/discount_lines_data_response.py @@ -23,21 +23,23 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DiscountLinesDataResponse(BaseModel): """ DiscountLinesDataResponse """ # noqa: E501 - amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be deducted from the total sum of all payments, in cents.") - code: StrictStr = Field(description="Discount code.") - type: StrictStr = Field(description="It can be 'loyalty', 'campaign', 'coupon' o 'sign'") - id: StrictStr = Field(description="The discount line id") - object: StrictStr = Field(description="The object name") - parent_id: StrictStr = Field(description="The order id") + amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be deducted from the total sum of all payments, in cents.", json_schema_extra={"examples": [500]}) + code: StrictStr = Field(description="Discount code.", json_schema_extra={"examples": ["123"]}) + type: StrictStr = Field(description="It can be 'loyalty', 'campaign', 'coupon' o 'sign'", json_schema_extra={"examples": ["loyalty"]}) + id: StrictStr = Field(description="The discount line id", json_schema_extra={"examples": ["dis_lin_2tQQ58HPgPw7StE8z"]}) + object: StrictStr = Field(description="The object name", json_schema_extra={"examples": ["discount_line"]}) + parent_id: StrictStr = Field(description="The order id", json_schema_extra={"examples": ["ord_2tPAmKCEJqh8RE6nY"]}) __properties: ClassVar[List[str]] = ["amount", "code", "type", "id", "object", "parent_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/discount_lines_response.py b/conekta/models/discount_lines_response.py index 7004f1f..cb1d575 100644 --- a/conekta/models/discount_lines_response.py +++ b/conekta/models/discount_lines_response.py @@ -23,21 +23,23 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DiscountLinesResponse(BaseModel): """ DiscountLinesResponse """ # noqa: E501 - amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be deducted from the total sum of all payments, in cents.") - code: StrictStr = Field(description="Discount code.") - type: StrictStr = Field(description="It can be 'loyalty', 'campaign', 'coupon' o 'sign'") - id: StrictStr = Field(description="The discount line id") - object: StrictStr = Field(description="The object name") - parent_id: StrictStr = Field(description="The order id") + amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be deducted from the total sum of all payments, in cents.", json_schema_extra={"examples": [500]}) + code: StrictStr = Field(description="Discount code.", json_schema_extra={"examples": ["123"]}) + type: StrictStr = Field(description="It can be 'loyalty', 'campaign', 'coupon' o 'sign'", json_schema_extra={"examples": ["loyalty"]}) + id: StrictStr = Field(description="The discount line id", json_schema_extra={"examples": ["dis_lin_2tQQ58HPgPw7StE8z"]}) + object: StrictStr = Field(description="The object name", json_schema_extra={"examples": ["discount_line"]}) + parent_id: StrictStr = Field(description="The order id", json_schema_extra={"examples": ["ord_2tPAmKCEJqh8RE6nY"]}) __properties: ClassVar[List[str]] = ["amount", "code", "type", "id", "object", "parent_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/email_checkout_request.py b/conekta/models/email_checkout_request.py index 10b63f1..ca7aa16 100644 --- a/conekta/models/email_checkout_request.py +++ b/conekta/models/email_checkout_request.py @@ -18,20 +18,22 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class EmailCheckoutRequest(BaseModel): """ EmailCheckoutRequest """ # noqa: E501 - email: StrictStr + email: StrictStr = Field(json_schema_extra={"examples": ["example@conekta.com"]}) __properties: ClassVar[List[str]] = ["email"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/error.py b/conekta/models/error.py index 52f89f2..a93508e 100644 --- a/conekta/models/error.py +++ b/conekta/models/error.py @@ -23,19 +23,21 @@ from conekta.models.details_error import DetailsError from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Error(BaseModel): """ err model """ # noqa: E501 details: Optional[List[DetailsError]] = None - log_id: Optional[StrictStr] = Field(default=None, description="log id") - type: Optional[StrictStr] = None - object: Optional[StrictStr] = None + log_id: Optional[StrictStr] = Field(default=None, description="log id", json_schema_extra={"examples": ["507f1f77bcf86cd799439011"]}) + type: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["authentication_error"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["error"]}) __properties: ClassVar[List[str]] = ["details", "log_id", "type", "object"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -80,11 +81,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_details: _items.append(_item_details.to_dict()) _dict['details'] = _items - # set to None if log_id (nullable) is None - # and model_fields_set contains the field - if self.log_id is None and "log_id" in self.model_fields_set: - _dict['log_id'] = None - return _dict @classmethod diff --git a/conekta/models/event_response.py b/conekta/models/event_response.py index 466bb24..6a07ead 100644 --- a/conekta/models/event_response.py +++ b/conekta/models/event_response.py @@ -18,28 +18,30 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from conekta.models.webhook_log import WebhookLog from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class EventResponse(BaseModel): """ event model """ # noqa: E501 - created_at: Optional[StrictInt] = None - data: Optional[Dict[str, Any]] = None - id: Optional[StrictStr] = None - livemode: Optional[StrictBool] = None - object: Optional[StrictStr] = None - type: Optional[StrictStr] = None + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1661445644]}) + data: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"action": "ping", "livemode": True}]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6307a60c41de27127515a575"]}) + livemode: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["event"]}) + type: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["webhook_ping"]}) webhook_logs: Optional[List[WebhookLog]] = None - webhook_status: Optional[StrictStr] = None + webhook_status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["successful"]}) __properties: ClassVar[List[str]] = ["created_at", "data", "id", "livemode", "object", "type", "webhook_logs", "webhook_status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,8 +53,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/events_resend_response.py b/conekta/models/events_resend_response.py index 6bac1e5..c0fde0b 100644 --- a/conekta/models/events_resend_response.py +++ b/conekta/models/events_resend_response.py @@ -18,25 +18,27 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class EventsResendResponse(BaseModel): """ event model """ # noqa: E501 - failed_attempts: Optional[StrictInt] = None - id: Optional[StrictStr] = None - last_attempted_at: Optional[StrictInt] = None - last_http_response_status: Optional[StrictInt] = None - response_data: Optional[Dict[str, Any]] = None - url: Optional[StrictStr] = None + failed_attempts: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [6]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["webhl_2svd2sh6GbqzyWBNZ"]}) + last_attempted_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1684265970]}) + last_http_response_status: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [405]}) + response_data: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{}]}) + url: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["https://username:password@mockoon.conekta.io/payments-api/cash/merchant_approval"]}) __properties: ClassVar[List[str]] = ["failed_attempts", "id", "last_attempted_at", "last_http_response_status", "response_data", "url"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/fiscal_entity_address.py b/conekta/models/fiscal_entity_address.py index 61a4b9b..843c325 100644 --- a/conekta/models/fiscal_entity_address.py +++ b/conekta/models/fiscal_entity_address.py @@ -22,22 +22,24 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class FiscalEntityAddress(BaseModel): """ Address of the fiscal entity """ # noqa: E501 - street1: StrictStr = Field(description="Street name and number") - street2: Optional[StrictStr] = Field(default=None, description="Street name and number") - postal_code: StrictStr = Field(description="Postal code") - city: StrictStr = Field(description="City") - state: Optional[StrictStr] = Field(default=None, description="State") - country: StrictStr = Field(description="this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)") - external_number: StrictStr = Field(description="External number") + street1: StrictStr = Field(description="Street name and number", json_schema_extra={"examples": ["Nuevo Leon 254"]}) + street2: Optional[StrictStr] = Field(default=None, description="Street name and number", json_schema_extra={"examples": ["Departamento 404"]}) + postal_code: StrictStr = Field(description="Postal code", json_schema_extra={"examples": ["06100"]}) + city: StrictStr = Field(description="City", json_schema_extra={"examples": ["Ciudad de Mexico"]}) + state: Optional[StrictStr] = Field(default=None, description="State", json_schema_extra={"examples": ["Ciudad de Mexico"]}) + country: StrictStr = Field(description="this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)", json_schema_extra={"examples": ["MX"]}) + external_number: StrictStr = Field(description="External number", json_schema_extra={"examples": ["123"]}) __properties: ClassVar[List[str]] = ["street1", "street2", "postal_code", "city", "state", "country", "external_number"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -75,11 +76,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if street2 (nullable) is None - # and model_fields_set contains the field - if self.street2 is None and "street2" in self.model_fields_set: - _dict['street2'] = None - return _dict @classmethod diff --git a/conekta/models/customer_fiscal_entities_request.py b/conekta/models/fiscal_entity_request.py similarity index 70% rename from conekta/models/customer_fiscal_entities_request.py rename to conekta/models/fiscal_entity_request.py index 9be9177..7beaf8a 100644 --- a/conekta/models/customer_fiscal_entities_request.py +++ b/conekta/models/fiscal_entity_request.py @@ -18,26 +18,28 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_address import CustomerAddress +from conekta.models.fiscal_entity_request_address import FiscalEntityRequestAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CustomerFiscalEntitiesRequest(BaseModel): +class FiscalEntityRequest(BaseModel): """ - CustomerFiscalEntitiesRequest + FiscalEntityRequest """ # noqa: E501 - address: CustomerAddress + address: FiscalEntityRequestAddress tax_id: Optional[StrictStr] = None email: Optional[StrictStr] = None phone: Optional[StrictStr] = None - metadata: Optional[Dict[str, Dict[str, Any]]] = None - company_name: Optional[StrictStr] = None + metadata: Optional[Any] = None + company_name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["conekta"]}) __properties: ClassVar[List[str]] = ["address", "tax_id", "email", "phone", "metadata", "company_name"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,12 +51,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomerFiscalEntitiesRequest from a JSON string""" + """Create an instance of FiscalEntityRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -78,11 +79,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomerFiscalEntitiesRequest from a dict""" + """Create an instance of FiscalEntityRequest from a dict""" if obj is None: return None @@ -90,11 +96,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "address": CustomerAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": FiscalEntityRequestAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "tax_id": obj.get("tax_id"), "email": obj.get("email"), "phone": obj.get("phone"), - "metadata": obj.get("metadata"), "company_name": obj.get("company_name") }) return _obj diff --git a/conekta/models/customer_address.py b/conekta/models/fiscal_entity_request_address.py similarity index 72% rename from conekta/models/customer_address.py rename to conekta/models/fiscal_entity_request_address.py index fcd1c1c..47c5ab4 100644 --- a/conekta/models/customer_address.py +++ b/conekta/models/fiscal_entity_request_address.py @@ -22,23 +22,25 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CustomerAddress(BaseModel): +class FiscalEntityRequestAddress(BaseModel): """ - CustomerAddress + FiscalEntityRequestAddress """ # noqa: E501 - street1: StrictStr - street2: Optional[StrictStr] = None - postal_code: StrictStr - city: StrictStr - state: Optional[StrictStr] = None - country: Optional[StrictStr] = Field(default=None, description="this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)") - residential: Optional[StrictBool] = False + street1: StrictStr = Field(json_schema_extra={"examples": ["Nuevo Leon 254"]}) + street2: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Departamento 404"]}) + postal_code: StrictStr = Field(json_schema_extra={"examples": ["06100"]}) + city: StrictStr = Field(json_schema_extra={"examples": ["Ciudad de Mexico"]}) + state: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Ciudad de Mexico"]}) + country: Optional[StrictStr] = Field(default=None, description="this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)", json_schema_extra={"examples": ["MX"]}) + residential: Optional[StrictBool] = Field(default=False, json_schema_extra={"examples": [True]}) external_number: Optional[StrictStr] = None __properties: ClassVar[List[str]] = ["street1", "street2", "postal_code", "city", "state", "country", "residential", "external_number"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,12 +52,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomerAddress from a JSON string""" + """Create an instance of FiscalEntityRequestAddress from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -80,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomerAddress from a dict""" + """Create an instance of FiscalEntityRequestAddress from a dict""" if obj is None: return None diff --git a/conekta/models/get_api_keys_response.py b/conekta/models/get_api_keys_response.py index 44da54f..cd0c28c 100644 --- a/conekta/models/get_api_keys_response.py +++ b/conekta/models/get_api_keys_response.py @@ -23,20 +23,22 @@ from conekta.models.api_key_response import ApiKeyResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetApiKeysResponse(BaseModel): """ GetApiKeysResponse """ # noqa: E501 - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) data: Optional[List[ApiKeyResponse]] = None __properties: ClassVar[List[str]] = ["next_page_url", "previous_page_url", "has_more", "object", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_charges_response.py b/conekta/models/get_charges_response.py index 3e71853..7434710 100644 --- a/conekta/models/get_charges_response.py +++ b/conekta/models/get_charges_response.py @@ -23,20 +23,22 @@ from conekta.models.charge_response import ChargeResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetChargesResponse(BaseModel): """ GetChargesResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[ChargeResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_companies_response.py b/conekta/models/get_companies_response.py index 8a6b406..21fecb0 100644 --- a/conekta/models/get_companies_response.py +++ b/conekta/models/get_companies_response.py @@ -23,20 +23,22 @@ from conekta.models.company_response import CompanyResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetCompaniesResponse(BaseModel): """ GetCompaniesResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[CompanyResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_customer_payment_method_data_response.py b/conekta/models/get_customer_payment_method_data_response.py index 254b086..ce967e2 100644 --- a/conekta/models/get_customer_payment_method_data_response.py +++ b/conekta/models/get_customer_payment_method_data_response.py @@ -21,12 +21,12 @@ from conekta.models.payment_method_card_response import PaymentMethodCardResponse from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_response import PaymentMethodCashResponse -from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent +from conekta.models.payment_method_spei_recurrent_response import PaymentMethodSpeiRecurrentResponse from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -GETCUSTOMERPAYMENTMETHODDATARESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] +GETCUSTOMERPAYMENTMETHODDATARESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrentResponse"] class GetCustomerPaymentMethodDataResponse(BaseModel): """ @@ -38,10 +38,10 @@ class GetCustomerPaymentMethodDataResponse(BaseModel): oneof_schema_2_validator: Optional[PaymentMethodCashResponse] = None # data type: PaymentMethodCardResponse oneof_schema_3_validator: Optional[PaymentMethodCardResponse] = None - # data type: PaymentMethodSpeiRecurrent - oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrent] = None - actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None - one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } + # data type: PaymentMethodSpeiRecurrentResponse + oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrentResponse] = None + actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse]] = None + one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrentResponse" } model_config = ConfigDict( validate_assignment=True, @@ -82,17 +82,17 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCardResponse`") else: match += 1 - # validate data type: PaymentMethodSpeiRecurrent - if not isinstance(v, PaymentMethodSpeiRecurrent): - error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodSpeiRecurrent`") + # validate data type: PaymentMethodSpeiRecurrentResponse + if not isinstance(v, PaymentMethodSpeiRecurrentResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodSpeiRecurrentResponse`") else: match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) else: return v @@ -108,9 +108,10 @@ def from_json(cls, json_str: str) -> Self: match = 0 # use oneOf discriminator to lookup the data type - _data_type = json.loads(json_str).get("type") + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) if not _data_type: - raise ValueError("Failed to lookup data type from the field `type` in the input.") + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") # check if data type is `PaymentMethodCardResponse` if _data_type == "card": @@ -127,29 +128,9 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) return instance - # check if data type is `PaymentMethodSpeiRecurrent` + # check if data type is `PaymentMethodSpeiRecurrentResponse` if _data_type == "spei_recurrent": - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCardResponse` - if _data_type == "payment_method_card_response": - instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashRecurrentResponse` - if _data_type == "payment_method_cash_recurrent_response": - instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashResponse` - if _data_type == "payment_method_cash_response": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodSpeiRecurrent` - if _data_type == "payment_method_spei_recurrent": - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) + instance.actual_instance = PaymentMethodSpeiRecurrentResponse.from_json(json_str) return instance # deserialize data into PaymentMethodCashRecurrentResponse @@ -170,19 +151,19 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into PaymentMethodSpeiRecurrent + # deserialize data into PaymentMethodSpeiRecurrentResponse try: - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) + instance.actual_instance = PaymentMethodSpeiRecurrentResponse.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into GetCustomerPaymentMethodDataResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) else: return instance @@ -196,7 +177,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/get_events_response.py b/conekta/models/get_events_response.py index bb041ba..428b802 100644 --- a/conekta/models/get_events_response.py +++ b/conekta/models/get_events_response.py @@ -23,20 +23,22 @@ from conekta.models.event_response import EventResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetEventsResponse(BaseModel): """ GetEventsResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[EventResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_order_discount_lines_response.py b/conekta/models/get_order_discount_lines_response.py index 0b47b73..d3cc4a4 100644 --- a/conekta/models/get_order_discount_lines_response.py +++ b/conekta/models/get_order_discount_lines_response.py @@ -23,20 +23,22 @@ from conekta.models.discount_lines_response import DiscountLinesResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetOrderDiscountLinesResponse(BaseModel): """ GetOrderDiscountLinesResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[DiscountLinesResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_orders_response.py b/conekta/models/get_orders_response.py index 64e1f70..5b3de0d 100644 --- a/conekta/models/get_orders_response.py +++ b/conekta/models/get_orders_response.py @@ -23,20 +23,22 @@ from conekta.models.order_response import OrderResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetOrdersResponse(BaseModel): """ GetOrdersResponse """ # noqa: E501 data: List[OrderResponse] - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) __properties: ClassVar[List[str]] = ["data", "has_more", "object", "next_page_url", "previous_page_url"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_payment_method_response.py b/conekta/models/get_payment_method_response.py index e547a47..8b22fde 100644 --- a/conekta/models/get_payment_method_response.py +++ b/conekta/models/get_payment_method_response.py @@ -23,20 +23,22 @@ from conekta.models.get_customer_payment_method_data_response import GetCustomerPaymentMethodDataResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetPaymentMethodResponse(BaseModel): """ GetPaymentMethodResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[GetCustomerPaymentMethodDataResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_plans_response.py b/conekta/models/get_plans_response.py index 057affc..bf5092c 100644 --- a/conekta/models/get_plans_response.py +++ b/conekta/models/get_plans_response.py @@ -23,20 +23,22 @@ from conekta.models.plan_response import PlanResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetPlansResponse(BaseModel): """ GetPlansResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[PlanResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_transactions_response.py b/conekta/models/get_transactions_response.py index 4553164..8e28f6b 100644 --- a/conekta/models/get_transactions_response.py +++ b/conekta/models/get_transactions_response.py @@ -23,20 +23,22 @@ from conekta.models.transaction_response import TransactionResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetTransactionsResponse(BaseModel): """ GetTransactionsResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[TransactionResponse]] = Field(default=None, description="Transactions") __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_transfers_response.py b/conekta/models/get_transfers_response.py index 86a253c..a76a7eb 100644 --- a/conekta/models/get_transfers_response.py +++ b/conekta/models/get_transfers_response.py @@ -23,20 +23,22 @@ from conekta.models.transfers_response import TransfersResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetTransfersResponse(BaseModel): """ GetTransfersResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[TransfersResponse]] = Field(default=None, description="Transfers") __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_webhook_keys_response.py b/conekta/models/get_webhook_keys_response.py index dbd68d7..afffd48 100644 --- a/conekta/models/get_webhook_keys_response.py +++ b/conekta/models/get_webhook_keys_response.py @@ -23,20 +23,22 @@ from conekta.models.webhook_key_response import WebhookKeyResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetWebhookKeysResponse(BaseModel): """ GetWebhookKeysResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[WebhookKeyResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/get_webhooks_response.py b/conekta/models/get_webhooks_response.py index c69a02f..ca6b593 100644 --- a/conekta/models/get_webhooks_response.py +++ b/conekta/models/get_webhooks_response.py @@ -23,20 +23,22 @@ from conekta.models.webhook_response import WebhookResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class GetWebhooksResponse(BaseModel): """ GetWebhooksResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[WebhookResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/log_response.py b/conekta/models/log_response.py deleted file mode 100644 index 5c75d48..0000000 --- a/conekta/models/log_response.py +++ /dev/null @@ -1,141 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class LogResponse(BaseModel): - """ - log model - """ # noqa: E501 - created_at: StrictInt - id: StrictStr - ip_address: Optional[StrictStr] = None - livemode: StrictBool - loggable_id: Optional[StrictStr] = None - loggable_type: Optional[StrictStr] = None - method: Optional[StrictStr] = None - oauth_token_id: Optional[StrictStr] = None - query_string: Optional[Dict[str, Any]] = None - related: Optional[StrictStr] = None - request_body: Optional[Dict[str, Any]] = None - request_headers: Optional[Dict[str, StrictStr]] = None - response_body: Optional[Dict[str, Any]] = None - response_headers: Optional[Dict[str, StrictStr]] = None - searchable_tags: Optional[List[StrictStr]] = None - status: Optional[StrictStr] = None - updated_at: Optional[StrictStr] = None - url: Optional[StrictStr] = None - user_account_id: Optional[StrictStr] = None - version: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["created_at", "id", "ip_address", "livemode", "loggable_id", "loggable_type", "method", "oauth_token_id", "query_string", "related", "request_body", "request_headers", "response_body", "response_headers", "searchable_tags", "status", "updated_at", "url", "user_account_id", "version"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of LogResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # set to None if loggable_id (nullable) is None - # and model_fields_set contains the field - if self.loggable_id is None and "loggable_id" in self.model_fields_set: - _dict['loggable_id'] = None - - # set to None if loggable_type (nullable) is None - # and model_fields_set contains the field - if self.loggable_type is None and "loggable_type" in self.model_fields_set: - _dict['loggable_type'] = None - - # set to None if oauth_token_id (nullable) is None - # and model_fields_set contains the field - if self.oauth_token_id is None and "oauth_token_id" in self.model_fields_set: - _dict['oauth_token_id'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of LogResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "created_at": obj.get("created_at"), - "id": obj.get("id"), - "ip_address": obj.get("ip_address"), - "livemode": obj.get("livemode"), - "loggable_id": obj.get("loggable_id"), - "loggable_type": obj.get("loggable_type"), - "method": obj.get("method"), - "oauth_token_id": obj.get("oauth_token_id"), - "query_string": obj.get("query_string"), - "related": obj.get("related"), - "request_body": obj.get("request_body"), - "request_headers": obj.get("request_headers"), - "response_body": obj.get("response_body"), - "response_headers": obj.get("response_headers"), - "searchable_tags": obj.get("searchable_tags"), - "status": obj.get("status"), - "updated_at": obj.get("updated_at"), - "url": obj.get("url"), - "user_account_id": obj.get("user_account_id"), - "version": obj.get("version") - }) - return _obj - - diff --git a/conekta/models/log_response_for_request.py b/conekta/models/log_response_for_request.py new file mode 100644 index 0000000..66290c4 --- /dev/null +++ b/conekta/models/log_response_for_request.py @@ -0,0 +1,135 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class LogResponseForRequest(BaseModel): + """ + log model + """ # noqa: E501 + created_at: StrictInt = Field(json_schema_extra={"examples": [1661445644]}) + id: StrictStr = Field(json_schema_extra={"examples": ["6307a60c41de27127515a575"]}) + ip_address: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["54.235.131.48"]}) + livemode: StrictBool = Field(json_schema_extra={"examples": [True]}) + loggable_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["ord_87632467832"]}) + loggable_type: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["order"]}) + method: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["POST"]}) + oauth_token_id: Optional[StrictStr] = None + query_string: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"amount": 3000, "payable": True}]}) + related: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["FilterResource"]}) + request_body: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"filters": {"amount": {"amount_from": 0, "amount_to": 0}, "created_at": {"date_from": 1653627600, "date_to": 1661489999}, "filterName": "Payments", "sort_by": "created_at", "sort_direction": "desc", "status": [], "type": []}, "id": "78e65162-0f37-4942-847c-9bf7081d54c2", "page": "0", "report_type": "charges", "testMode": False}]}) + request_headers: Optional[Any] = Field(default=None, json_schema_extra={"examples": [{"Accept": "application/vnd.conekta-v2.2.0+json", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "es-419, es; q=0.9, en; q=0.8", "Activitypermission": "orders:read", "Apiversion": "2.2.0"}]}) + response_body: Optional[Dict[str, Any]] = None + response_headers: Optional[Any] = Field(default=None, json_schema_extra={"examples": [{"Access-Control-Allow-Headers": "Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, X-Prototype-Version, Authorization, Accept, Date, Version, X-Forwarded-For, Host, Connection, X-Forwarded-Proto, X-Forwarded-Port, X-Amzn-Trace-Id, Accept-Encoding, Accept-Language, Referer, Origin, Activitypermission, Apiversion, Entityid, Livemode, Sec-Ch-Ua, Sec-Ch-Ua-Mobile, Sec-Ch-Ua-Platform, Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site, X-Datadog-Parent-Id, X-Datadog-Sampling-Priority, X-Datadog-Trace-Id, X-Forwarded-Host, X-Forwarded-Server, X-Real-Ip", "Access-Control-Allow-Methods": "POST, GET, PUT, OPTIONS", "Access-Control-Allow-Origin": "*", "Access-Control-Max-Age": "1728000", "Conekta-Media-Type": "conekta-v2.2.0; format=application/json", "Content-Type": "application/json; charset=utf-8", "Referrer-Policy": "strict-origin-when-cross-origin", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "X-Download-Options": "noopen", "X-Frame-Options": "SAMEORIGIN", "X-Permitted-Cross-Domain-Policies": "none", "X-XSS-Protection": "1; mode=block"}]}) + searchable_tags: Optional[List[StrictStr]] = Field(default=None, json_schema_extra={"examples": [["6307a60c41de27127515a575", "6307a60c41de27127515a571"]]}) + status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": [200]}) + updated_at: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["2022-08-25T16:40:44.887+00:00"]}) + url: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["/filter_resource"]}) + user_account_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["5a0b7001edbb6e1725b0b2c6"]}) + version: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["2.2.0"]}) + __properties: ClassVar[List[str]] = ["created_at", "id", "ip_address", "livemode", "loggable_id", "loggable_type", "method", "oauth_token_id", "query_string", "related", "request_body", "request_headers", "response_body", "response_headers", "searchable_tags", "status", "updated_at", "url", "user_account_id", "version"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LogResponseForRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # set to None if request_headers (nullable) is None + # and model_fields_set contains the field + if self.request_headers is None and "request_headers" in self.model_fields_set: + _dict['request_headers'] = None + + # set to None if response_headers (nullable) is None + # and model_fields_set contains the field + if self.response_headers is None and "response_headers" in self.model_fields_set: + _dict['response_headers'] = None + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LogResponseForRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "created_at": obj.get("created_at"), + "id": obj.get("id"), + "ip_address": obj.get("ip_address"), + "livemode": obj.get("livemode"), + "loggable_id": obj.get("loggable_id"), + "loggable_type": obj.get("loggable_type"), + "method": obj.get("method"), + "oauth_token_id": obj.get("oauth_token_id"), + "query_string": obj.get("query_string"), + "related": obj.get("related"), + "request_body": obj.get("request_body"), + "response_body": obj.get("response_body"), + "searchable_tags": obj.get("searchable_tags"), + "status": obj.get("status"), + "updated_at": obj.get("updated_at"), + "url": obj.get("url"), + "user_account_id": obj.get("user_account_id"), + "version": obj.get("version") + }) + return _obj + + diff --git a/conekta/models/logs_response_data.py b/conekta/models/logs_response_data.py index d03dda1..bbf81c5 100644 --- a/conekta/models/logs_response_data.py +++ b/conekta/models/logs_response_data.py @@ -18,39 +18,41 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class LogsResponseData(BaseModel): """ LogsResponseData """ # noqa: E501 - created_at: Optional[StrictInt] = None - id: Optional[StrictStr] = None - ip_address: Optional[StrictStr] = None - livemode: Optional[StrictBool] = None - loggable_id: Optional[StrictStr] = None - loggable_type: Optional[StrictStr] = None - method: Optional[StrictStr] = None + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1661445644]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6307a60c41de27127515a575"]}) + ip_address: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["54.235.131.48"]}) + livemode: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + loggable_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["ord_87632467832"]}) + loggable_type: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["order"]}) + method: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["POST"]}) oauth_token_id: Optional[StrictStr] = None - query_string: Optional[Dict[str, Any]] = None - related: Optional[StrictStr] = None - request_body: Optional[Dict[str, Any]] = None - request_headers: Optional[Dict[str, StrictStr]] = None + query_string: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"amount": 3000, "payable": True}]}) + related: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["FilterResource"]}) + request_body: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"filters": {"amount": {"amount_from": 0, "amount_to": 0}, "created_at": {"date_from": 1653627600, "date_to": 1661489999}, "filterName": "Payments", "sort_by": "created_at", "sort_direction": "desc", "status": [], "type": []}, "id": "78e65162-0f37-4942-847c-9bf7081d54c2", "page": "0", "report_type": "charges", "testMode": False}]}) + request_headers: Optional[Any] = Field(default=None, json_schema_extra={"examples": [{"Accept": "application/vnd.conekta-v2.2.0+json", "Accept-Encoding": "gzip, deflate, br", "Accept-Language": "es-419, es; q=0.9, en; q=0.8", "Activitypermission": "orders:read", "Apiversion": "2.2.0"}]}) response_body: Optional[Dict[str, Any]] = None - response_headers: Optional[Dict[str, StrictStr]] = None - searchable_tags: Optional[List[StrictStr]] = None - status: Optional[StrictStr] = None - updated_at: Optional[StrictStr] = None - url: Optional[StrictStr] = None - user_account_id: Optional[StrictStr] = None - version: Optional[StrictStr] = None + response_headers: Optional[Any] = Field(default=None, json_schema_extra={"examples": [{"Access-Control-Allow-Headers": "Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control, X-Prototype-Version, Authorization, Accept, Date, Version, X-Forwarded-For, Host, Connection, X-Forwarded-Proto, X-Forwarded-Port, X-Amzn-Trace-Id, Accept-Encoding, Accept-Language, Referer, Origin, Activitypermission, Apiversion, Entityid, Livemode, Sec-Ch-Ua, Sec-Ch-Ua-Mobile, Sec-Ch-Ua-Platform, Sec-Fetch-Dest, Sec-Fetch-Mode, Sec-Fetch-Site, X-Datadog-Parent-Id, X-Datadog-Sampling-Priority, X-Datadog-Trace-Id, X-Forwarded-Host, X-Forwarded-Server, X-Real-Ip", "Access-Control-Allow-Methods": "POST, GET, PUT, OPTIONS", "Access-Control-Allow-Origin": "*", "Access-Control-Max-Age": "1728000", "Conekta-Media-Type": "conekta-v2.2.0; format=application/json", "Content-Type": "application/json; charset=utf-8", "Referrer-Policy": "strict-origin-when-cross-origin", "Strict-Transport-Security": "max-age=31536000; includeSubDomains", "X-Content-Type-Options": "nosniff", "X-Download-Options": "noopen", "X-Frame-Options": "SAMEORIGIN", "X-Permitted-Cross-Domain-Policies": "none", "X-XSS-Protection": "1; mode=block"}]}) + searchable_tags: Optional[List[StrictStr]] = Field(default=None, json_schema_extra={"examples": [["6307a60c41de27127515a575", "6307a60c41de27127515a571"]]}) + status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": [200]}) + updated_at: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["2022-08-25T16:40:44.887+00:00"]}) + url: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["/filter_resource"]}) + user_account_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["5a0b7001edbb6e1725b0b2c6"]}) + version: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["2.2.0"]}) __properties: ClassVar[List[str]] = ["created_at", "id", "ip_address", "livemode", "loggable_id", "loggable_type", "method", "oauth_token_id", "query_string", "related", "request_body", "request_headers", "response_body", "response_headers", "searchable_tags", "status", "updated_at", "url", "user_account_id", "version"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -62,8 +64,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,20 +89,15 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if loggable_id (nullable) is None + # set to None if request_headers (nullable) is None # and model_fields_set contains the field - if self.loggable_id is None and "loggable_id" in self.model_fields_set: - _dict['loggable_id'] = None + if self.request_headers is None and "request_headers" in self.model_fields_set: + _dict['request_headers'] = None - # set to None if loggable_type (nullable) is None + # set to None if response_headers (nullable) is None # and model_fields_set contains the field - if self.loggable_type is None and "loggable_type" in self.model_fields_set: - _dict['loggable_type'] = None - - # set to None if oauth_token_id (nullable) is None - # and model_fields_set contains the field - if self.oauth_token_id is None and "oauth_token_id" in self.model_fields_set: - _dict['oauth_token_id'] = None + if self.response_headers is None and "response_headers" in self.model_fields_set: + _dict['response_headers'] = None return _dict @@ -126,9 +122,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "query_string": obj.get("query_string"), "related": obj.get("related"), "request_body": obj.get("request_body"), - "request_headers": obj.get("request_headers"), "response_body": obj.get("response_body"), - "response_headers": obj.get("response_headers"), "searchable_tags": obj.get("searchable_tags"), "status": obj.get("status"), "updated_at": obj.get("updated_at"), diff --git a/conekta/models/logs_response.py b/conekta/models/logs_response_for_request.py similarity index 77% rename from conekta/models/logs_response.py rename to conekta/models/logs_response_for_request.py index 537fd1e..2f13d6f 100644 --- a/conekta/models/logs_response.py +++ b/conekta/models/logs_response_for_request.py @@ -23,8 +23,9 @@ from conekta.models.logs_response_data import LogsResponseData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class LogsResponse(BaseModel): +class LogsResponseForRequest(BaseModel): """ logs model """ # noqa: E501 @@ -36,7 +37,8 @@ class LogsResponse(BaseModel): __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,12 +50,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of LogsResponse from a JSON string""" + """Create an instance of LogsResponseForRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -85,26 +86,11 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - - # set to None if data (nullable) is None - # and model_fields_set contains the field - if self.data is None and "data" in self.model_fields_set: - _dict['data'] = None - return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of LogsResponse from a dict""" + """Create an instance of LogsResponseForRequest from a dict""" if obj is None: return None diff --git a/conekta/models/order_capture_request.py b/conekta/models/order_capture_request.py index c413804..af50553 100644 --- a/conekta/models/order_capture_request.py +++ b/conekta/models/order_capture_request.py @@ -23,16 +23,18 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderCaptureRequest(BaseModel): """ OrderCaptureRequest """ # noqa: E501 - amount: Annotated[int, Field(strict=True, ge=1)] = Field(description="Amount to capture") + amount: Annotated[int, Field(strict=True, ge=1)] = Field(description="Amount to capture", json_schema_extra={"examples": [500]}) __properties: ClassVar[List[str]] = ["amount"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/order_channel_response.py b/conekta/models/order_channel_response.py index 2ff94ee..af08797 100644 --- a/conekta/models/order_channel_response.py +++ b/conekta/models/order_channel_response.py @@ -18,23 +18,25 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderChannelResponse(BaseModel): """ OrderChannelResponse """ # noqa: E501 - segment: Optional[StrictStr] = None - checkout_request_id: Optional[StrictStr] = None - checkout_request_type: Optional[StrictStr] = None - id: Optional[StrictStr] = None + segment: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Checkout"]}) + checkout_request_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6fca054a-8519-4c43-971e-cea35cc519bb"]}) + checkout_request_type: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["HostedPayment"]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["channel_2tNDzhA4Akmzj11AU"]}) __properties: ClassVar[List[str]] = ["segment", "checkout_request_id", "checkout_request_type", "id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/order_charges_response.py b/conekta/models/order_charges_response.py index f28d983..673d07b 100644 --- a/conekta/models/order_charges_response.py +++ b/conekta/models/order_charges_response.py @@ -23,18 +23,22 @@ from conekta.models.charges_data_response import ChargesDataResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderChargesResponse(BaseModel): """ The charges associated with the order """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[ChargesDataResponse]] = None - __properties: ClassVar[List[str]] = ["has_more", "object", "data"] + __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -93,6 +96,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "has_more": obj.get("has_more"), "object": obj.get("object"), + "next_page_url": obj.get("next_page_url"), + "previous_page_url": obj.get("previous_page_url"), "data": [ChargesDataResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None }) return _obj diff --git a/conekta/models/checkout_request.py b/conekta/models/order_checkout_request.py similarity index 53% rename from conekta/models/checkout_request.py rename to conekta/models/order_checkout_request.py index ee0b1f6..07f451c 100644 --- a/conekta/models/checkout_request.py +++ b/conekta/models/order_checkout_request.py @@ -20,37 +20,63 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CheckoutRequest(BaseModel): +class OrderCheckoutRequest(BaseModel): """ [Checkout](https://developers.conekta.com/v2.2.0/reference/payment-link) details """ # noqa: E501 - allowed_payment_methods: List[StrictStr] = Field(description="Are the payment methods available for this link. For subscriptions, only 'card' is allowed due to the recurring nature of the payments.") - plan_ids: Optional[List[StrictStr]] = Field(default=None, description="List of plan IDs that will be available for subscription. This field is required for subscription payments.") - expires_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp of checkout expiration") - failure_url: Optional[StrictStr] = Field(default=None, description="Redirection url back to the site in case of failed payment, applies only to HostedPayment.") - monthly_installments_enabled: Optional[StrictBool] = None - monthly_installments_options: Optional[List[StrictInt]] = None - max_failed_retries: Optional[StrictInt] = Field(default=None, description="Number of retries allowed before the checkout is marked as failed") + allowed_payment_methods: List[StrictStr] = Field(description="Are the payment methods available for this link. For subscriptions, only 'card' is allowed due to the recurring nature of the payments.", json_schema_extra={"examples": [["cash", "card", "bank_transfer", "bnpl", "pay_by_bank", "google", "apple"]]}) + exclude_card_networks: Optional[List[StrictStr]] = Field(default=None, description="List of card networks to exclude from the checkout. This field is only applicable for card payments.", json_schema_extra={"examples": [["visa", "amex"]]}) + plan_ids: Optional[List[StrictStr]] = Field(default=None, description="List of plan IDs that will be available for subscription. This field is required for subscription payments.", json_schema_extra={"examples": [["plan_123", "plan_456"]]}) + expires_at: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 5 minutes to 365 days from the creation date. ") + failure_url: Optional[StrictStr] = Field(default=None, description="Redirection url back to the site in case of failed payment, applies only to HostedPayment.", json_schema_extra={"examples": ["https://www.mysite.com/failure"]}) + force_save_card: Optional[StrictBool] = Field(default=None, description="Indicates whether the card used for the payment should be saved for future purchases. This field is only applicable for card payments.", json_schema_extra={"examples": [False]}) + monthly_installments_enabled: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + monthly_installments_options: Optional[List[StrictInt]] = Field(default=None, json_schema_extra={"examples": [[3, 6, 12]]}) + max_failed_retries: Optional[StrictInt] = Field(default=None, description="Number of retries allowed before the checkout is marked as failed", json_schema_extra={"examples": [3]}) name: Optional[StrictStr] = Field(default=None, description="Reason for payment") - on_demand_enabled: Optional[StrictBool] = None - redirection_time: Optional[StrictInt] = Field(default=None, description="number of seconds to wait before redirecting to the success_url") - success_url: Optional[StrictStr] = Field(default=None, description="Redirection url back to the site in case of successful payment, applies only to HostedPayment") - type: Optional[StrictStr] = Field(default=None, description="This field represents the type of checkout") - __properties: ClassVar[List[str]] = ["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"] + on_demand_enabled: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + redirection_time: Optional[StrictInt] = Field(default=None, description="number of seconds to wait before redirecting to the success_url", json_schema_extra={"examples": [10]}) + success_url: Optional[StrictStr] = Field(default=None, description="Redirection url back to the site in case of successful payment, applies only to HostedPayment", json_schema_extra={"examples": ["https://www.mysite.com/success"]}) + type: Optional[StrictStr] = Field(default=None, description="Required. This field represents the type of checkout, which determines the user experience during the payment process. 'HostedPayment' will redirect the customer to a Conekta-hosted page to complete the payment, while 'Integration' allows the payment process to be handled entirely on your site using Conekta's APIs and SDKs.") + __properties: ClassVar[List[str]] = ["allowed_payment_methods", "exclude_card_networks", "plan_ids", "expires_at", "failure_url", "force_save_card", "monthly_installments_enabled", "monthly_installments_options", "max_failed_retries", "name", "on_demand_enabled", "redirection_time", "success_url", "type"] @field_validator('allowed_payment_methods') def allowed_payment_methods_validate_enum(cls, value): """Validates the enum""" for i in value: - if i not in set(['cash', 'card', 'bank_transfer', 'bnpl']): - raise ValueError("each list item must be one of ('cash', 'card', 'bank_transfer', 'bnpl')") + if i not in set(['cash', 'card', 'bank_transfer', 'bnpl', 'pay_by_bank', 'google', 'apple']): + raise ValueError("each list item must be one of ('cash', 'card', 'bank_transfer', 'bnpl', 'pay_by_bank', 'google', 'apple')") + return value + + @field_validator('exclude_card_networks') + def exclude_card_networks_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['visa', 'mastercard', 'amex']): + raise ValueError("each list item must be one of ('visa', 'mastercard', 'amex')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['Integration', 'HostedPayment']): + raise ValueError("must be one of enum values ('Integration', 'HostedPayment')") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -62,12 +88,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CheckoutRequest from a JSON string""" + """Create an instance of OrderCheckoutRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -92,7 +117,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CheckoutRequest from a dict""" + """Create an instance of OrderCheckoutRequest from a dict""" if obj is None: return None @@ -101,9 +126,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "allowed_payment_methods": obj.get("allowed_payment_methods"), + "exclude_card_networks": obj.get("exclude_card_networks"), "plan_ids": obj.get("plan_ids"), "expires_at": obj.get("expires_at"), "failure_url": obj.get("failure_url"), + "force_save_card": obj.get("force_save_card"), "monthly_installments_enabled": obj.get("monthly_installments_enabled"), "monthly_installments_options": obj.get("monthly_installments_options"), "max_failed_retries": obj.get("max_failed_retries"), diff --git a/conekta/models/order_customer_info_response.py b/conekta/models/order_customer_info_response.py deleted file mode 100644 index 799a897..0000000 --- a/conekta/models/order_customer_info_response.py +++ /dev/null @@ -1,103 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class OrderCustomerInfoResponse(BaseModel): - """ - OrderCustomerInfoResponse - """ # noqa: E501 - customer_custom_reference: Optional[StrictStr] = Field(default=None, description="Custom reference") - name: Optional[StrictStr] = None - email: Optional[StrictStr] = None - phone: Optional[StrictStr] = None - corporate: Optional[StrictBool] = False - object: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["customer_custom_reference", "name", "email", "phone", "corporate", "object"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of OrderCustomerInfoResponse from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # set to None if customer_custom_reference (nullable) is None - # and model_fields_set contains the field - if self.customer_custom_reference is None and "customer_custom_reference" in self.model_fields_set: - _dict['customer_custom_reference'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of OrderCustomerInfoResponse from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "customer_custom_reference": obj.get("customer_custom_reference"), - "name": obj.get("name"), - "email": obj.get("email"), - "phone": obj.get("phone"), - "corporate": obj.get("corporate") if obj.get("corporate") is not None else False, - "object": obj.get("object") - }) - return _obj - - diff --git a/conekta/models/order_discount_lines_request.py b/conekta/models/order_discount_lines_request.py index 74d061e..70bfe8e 100644 --- a/conekta/models/order_discount_lines_request.py +++ b/conekta/models/order_discount_lines_request.py @@ -23,18 +23,20 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderDiscountLinesRequest(BaseModel): """ List of discounts that apply to the order. """ # noqa: E501 - amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be deducted from the total sum of all payments, in cents.") - code: StrictStr = Field(description="Discount code.") - type: StrictStr = Field(description="It can be 'loyalty', 'campaign', 'coupon' o 'sign'") + amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be deducted from the total sum of all payments, in cents.", json_schema_extra={"examples": [500]}) + code: StrictStr = Field(description="Discount code.", json_schema_extra={"examples": ["123"]}) + type: StrictStr = Field(description="It can be 'loyalty', 'campaign', 'coupon' o 'sign'", json_schema_extra={"examples": ["loyalty"]}) __properties: ClassVar[List[str]] = ["amount", "code", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/order_discount_lines_response.py b/conekta/models/order_discount_lines_response.py index 5d7f6f6..1bc7d8e 100644 --- a/conekta/models/order_discount_lines_response.py +++ b/conekta/models/order_discount_lines_response.py @@ -23,18 +23,22 @@ from conekta.models.discount_lines_data_response import DiscountLinesDataResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderDiscountLinesResponse(BaseModel): """ - OrderDiscountLinesResponse + List of discounts that are applied to the order """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[DiscountLinesDataResponse]] = None - __properties: ClassVar[List[str]] = ["has_more", "object", "data"] + __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -93,6 +96,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "has_more": obj.get("has_more"), "object": obj.get("object"), + "next_page_url": obj.get("next_page_url"), + "previous_page_url": obj.get("previous_page_url"), "data": [DiscountLinesDataResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None }) return _obj diff --git a/conekta/models/order_fiscal_entity_address_response.py b/conekta/models/order_fiscal_entity_address_response.py index c68d498..edddbc0 100644 --- a/conekta/models/order_fiscal_entity_address_response.py +++ b/conekta/models/order_fiscal_entity_address_response.py @@ -22,23 +22,25 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderFiscalEntityAddressResponse(BaseModel): """ Address of the fiscal entity """ # noqa: E501 - street1: StrictStr = Field(description="Street name and number") - street2: Optional[StrictStr] = Field(default=None, description="Street name and number") - postal_code: StrictStr = Field(description="Postal code") - city: StrictStr = Field(description="City") - state: Optional[StrictStr] = Field(default=None, description="State") - country: StrictStr = Field(description="this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)") - external_number: StrictStr = Field(description="External number") - object: Optional[StrictStr] = None + street1: StrictStr = Field(description="Street name and number", json_schema_extra={"examples": ["Nuevo Leon 254"]}) + street2: Optional[StrictStr] = Field(default=None, description="Street name and number", json_schema_extra={"examples": ["Departamento 404"]}) + postal_code: StrictStr = Field(description="Postal code", json_schema_extra={"examples": ["06100"]}) + city: StrictStr = Field(description="City", json_schema_extra={"examples": ["Ciudad de Mexico"]}) + state: Optional[StrictStr] = Field(default=None, description="State", json_schema_extra={"examples": ["Ciudad de Mexico"]}) + country: StrictStr = Field(description="this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)", json_schema_extra={"examples": ["MX"]}) + external_number: StrictStr = Field(description="External number", json_schema_extra={"examples": ["123"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["fiscal_entity_address"]}) __properties: ClassVar[List[str]] = ["street1", "street2", "postal_code", "city", "state", "country", "external_number", "object"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -76,11 +77,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if street2 (nullable) is None - # and model_fields_set contains the field - if self.street2 is None and "street2" in self.model_fields_set: - _dict['street2'] = None - return _dict @classmethod diff --git a/conekta/models/order_fiscal_entity_request.py b/conekta/models/order_fiscal_entity_request.py index 8abd60c..bba9ac9 100644 --- a/conekta/models/order_fiscal_entity_request.py +++ b/conekta/models/order_fiscal_entity_request.py @@ -23,21 +23,23 @@ from conekta.models.fiscal_entity_address import FiscalEntityAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderFiscalEntityRequest(BaseModel): """ Fiscal entity of the order, Currently it is a purely informative field """ # noqa: E501 address: FiscalEntityAddress - email: Optional[StrictStr] = Field(default=None, description="Email of the fiscal entity") + email: Optional[StrictStr] = Field(default=None, description="Email of the fiscal entity", json_schema_extra={"examples": ["test@gmail.com"]}) metadata: Optional[Dict[str, Any]] = Field(default=None, description="Metadata associated with the fiscal entity") - name: Optional[StrictStr] = Field(default=None, description="Name of the fiscal entity") - phone: Optional[StrictStr] = Field(default=None, description="Phone of the fiscal entity") - tax_id: Optional[StrictStr] = Field(default=None, description="Tax ID of the fiscal entity") + name: Optional[StrictStr] = Field(default=None, description="Name of the fiscal entity", json_schema_extra={"examples": ["Conekta Inc"]}) + phone: Optional[StrictStr] = Field(default=None, description="Phone of the fiscal entity", json_schema_extra={"examples": ["+525511223344"]}) + tax_id: Optional[StrictStr] = Field(default=None, description="Tax ID of the fiscal entity", json_schema_extra={"examples": ["AAA010101AAA"]}) __properties: ClassVar[List[str]] = ["address", "email", "metadata", "name", "phone", "tax_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,16 +79,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() - # set to None if name (nullable) is None - # and model_fields_set contains the field - if self.name is None and "name" in self.model_fields_set: - _dict['name'] = None - - # set to None if tax_id (nullable) is None - # and model_fields_set contains the field - if self.tax_id is None and "tax_id" in self.model_fields_set: - _dict['tax_id'] = None - return _dict @classmethod diff --git a/conekta/models/order_fiscal_entity_response.py b/conekta/models/order_fiscal_entity_response.py index a725be6..0cd104f 100644 --- a/conekta/models/order_fiscal_entity_response.py +++ b/conekta/models/order_fiscal_entity_response.py @@ -23,24 +23,26 @@ from conekta.models.order_fiscal_entity_address_response import OrderFiscalEntityAddressResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderFiscalEntityResponse(BaseModel): """ Fiscal entity of the order, Currently it is a purely informative field """ # noqa: E501 address: OrderFiscalEntityAddressResponse - email: Optional[StrictStr] = Field(default=None, description="Email of the fiscal entity") + email: Optional[StrictStr] = Field(default=None, description="Email of the fiscal entity", json_schema_extra={"examples": ["test@gmail.com"]}) metadata: Optional[Dict[str, Any]] = Field(default=None, description="Metadata associated with the fiscal entity") - name: Optional[StrictStr] = Field(default=None, description="Name of the fiscal entity") - tax_id: Optional[StrictStr] = Field(default=None, description="Tax ID of the fiscal entity") - id: StrictStr = Field(description="ID of the fiscal entity") - created_at: StrictInt = Field(description="The time at which the object was created in seconds since the Unix epoch") - object: StrictStr - phone: Optional[StrictStr] = Field(default=None, description="Phone of the fiscal entity") + name: Optional[StrictStr] = Field(default=None, description="Name of the fiscal entity", json_schema_extra={"examples": ["Conekta Inc"]}) + tax_id: Optional[StrictStr] = Field(default=None, description="Tax ID of the fiscal entity", json_schema_extra={"examples": ["324234234"]}) + id: StrictStr = Field(description="ID of the fiscal entity", json_schema_extra={"examples": ["fis_ent_2tN85VYaSMyDvjB3M"]}) + created_at: StrictInt = Field(description="The time at which the object was created in seconds since the Unix epoch", json_schema_extra={"examples": [1676328434]}) + object: StrictStr = Field(json_schema_extra={"examples": ["fiscal_entity"]}) + phone: Optional[StrictStr] = Field(default=None, description="Phone of the fiscal entity", json_schema_extra={"examples": ["+525511223344"]}) __properties: ClassVar[List[str]] = ["address", "email", "metadata", "name", "tax_id", "id", "created_at", "object", "phone"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,26 +82,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() - # set to None if email (nullable) is None - # and model_fields_set contains the field - if self.email is None and "email" in self.model_fields_set: - _dict['email'] = None - - # set to None if name (nullable) is None - # and model_fields_set contains the field - if self.name is None and "name" in self.model_fields_set: - _dict['name'] = None - - # set to None if tax_id (nullable) is None - # and model_fields_set contains the field - if self.tax_id is None and "tax_id" in self.model_fields_set: - _dict['tax_id'] = None - - # set to None if phone (nullable) is None - # and model_fields_set contains the field - if self.phone is None and "phone" in self.model_fields_set: - _dict['phone'] = None - return _dict @classmethod diff --git a/conekta/models/order_next_action_response.py b/conekta/models/order_next_action_response.py index 026ca7a..d971098 100644 --- a/conekta/models/order_next_action_response.py +++ b/conekta/models/order_next_action_response.py @@ -23,17 +23,19 @@ from conekta.models.order_next_action_response_redirect_to_url import OrderNextActionResponseRedirectToUrl from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderNextActionResponse(BaseModel): """ contains the following attributes that will guide to continue the flow """ # noqa: E501 redirect_to_url: Optional[OrderNextActionResponseRedirectToUrl] = None - type: Optional[StrictStr] = Field(default=None, description="Indicates the type of action to be taken") + type: Optional[StrictStr] = Field(default=None, description="Indicates the type of action to be taken", json_schema_extra={"examples": ["redirect_to_url"]}) __properties: ClassVar[List[str]] = ["redirect_to_url", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/order_next_action_response_redirect_to_url.py b/conekta/models/order_next_action_response_redirect_to_url.py index d7d4864..65394a3 100644 --- a/conekta/models/order_next_action_response_redirect_to_url.py +++ b/conekta/models/order_next_action_response_redirect_to_url.py @@ -22,17 +22,19 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderNextActionResponseRedirectToUrl(BaseModel): """ contains the following attributes that will guide to continue the flow """ # noqa: E501 - url: Optional[StrictStr] = Field(default=None, description="pay.conekta.com/{id} Indicates the url of the Conekta component to authenticate the flow through 3DS2.") - return_url: Optional[StrictStr] = Field(default=None, description="Indicates the url to which the 3DS2 flow returns at the end, when the integration is redirected.") + url: Optional[StrictStr] = Field(default=None, description="pay.conekta.com/{id} Indicates the url of the Conekta component to authenticate the flow through 3DS2.", json_schema_extra={"examples": ["https://pay.conekta.com/6fca054a85194c43971ecea35cc519bb"]}) + return_url: Optional[StrictStr] = Field(default=None, description="Indicates the url to which the 3DS2 flow returns at the end, when the integration is redirected.", json_schema_extra={"examples": ["https://my-website.com\""]}) __properties: ClassVar[List[str]] = ["url", "return_url"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/order_refund_request.py b/conekta/models/order_refund_request.py index ac2b3e0..05c2cf1 100644 --- a/conekta/models/order_refund_request.py +++ b/conekta/models/order_refund_request.py @@ -22,18 +22,20 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderRefundRequest(BaseModel): """ OrderRefundRequest """ # noqa: E501 - amount: StrictInt = Field(description="Amount to be refunded in cents") - expires_at: Optional[StrictInt] = None - reason: StrictStr = Field(description="Reason for the refund") + amount: StrictInt = Field(description="Amount to be refunded in cents", json_schema_extra={"examples": [500]}) + expires_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1553273553]}) + reason: StrictStr = Field(description="Reason for the refund", json_schema_extra={"examples": ["suspected_fraud"]}) __properties: ClassVar[List[str]] = ["amount", "expires_at", "reason"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/order_request.py b/conekta/models/order_request.py index 4b6aa90..4262a36 100644 --- a/conekta/models/order_request.py +++ b/conekta/models/order_request.py @@ -22,8 +22,8 @@ from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated from conekta.models.charge_request import ChargeRequest -from conekta.models.checkout_request import CheckoutRequest -from conekta.models.customer_shipping_contacts import CustomerShippingContacts +from conekta.models.customer_shipping_contacts_request import CustomerShippingContactsRequest +from conekta.models.order_checkout_request import OrderCheckoutRequest from conekta.models.order_discount_lines_request import OrderDiscountLinesRequest from conekta.models.order_fiscal_entity_request import OrderFiscalEntityRequest from conekta.models.order_request_customer_info import OrderRequestCustomerInfo @@ -32,31 +32,33 @@ from conekta.models.shipping_request import ShippingRequest from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderRequest(BaseModel): """ a order """ # noqa: E501 charges: Optional[List[ChargeRequest]] = Field(default=None, description="List of [charges](https://developers.conekta.com/v2.2.0/reference/orderscreatecharge) that are applied to the order") - checkout: Optional[CheckoutRequest] = None - currency: Annotated[str, Field(strict=True, max_length=3)] = Field(description="Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)") + checkout: Optional[OrderCheckoutRequest] = None + currency: Annotated[str, Field(strict=True, max_length=3)] = Field(description="Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)", json_schema_extra={"examples": ["MXN"]}) customer_info: OrderRequestCustomerInfo - discount_lines: Optional[List[OrderDiscountLinesRequest]] = Field(default=None, description="List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount.") + discount_lines: Optional[List[OrderDiscountLinesRequest]] = Field(default=None, description="List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order.") fiscal_entity: Optional[OrderFiscalEntityRequest] = None line_items: List[Product] = Field(description="List of [products](https://developers.conekta.com/v2.2.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product.") metadata: Optional[Dict[str, Any]] = Field(default=None, description="Metadata associated with the order") - needs_shipping_contact: Optional[StrictBool] = Field(default=None, description="Allows you to fill out the shipping information at checkout") - pre_authorize: Optional[StrictBool] = Field(default=False, description="Indicates whether the order charges must be preauthorized") - processing_mode: Optional[StrictStr] = Field(default=None, description="Indicates the processing mode for the order, either ecommerce, recurrent or validation.") - return_url: Optional[StrictStr] = Field(default=None, description="Indicates the redirection callback upon completion of the 3DS2 flow. Do not use this parameter if your order has a checkout parameter") - shipping_contact: Optional[CustomerShippingContacts] = None + needs_shipping_contact: Optional[StrictBool] = Field(default=None, description="Allows you to fill out the shipping information at checkout", json_schema_extra={"examples": [False]}) + pre_authorize: Optional[StrictBool] = Field(default=None, description="Indicates whether the order charges must be preauthorized") + processing_mode: Optional[StrictStr] = Field(default=None, description="Indicates the processing mode for the order, either ecommerce, recurrent or validation.", json_schema_extra={"examples": ["ecommerce"]}) + return_url: Optional[StrictStr] = Field(default=None, description="Indicates the redirection callback upon completion of the 3DS2 flow. Do not use this parameter if your order has a checkout parameter", json_schema_extra={"examples": ["https://my-website.com"]}) + shipping_contact: Optional[CustomerShippingContactsRequest] = None shipping_lines: Optional[List[ShippingRequest]] = Field(default=None, description="List of [shipping costs](https://developers.conekta.com/v2.2.0/reference/orderscreateshipping). If the online store offers digital products.") tax_lines: Optional[List[OrderTaxRequest]] = Field(default=None, description="List of [taxes](https://developers.conekta.com/v2.2.0/reference/orderscreatetaxes) that are applied to the order.") - three_ds_mode: Optional[StrictStr] = Field(default=None, description="Indicates the 3DS2 mode for the order, either smart or strict.") + three_ds_mode: Optional[StrictStr] = Field(default=None, description="Indicates the 3DS2 mode for the order, either smart or strict. This property is only applicable when 3DS is enabled. When 3DS is disabled, this field should be null.") __properties: ClassVar[List[str]] = ["charges", "checkout", "currency", "customer_info", "discount_lines", "fiscal_entity", "line_items", "metadata", "needs_shipping_contact", "pre_authorize", "processing_mode", "return_url", "shipping_contact", "shipping_lines", "tax_lines", "three_ds_mode"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -68,8 +70,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -154,7 +155,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "charges": [ChargeRequest.from_dict(_item) for _item in obj["charges"]] if obj.get("charges") is not None else None, - "checkout": CheckoutRequest.from_dict(obj["checkout"]) if obj.get("checkout") is not None else None, + "checkout": OrderCheckoutRequest.from_dict(obj["checkout"]) if obj.get("checkout") is not None else None, "currency": obj.get("currency"), "customer_info": OrderRequestCustomerInfo.from_dict(obj["customer_info"]) if obj.get("customer_info") is not None else None, "discount_lines": [OrderDiscountLinesRequest.from_dict(_item) for _item in obj["discount_lines"]] if obj.get("discount_lines") is not None else None, @@ -162,10 +163,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "line_items": [Product.from_dict(_item) for _item in obj["line_items"]] if obj.get("line_items") is not None else None, "metadata": obj.get("metadata"), "needs_shipping_contact": obj.get("needs_shipping_contact"), - "pre_authorize": obj.get("pre_authorize") if obj.get("pre_authorize") is not None else False, + "pre_authorize": obj.get("pre_authorize"), "processing_mode": obj.get("processing_mode"), "return_url": obj.get("return_url"), - "shipping_contact": CustomerShippingContacts.from_dict(obj["shipping_contact"]) if obj.get("shipping_contact") is not None else None, + "shipping_contact": CustomerShippingContactsRequest.from_dict(obj["shipping_contact"]) if obj.get("shipping_contact") is not None else None, "shipping_lines": [ShippingRequest.from_dict(_item) for _item in obj["shipping_lines"]] if obj.get("shipping_lines") is not None else None, "tax_lines": [OrderTaxRequest.from_dict(_item) for _item in obj["tax_lines"]] if obj.get("tax_lines") is not None else None, "three_ds_mode": obj.get("three_ds_mode") diff --git a/conekta/models/order_request_customer_info.py b/conekta/models/order_request_customer_info.py index 6418410..3c48ae1 100644 --- a/conekta/models/order_request_customer_info.py +++ b/conekta/models/order_request_customer_info.py @@ -19,12 +19,12 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional from conekta.models.customer_info import CustomerInfo -from conekta.models.customer_info_just_customer_id import CustomerInfoJustCustomerId +from conekta.models.customer_info_customer_id import CustomerInfoCustomerId from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -ORDERREQUESTCUSTOMERINFO_ONE_OF_SCHEMAS = ["CustomerInfo", "CustomerInfoJustCustomerId"] +ORDERREQUESTCUSTOMERINFO_ONE_OF_SCHEMAS = ["CustomerInfo", "CustomerInfoCustomerId"] class OrderRequestCustomerInfo(BaseModel): """ @@ -32,10 +32,10 @@ class OrderRequestCustomerInfo(BaseModel): """ # data type: CustomerInfo oneof_schema_1_validator: Optional[CustomerInfo] = None - # data type: CustomerInfoJustCustomerId - oneof_schema_2_validator: Optional[CustomerInfoJustCustomerId] = None - actual_instance: Optional[Union[CustomerInfo, CustomerInfoJustCustomerId]] = None - one_of_schemas: Set[str] = { "CustomerInfo", "CustomerInfoJustCustomerId" } + # data type: CustomerInfoCustomerId + oneof_schema_2_validator: Optional[CustomerInfoCustomerId] = None + actual_instance: Optional[Union[CustomerInfo, CustomerInfoCustomerId]] = None + one_of_schemas: Set[str] = { "CustomerInfo", "CustomerInfoCustomerId" } model_config = ConfigDict( validate_assignment=True, @@ -63,17 +63,17 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `CustomerInfo`") else: match += 1 - # validate data type: CustomerInfoJustCustomerId - if not isinstance(v, CustomerInfoJustCustomerId): - error_messages.append(f"Error! Input type `{type(v)}` is not `CustomerInfoJustCustomerId`") + # validate data type: CustomerInfoCustomerId + if not isinstance(v, CustomerInfoCustomerId): + error_messages.append(f"Error! Input type `{type(v)}` is not `CustomerInfoCustomerId`") else: match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in OrderRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in OrderRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoCustomerId. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in OrderRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in OrderRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoCustomerId. Details: " + ", ".join(error_messages)) else: return v @@ -94,19 +94,19 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into CustomerInfoJustCustomerId + # deserialize data into CustomerInfoCustomerId try: - instance.actual_instance = CustomerInfoJustCustomerId.from_json(json_str) + instance.actual_instance = CustomerInfoCustomerId.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into OrderRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into OrderRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoCustomerId. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into OrderRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into OrderRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoCustomerId. Details: " + ", ".join(error_messages)) else: return instance @@ -120,7 +120,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], CustomerInfo, CustomerInfoJustCustomerId]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], CustomerInfo, CustomerInfoCustomerId]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/order_response.py b/conekta/models/order_response.py index adfcf29..f70115a 100644 --- a/conekta/models/order_response.py +++ b/conekta/models/order_response.py @@ -29,38 +29,44 @@ from conekta.models.order_response_customer_info import OrderResponseCustomerInfo from conekta.models.order_response_products import OrderResponseProducts from conekta.models.order_response_shipping_contact import OrderResponseShippingContact +from conekta.models.order_shipping_lines_response import OrderShippingLinesResponse +from conekta.models.order_tax_lines_response import OrderTaxLinesResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderResponse(BaseModel): """ order response """ # noqa: E501 - amount: Optional[StrictInt] = Field(default=None, description="The total amount to be collected in cents") - amount_refunded: Optional[StrictInt] = Field(default=None, description="The total amount refunded in cents") + amount: Optional[StrictInt] = Field(default=None, description="The total amount to be collected in cents", json_schema_extra={"examples": [21605]}) + amount_refunded: Optional[StrictInt] = Field(default=None, description="The total amount refunded in cents", json_schema_extra={"examples": [0]}) channel: Optional[OrderChannelResponse] = None charges: Optional[OrderChargesResponse] = None checkout: Optional[OrderResponseCheckout] = None - created_at: Optional[StrictInt] = Field(default=None, description="The time at which the object was created in seconds since the Unix epoch") - currency: Optional[StrictStr] = Field(default=None, description="The three-letter ISO 4217 currency code. The currency of the order.") + created_at: Optional[StrictInt] = Field(default=None, description="The time at which the object was created in seconds since the Unix epoch", json_schema_extra={"examples": [1676328434]}) + currency: Optional[StrictStr] = Field(default=None, description="The three-letter ISO 4217 currency code. The currency of the order.", json_schema_extra={"examples": ["MXN"]}) customer_info: Optional[OrderResponseCustomerInfo] = None discount_lines: Optional[OrderDiscountLinesResponse] = None + tax_lines: Optional[OrderTaxLinesResponse] = None + shipping_lines: Optional[OrderShippingLinesResponse] = None fiscal_entity: Optional[OrderFiscalEntityResponse] = None - id: Optional[StrictStr] = None - is_refundable: Optional[StrictBool] = None + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["ord_2tMtQQpDvfnNjiuFG"]}) + is_refundable: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) line_items: Optional[OrderResponseProducts] = None - livemode: Optional[StrictBool] = Field(default=None, description="Whether the object exists in live mode or test mode") + livemode: Optional[StrictBool] = Field(default=None, description="Whether the object exists in live mode or test mode", json_schema_extra={"examples": [False]}) metadata: Optional[Dict[str, Any]] = Field(default=None, description="Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.") next_action: Optional[OrderNextActionResponse] = None - object: Optional[StrictStr] = Field(default=None, description="String representing the object’s type. Objects of the same type share the same value.") - payment_status: Optional[StrictStr] = Field(default=None, description="The payment status of the order.") - processing_mode: Optional[StrictStr] = Field(default=None, description="Indicates the processing mode for the order, either ecommerce, recurrent or validation.") + object: Optional[StrictStr] = Field(default=None, description="String representing the object’s type. Objects of the same type share the same value.", json_schema_extra={"examples": ["order"]}) + payment_status: Optional[StrictStr] = Field(default=None, description="The payment status of the order.", json_schema_extra={"examples": ["paid"]}) + processing_mode: Optional[StrictStr] = Field(default=None, description="Indicates the processing mode for the order, either ecommerce, recurrent or validation.", json_schema_extra={"examples": ["ecommerce"]}) shipping_contact: Optional[OrderResponseShippingContact] = None - updated_at: Optional[StrictInt] = Field(default=None, description="The time at which the object was last updated in seconds since the Unix epoch") - __properties: ClassVar[List[str]] = ["amount", "amount_refunded", "channel", "charges", "checkout", "created_at", "currency", "customer_info", "discount_lines", "fiscal_entity", "id", "is_refundable", "line_items", "livemode", "metadata", "next_action", "object", "payment_status", "processing_mode", "shipping_contact", "updated_at"] + updated_at: Optional[StrictInt] = Field(default=None, description="The time at which the object was last updated in seconds since the Unix epoch", json_schema_extra={"examples": [1676328434]}) + __properties: ClassVar[List[str]] = ["amount", "amount_refunded", "channel", "charges", "checkout", "created_at", "currency", "customer_info", "discount_lines", "tax_lines", "shipping_lines", "fiscal_entity", "id", "is_refundable", "line_items", "livemode", "metadata", "next_action", "object", "payment_status", "processing_mode", "shipping_contact", "updated_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -72,8 +78,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -113,6 +118,12 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of discount_lines if self.discount_lines: _dict['discount_lines'] = self.discount_lines.to_dict() + # override the default output from pydantic by calling `to_dict()` of tax_lines + if self.tax_lines: + _dict['tax_lines'] = self.tax_lines.to_dict() + # override the default output from pydantic by calling `to_dict()` of shipping_lines + if self.shipping_lines: + _dict['shipping_lines'] = self.shipping_lines.to_dict() # override the default output from pydantic by calling `to_dict()` of fiscal_entity if self.fiscal_entity: _dict['fiscal_entity'] = self.fiscal_entity.to_dict() @@ -125,11 +136,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of shipping_contact if self.shipping_contact: _dict['shipping_contact'] = self.shipping_contact.to_dict() - # set to None if fiscal_entity (nullable) is None - # and model_fields_set contains the field - if self.fiscal_entity is None and "fiscal_entity" in self.model_fields_set: - _dict['fiscal_entity'] = None - return _dict @classmethod @@ -151,6 +157,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "currency": obj.get("currency"), "customer_info": OrderResponseCustomerInfo.from_dict(obj["customer_info"]) if obj.get("customer_info") is not None else None, "discount_lines": OrderDiscountLinesResponse.from_dict(obj["discount_lines"]) if obj.get("discount_lines") is not None else None, + "tax_lines": OrderTaxLinesResponse.from_dict(obj["tax_lines"]) if obj.get("tax_lines") is not None else None, + "shipping_lines": OrderShippingLinesResponse.from_dict(obj["shipping_lines"]) if obj.get("shipping_lines") is not None else None, "fiscal_entity": OrderFiscalEntityResponse.from_dict(obj["fiscal_entity"]) if obj.get("fiscal_entity") is not None else None, "id": obj.get("id"), "is_refundable": obj.get("is_refundable"), diff --git a/conekta/models/order_response_checkout.py b/conekta/models/order_response_checkout.py index 2ad9ff1..aeb2921 100644 --- a/conekta/models/order_response_checkout.py +++ b/conekta/models/order_response_checkout.py @@ -18,47 +18,61 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderResponseCheckout(BaseModel): """ OrderResponseCheckout """ # noqa: E501 - allowed_payment_methods: Optional[List[StrictStr]] = Field(default=None, description="Are the payment methods available for this link") - can_not_expire: Optional[StrictBool] = None - emails_sent: Optional[StrictInt] = None - exclude_card_networks: Optional[List[Dict[str, Any]]] = None - expires_at: Optional[StrictInt] = None - failure_url: Optional[StrictStr] = None - force_3ds_flow: Optional[StrictBool] = None - id: Optional[StrictStr] = None - is_redirect_on_failure: Optional[StrictBool] = None - livemode: Optional[StrictBool] = None - max_failed_retries: Optional[StrictInt] = Field(default=None, description="Number of retries allowed before the checkout is marked as failed") + allowed_payment_methods: List[StrictStr] = Field(description="Are the payment methods available for this link", json_schema_extra={"examples": [["cash", "card", "bank_transfer", "bnpl", "pay_by_bank", "apple", "google"]]}) + can_not_expire: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + emails_sent: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) + exclude_card_networks: Optional[List[StrictStr]] = Field(default=None, json_schema_extra={"examples": [["visa", "amex"]]}) + expires_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1676613599]}) + failure_url: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx"]}) + force_3ds_flow: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + force_save_card: Optional[StrictBool] = Field(default=None, description="Indicates whether the card used for the payment should be saved for future purchases. This field is only applicable for card payments.", json_schema_extra={"examples": [False]}) + id: StrictStr = Field(json_schema_extra={"examples": ["6fca054a-8519-4c43-971e-cea35cc519bb"]}) + is_redirect_on_failure: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + livemode: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + max_failed_retries: Optional[StrictInt] = Field(default=None, description="Number of retries allowed before the checkout is marked as failed", json_schema_extra={"examples": [3]}) metadata: Optional[Dict[str, Any]] = None - monthly_installments_enabled: Optional[StrictBool] = None + monthly_installments_enabled: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) monthly_installments_options: Optional[List[StrictInt]] = None - name: Optional[StrictStr] = None - needs_shipping_contact: Optional[StrictBool] = None - object: Optional[StrictStr] = None - on_demand_enabled: Optional[StrictBool] = None - paid_payments_count: Optional[StrictInt] = None - recurrent: Optional[StrictBool] = None - redirection_time: Optional[StrictInt] = Field(default=None, description="number of seconds to wait before redirecting to the success_url") - slug: Optional[StrictStr] = None - sms_sent: Optional[StrictInt] = None - success_url: Optional[StrictStr] = None - starts_at: Optional[StrictInt] = None - status: Optional[StrictStr] = None - type: Optional[StrictStr] = None - url: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["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"] + name: StrictStr = Field(json_schema_extra={"examples": ["ord-2tNDzhA4Akmzj11AS"]}) + needs_shipping_contact: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + object: StrictStr = Field(json_schema_extra={"examples": ["checkout"]}) + on_demand_enabled: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + paid_payments_count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) + recurrent: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + redirection_time: Optional[StrictInt] = Field(default=None, description="number of seconds to wait before redirecting to the success_url", json_schema_extra={"examples": [2]}) + slug: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6fca054a85194c43971ecea35cc519bb"]}) + sms_sent: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) + success_url: Optional[StrictStr] = Field(default=None, description="Redirection url back to the site in case of successful payment, applies only to HostedPayment", json_schema_extra={"examples": ["http://187.216.228.66:2222/SysVentasPagos/Acceso.aspx"]}) + starts_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1676354400]}) + status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Issued"]}) + type: StrictStr = Field(description="This field represents the type of checkout, which determines the user experience during the payment process. 'HostedPayment' will redirect the customer to a Conekta-hosted page to complete the payment, while 'Integration' allows the payment process to be handled entirely on your site using Conekta's APIs and SDKs.", json_schema_extra={"examples": ["HostedPayment"]}) + url: Optional[StrictStr] = Field(default=None, description="Indicate the url of the Conekta component to complete the payment. For HostedPayment, this will be a Conekta-hosted page", json_schema_extra={"examples": ["https://pay.conekta.io/checkout/6fca054a85194c43971ecea35cc519bb"]}) + __properties: ClassVar[List[str]] = ["allowed_payment_methods", "can_not_expire", "emails_sent", "exclude_card_networks", "expires_at", "failure_url", "force_3ds_flow", "force_save_card", "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"] + + @field_validator('exclude_card_networks') + def exclude_card_networks_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['visa', 'mastercard', 'amex']): + raise ValueError("each list item must be one of ('visa', 'mastercard', 'amex')") + return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -70,8 +84,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -96,21 +109,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if max_failed_retries (nullable) is None - # and model_fields_set contains the field - if self.max_failed_retries is None and "max_failed_retries" in self.model_fields_set: - _dict['max_failed_retries'] = None - - # set to None if on_demand_enabled (nullable) is None - # and model_fields_set contains the field - if self.on_demand_enabled is None and "on_demand_enabled" in self.model_fields_set: - _dict['on_demand_enabled'] = None - - # set to None if redirection_time (nullable) is None - # and model_fields_set contains the field - if self.redirection_time is None and "redirection_time" in self.model_fields_set: - _dict['redirection_time'] = None - return _dict @classmethod @@ -130,6 +128,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "expires_at": obj.get("expires_at"), "failure_url": obj.get("failure_url"), "force_3ds_flow": obj.get("force_3ds_flow"), + "force_save_card": obj.get("force_save_card"), "id": obj.get("id"), "is_redirect_on_failure": obj.get("is_redirect_on_failure"), "livemode": obj.get("livemode"), diff --git a/conekta/models/order_response_customer_info.py b/conekta/models/order_response_customer_info.py index c7e16ce..7c61dea 100644 --- a/conekta/models/order_response_customer_info.py +++ b/conekta/models/order_response_customer_info.py @@ -22,22 +22,24 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderResponseCustomerInfo(BaseModel): """ OrderResponseCustomerInfo """ # noqa: E501 - customer_custom_reference: Optional[StrictStr] = Field(default=None, description="Custom reference") - name: Optional[StrictStr] = None - email: Optional[StrictStr] = None - phone: Optional[StrictStr] = None + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["customer_info"]}) + customer_custom_reference: Optional[StrictStr] = Field(default=None, description="Custom reference", json_schema_extra={"examples": ["custom_reference"]}) + name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["DevTest"]}) + email: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["test@conekta.com"]}) + phone: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["5522997233"]}) corporate: Optional[StrictBool] = False - object: Optional[StrictStr] = None - customer_id: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["customer_custom_reference", "name", "email", "phone", "corporate", "object", "customer_id"] + customer_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_23874283647"]}) + __properties: ClassVar[List[str]] = ["object", "customer_custom_reference", "name", "email", "phone", "corporate", "customer_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -75,11 +76,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if customer_custom_reference (nullable) is None - # and model_fields_set contains the field - if self.customer_custom_reference is None and "customer_custom_reference" in self.model_fields_set: - _dict['customer_custom_reference'] = None - return _dict @classmethod @@ -92,12 +88,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "object": obj.get("object"), "customer_custom_reference": obj.get("customer_custom_reference"), "name": obj.get("name"), "email": obj.get("email"), "phone": obj.get("phone"), "corporate": obj.get("corporate") if obj.get("corporate") is not None else False, - "object": obj.get("object"), "customer_id": obj.get("customer_id") }) return _obj diff --git a/conekta/models/order_response_products.py b/conekta/models/order_response_products.py index f9f038b..b087209 100644 --- a/conekta/models/order_response_products.py +++ b/conekta/models/order_response_products.py @@ -23,20 +23,22 @@ from conekta.models.product_data_response import ProductDataResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderResponseProducts(BaseModel): """ OrderResponseProducts """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[ProductDataResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/order_response_shipping_contact.py b/conekta/models/order_response_shipping_contact.py index 124f76d..35a5e7e 100644 --- a/conekta/models/order_response_shipping_contact.py +++ b/conekta/models/order_response_shipping_contact.py @@ -20,29 +20,31 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_shipping_contacts_response_address import CustomerShippingContactsResponseAddress +from conekta.models.customer_shipping_contacts_address import CustomerShippingContactsAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderResponseShippingContact(BaseModel): """ OrderResponseShippingContact """ # noqa: E501 - phone: Optional[StrictStr] = None - receiver: Optional[StrictStr] = None - between_streets: Optional[StrictStr] = None - address: Optional[CustomerShippingContactsResponseAddress] = None + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1675715413]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["adr_1234567890"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["shipping_contact"]}) + phone: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["+525511223344"]}) + receiver: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Marvin Fuller"]}) + between_streets: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Ackerman Crescent"]}) + address: Optional[CustomerShippingContactsAddress] = None parent_id: Optional[StrictStr] = None - default: Optional[StrictBool] = None - id: Optional[StrictStr] = None - created_at: Optional[StrictInt] = None + default: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) metadata: Optional[Dict[str, Any]] = Field(default=None, description="Metadata associated with the shipping contact") - object: Optional[StrictStr] = None - deleted: Optional[StrictBool] = None - __properties: ClassVar[List[str]] = ["phone", "receiver", "between_streets", "address", "parent_id", "default", "id", "created_at", "metadata", "object", "deleted"] + deleted: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + __properties: ClassVar[List[str]] = ["created_at", "id", "object", "phone", "receiver", "between_streets", "address", "parent_id", "default", "metadata", "deleted"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -83,11 +84,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() - # set to None if between_streets (nullable) is None - # and model_fields_set contains the field - if self.between_streets is None and "between_streets" in self.model_fields_set: - _dict['between_streets'] = None - return _dict @classmethod @@ -100,16 +96,16 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "created_at": obj.get("created_at"), + "id": obj.get("id"), + "object": obj.get("object"), "phone": obj.get("phone"), "receiver": obj.get("receiver"), "between_streets": obj.get("between_streets"), - "address": CustomerShippingContactsResponseAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": CustomerShippingContactsAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "parent_id": obj.get("parent_id"), "default": obj.get("default"), - "id": obj.get("id"), - "created_at": obj.get("created_at"), "metadata": obj.get("metadata"), - "object": obj.get("object"), "deleted": obj.get("deleted") }) return _obj diff --git a/conekta/models/pagination.py b/conekta/models/order_shipping_lines_response.py similarity index 53% rename from conekta/models/pagination.py rename to conekta/models/order_shipping_lines_response.py index 5d4e5a9..b9fa5f9 100644 --- a/conekta/models/pagination.py +++ b/conekta/models/order_shipping_lines_response.py @@ -19,20 +19,26 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict, List, Optional +from conekta.models.shipping_lines_data_response import ShippingLinesDataResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class Pagination(BaseModel): +class OrderShippingLinesResponse(BaseModel): """ - pagination metadata + List of shipping costs applied to the order """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - __properties: ClassVar[List[str]] = ["has_more", "object"] + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) + data: Optional[List[ShippingLinesDataResponse]] = None + __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,12 +50,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of Pagination from a JSON string""" + """Create an instance of OrderShippingLinesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -70,11 +75,18 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # override the default output from pydantic by calling `to_dict()` of each item in data (list) + _items = [] + if self.data: + for _item_data in self.data: + if _item_data: + _items.append(_item_data.to_dict()) + _dict['data'] = _items return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of Pagination from a dict""" + """Create an instance of OrderShippingLinesResponse from a dict""" if obj is None: return None @@ -83,7 +95,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "has_more": obj.get("has_more"), - "object": obj.get("object") + "object": obj.get("object"), + "next_page_url": obj.get("next_page_url"), + "previous_page_url": obj.get("previous_page_url"), + "data": [ShippingLinesDataResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None }) return _obj diff --git a/conekta/models/orders_response.py b/conekta/models/order_tax_lines_response.py similarity index 55% rename from conekta/models/orders_response.py rename to conekta/models/order_tax_lines_response.py index dad1f28..4f4383b 100644 --- a/conekta/models/orders_response.py +++ b/conekta/models/order_tax_lines_response.py @@ -18,21 +18,27 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict -from typing import Any, ClassVar, Dict, List -from conekta.models.order_response import OrderResponse +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from conekta.models.tax_lines_data_response import TaxLinesDataResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class OrdersResponse(BaseModel): +class OrderTaxLinesResponse(BaseModel): """ - OrdersResponse + List of taxes that are applied to the order """ # noqa: E501 - data: List[OrderResponse] - __properties: ClassVar[List[str]] = ["data"] + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) + data: Optional[List[TaxLinesDataResponse]] = None + __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,12 +50,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of OrdersResponse from a JSON string""" + """Create an instance of OrderTaxLinesResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -81,7 +86,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of OrdersResponse from a dict""" + """Create an instance of OrderTaxLinesResponse from a dict""" if obj is None: return None @@ -89,7 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "data": [OrderResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None + "has_more": obj.get("has_more"), + "object": obj.get("object"), + "next_page_url": obj.get("next_page_url"), + "previous_page_url": obj.get("previous_page_url"), + "data": [TaxLinesDataResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None }) return _obj diff --git a/conekta/models/order_tax_request.py b/conekta/models/order_tax_request.py index fcfbcbd..57d7d51 100644 --- a/conekta/models/order_tax_request.py +++ b/conekta/models/order_tax_request.py @@ -23,18 +23,20 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderTaxRequest(BaseModel): """ create new taxes for an existing order """ # noqa: E501 - amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be collected for tax in cents") - description: Annotated[str, Field(min_length=2, strict=True)] = Field(description="description or tax's name") - metadata: Optional[Dict[str, Any]] = None + amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be collected for tax in cents", json_schema_extra={"examples": [100]}) + description: Annotated[str, Field(min_length=2, strict=True)] = Field(description="description or tax's name", json_schema_extra={"examples": ["testing"]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"key": "value"}]}) __properties: ClassVar[List[str]] = ["amount", "description", "metadata"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/update_order_tax_response.py b/conekta/models/order_tax_response.py similarity index 72% rename from conekta/models/update_order_tax_response.py rename to conekta/models/order_tax_response.py index 1d8773a..23c3876 100644 --- a/conekta/models/update_order_tax_response.py +++ b/conekta/models/order_tax_response.py @@ -23,21 +23,23 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class UpdateOrderTaxResponse(BaseModel): +class OrderTaxResponse(BaseModel): """ create new taxes for an existing order response """ # noqa: E501 - amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be collected for tax in cents") - description: Annotated[str, Field(min_length=2, strict=True)] = Field(description="description or tax's name") - metadata: Optional[Dict[str, Any]] = None - id: StrictStr - object: Optional[StrictStr] = None - parent_id: Optional[StrictStr] = None + amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be collected for tax in cents", json_schema_extra={"examples": [100]}) + description: Annotated[str, Field(min_length=2, strict=True)] = Field(description="description or tax's name", json_schema_extra={"examples": ["testing"]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"key": "value"}]}) + id: StrictStr = Field(json_schema_extra={"examples": ["tax_lin_2tQ8dC5mg1UADmVPo"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["tax_line"]}) + parent_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["ord_2tPAmKCEJqh8RE6nY"]}) __properties: ClassVar[List[str]] = ["amount", "description", "metadata", "id", "object", "parent_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,12 +51,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of UpdateOrderTaxResponse from a JSON string""" + """Create an instance of OrderTaxResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -79,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of UpdateOrderTaxResponse from a dict""" + """Create an instance of OrderTaxResponse from a dict""" if obj is None: return None diff --git a/conekta/models/order_update_request.py b/conekta/models/order_update.py similarity index 80% rename from conekta/models/order_update_request.py rename to conekta/models/order_update.py index 9d9235c..9286b82 100644 --- a/conekta/models/order_update_request.py +++ b/conekta/models/order_update.py @@ -18,41 +18,43 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool from typing import Any, ClassVar, Dict, List, Optional from typing_extensions import Annotated from conekta.models.charge_request import ChargeRequest -from conekta.models.checkout_request import CheckoutRequest -from conekta.models.customer_shipping_contacts import CustomerShippingContacts +from conekta.models.customer_shipping_contacts_request import CustomerShippingContactsRequest +from conekta.models.order_checkout_request import OrderCheckoutRequest from conekta.models.order_discount_lines_request import OrderDiscountLinesRequest from conekta.models.order_tax_request import OrderTaxRequest +from conekta.models.order_update_customer_info import OrderUpdateCustomerInfo from conekta.models.order_update_fiscal_entity_request import OrderUpdateFiscalEntityRequest -from conekta.models.order_update_request_customer_info import OrderUpdateRequestCustomerInfo from conekta.models.product import Product from conekta.models.shipping_request import ShippingRequest from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class OrderUpdateRequest(BaseModel): +class OrderUpdate(BaseModel): """ a order """ # noqa: E501 charges: Optional[List[ChargeRequest]] = None - checkout: Optional[CheckoutRequest] = None - currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)") - customer_info: Optional[OrderUpdateRequestCustomerInfo] = None - discount_lines: Optional[List[OrderDiscountLinesRequest]] = Field(default=None, description="List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount.") + checkout: Optional[OrderCheckoutRequest] = None + currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)", json_schema_extra={"examples": ["MXN"]}) + customer_info: Optional[OrderUpdateCustomerInfo] = None + discount_lines: Optional[List[OrderDiscountLinesRequest]] = Field(default=None, description="List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order.") fiscal_entity: Optional[OrderUpdateFiscalEntityRequest] = None line_items: Optional[List[Product]] = Field(default=None, description="List of [products](https://developers.conekta.com/v2.2.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product.") - metadata: Optional[Dict[str, StrictStr]] = None - pre_authorize: Optional[StrictBool] = Field(default=False, description="Indicates whether the order charges must be preauthorized") - shipping_contact: Optional[CustomerShippingContacts] = None + metadata: Optional[Any] = None + pre_authorize: Optional[StrictBool] = Field(default=None, description="Indicates whether the order charges must be preauthorized") + shipping_contact: Optional[CustomerShippingContactsRequest] = None shipping_lines: Optional[List[ShippingRequest]] = Field(default=None, description="List of [shipping costs](https://developers.conekta.com/v2.2.0/reference/orderscreateshipping). If the online store offers digital products.") tax_lines: Optional[List[OrderTaxRequest]] = None __properties: ClassVar[List[str]] = ["charges", "checkout", "currency", "customer_info", "discount_lines", "fiscal_entity", "line_items", "metadata", "pre_authorize", "shipping_contact", "shipping_lines", "tax_lines"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -64,12 +66,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of OrderUpdateRequest from a JSON string""" + """Create an instance of OrderUpdate from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -137,11 +138,16 @@ def to_dict(self) -> Dict[str, Any]: if _item_tax_lines: _items.append(_item_tax_lines.to_dict()) _dict['tax_lines'] = _items + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of OrderUpdateRequest from a dict""" + """Create an instance of OrderUpdate from a dict""" if obj is None: return None @@ -150,15 +156,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "charges": [ChargeRequest.from_dict(_item) for _item in obj["charges"]] if obj.get("charges") is not None else None, - "checkout": CheckoutRequest.from_dict(obj["checkout"]) if obj.get("checkout") is not None else None, + "checkout": OrderCheckoutRequest.from_dict(obj["checkout"]) if obj.get("checkout") is not None else None, "currency": obj.get("currency"), - "customer_info": OrderUpdateRequestCustomerInfo.from_dict(obj["customer_info"]) if obj.get("customer_info") is not None else None, + "customer_info": OrderUpdateCustomerInfo.from_dict(obj["customer_info"]) if obj.get("customer_info") is not None else None, "discount_lines": [OrderDiscountLinesRequest.from_dict(_item) for _item in obj["discount_lines"]] if obj.get("discount_lines") is not None else None, "fiscal_entity": OrderUpdateFiscalEntityRequest.from_dict(obj["fiscal_entity"]) if obj.get("fiscal_entity") is not None else None, "line_items": [Product.from_dict(_item) for _item in obj["line_items"]] if obj.get("line_items") is not None else None, - "metadata": obj.get("metadata"), - "pre_authorize": obj.get("pre_authorize") if obj.get("pre_authorize") is not None else False, - "shipping_contact": CustomerShippingContacts.from_dict(obj["shipping_contact"]) if obj.get("shipping_contact") is not None else None, + "pre_authorize": obj.get("pre_authorize"), + "shipping_contact": CustomerShippingContactsRequest.from_dict(obj["shipping_contact"]) if obj.get("shipping_contact") is not None else None, "shipping_lines": [ShippingRequest.from_dict(_item) for _item in obj["shipping_lines"]] if obj.get("shipping_lines") is not None else None, "tax_lines": [OrderTaxRequest.from_dict(_item) for _item in obj["tax_lines"]] if obj.get("tax_lines") is not None else None }) diff --git a/conekta/models/order_update_request_customer_info.py b/conekta/models/order_update_customer_info.py similarity index 71% rename from conekta/models/order_update_request_customer_info.py rename to conekta/models/order_update_customer_info.py index 5b280be..6b292ab 100644 --- a/conekta/models/order_update_request_customer_info.py +++ b/conekta/models/order_update_customer_info.py @@ -19,23 +19,23 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator from typing import Any, List, Optional from conekta.models.customer_info import CustomerInfo -from conekta.models.customer_info_just_customer_id import CustomerInfoJustCustomerId +from conekta.models.customer_info_customer_id import CustomerInfoCustomerId from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -ORDERUPDATEREQUESTCUSTOMERINFO_ONE_OF_SCHEMAS = ["CustomerInfo", "CustomerInfoJustCustomerId"] +ORDERUPDATECUSTOMERINFO_ONE_OF_SCHEMAS = ["CustomerInfo", "CustomerInfoCustomerId"] -class OrderUpdateRequestCustomerInfo(BaseModel): +class OrderUpdateCustomerInfo(BaseModel): """ - OrderUpdateRequestCustomerInfo + OrderUpdateCustomerInfo """ # data type: CustomerInfo oneof_schema_1_validator: Optional[CustomerInfo] = None - # data type: CustomerInfoJustCustomerId - oneof_schema_2_validator: Optional[CustomerInfoJustCustomerId] = None - actual_instance: Optional[Union[CustomerInfo, CustomerInfoJustCustomerId]] = None - one_of_schemas: Set[str] = { "CustomerInfo", "CustomerInfoJustCustomerId" } + # data type: CustomerInfoCustomerId + oneof_schema_2_validator: Optional[CustomerInfoCustomerId] = None + actual_instance: Optional[Union[CustomerInfo, CustomerInfoCustomerId]] = None + one_of_schemas: Set[str] = { "CustomerInfo", "CustomerInfoCustomerId" } model_config = ConfigDict( validate_assignment=True, @@ -55,7 +55,7 @@ def __init__(self, *args, **kwargs) -> None: @field_validator('actual_instance') def actual_instance_must_validate_oneof(cls, v): - instance = OrderUpdateRequestCustomerInfo.model_construct() + instance = OrderUpdateCustomerInfo.model_construct() error_messages = [] match = 0 # validate data type: CustomerInfo @@ -63,17 +63,17 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `CustomerInfo`") else: match += 1 - # validate data type: CustomerInfoJustCustomerId - if not isinstance(v, CustomerInfoJustCustomerId): - error_messages.append(f"Error! Input type `{type(v)}` is not `CustomerInfoJustCustomerId`") + # validate data type: CustomerInfoCustomerId + if not isinstance(v, CustomerInfoCustomerId): + error_messages.append(f"Error! Input type `{type(v)}` is not `CustomerInfoCustomerId`") else: match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in OrderUpdateRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in OrderUpdateCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoCustomerId. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in OrderUpdateRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in OrderUpdateCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoCustomerId. Details: " + ", ".join(error_messages)) else: return v @@ -94,19 +94,19 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into CustomerInfoJustCustomerId + # deserialize data into CustomerInfoCustomerId try: - instance.actual_instance = CustomerInfoJustCustomerId.from_json(json_str) + instance.actual_instance = CustomerInfoCustomerId.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into OrderUpdateRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into OrderUpdateCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoCustomerId. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into OrderUpdateRequestCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoJustCustomerId. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into OrderUpdateCustomerInfo with oneOf schemas: CustomerInfo, CustomerInfoCustomerId. Details: " + ", ".join(error_messages)) else: return instance @@ -120,7 +120,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], CustomerInfo, CustomerInfoJustCustomerId]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], CustomerInfo, CustomerInfoCustomerId]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/order_update_fiscal_entity_request.py b/conekta/models/order_update_fiscal_entity_request.py index 7744718..da8f336 100644 --- a/conekta/models/order_update_fiscal_entity_request.py +++ b/conekta/models/order_update_fiscal_entity_request.py @@ -23,21 +23,23 @@ from conekta.models.fiscal_entity_address import FiscalEntityAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderUpdateFiscalEntityRequest(BaseModel): """ Fiscal entity of the order, Currently it is a purely informative field """ # noqa: E501 address: FiscalEntityAddress - email: Optional[StrictStr] = Field(default=None, description="Email of the fiscal entity") - name: Optional[StrictStr] = Field(default=None, description="Name of the fiscal entity") + email: Optional[StrictStr] = Field(default=None, description="Email of the fiscal entity", json_schema_extra={"examples": ["test@gmail.com"]}) + name: Optional[StrictStr] = Field(default=None, description="Name of the fiscal entity", json_schema_extra={"examples": ["Conekta Inc"]}) metadata: Optional[Dict[str, Any]] = Field(default=None, description="Metadata associated with the fiscal entity") - phone: Optional[StrictStr] = Field(default=None, description="Phone of the fiscal entity") - tax_id: Optional[StrictStr] = Field(default=None, description="Tax ID of the fiscal entity") + phone: Optional[StrictStr] = Field(default=None, description="Phone of the fiscal entity", json_schema_extra={"examples": ["+525511223344"]}) + tax_id: Optional[StrictStr] = Field(default=None, description="Tax ID of the fiscal entity", json_schema_extra={"examples": ["AAA010101AAA"]}) __properties: ClassVar[List[str]] = ["address", "email", "name", "metadata", "phone", "tax_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,16 +79,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() - # set to None if name (nullable) is None - # and model_fields_set contains the field - if self.name is None and "name" in self.model_fields_set: - _dict['name'] = None - - # set to None if tax_id (nullable) is None - # and model_fields_set contains the field - if self.tax_id is None and "tax_id" in self.model_fields_set: - _dict['tax_id'] = None - return _dict @classmethod diff --git a/conekta/models/update_order_tax_request.py b/conekta/models/orders_update_taxes_request.py similarity index 77% rename from conekta/models/update_order_tax_request.py rename to conekta/models/orders_update_taxes_request.py index 1220566..17497d0 100644 --- a/conekta/models/update_order_tax_request.py +++ b/conekta/models/orders_update_taxes_request.py @@ -23,18 +23,20 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class UpdateOrderTaxRequest(BaseModel): +class OrdersUpdateTaxesRequest(BaseModel): """ create new taxes for an existing order """ # noqa: E501 - amount: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The amount to be collected for tax in cents") - description: Optional[Annotated[str, Field(min_length=2, strict=True)]] = Field(default=None, description="description or tax's name") - metadata: Optional[Dict[str, Dict[str, Any]]] = None + amount: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="The amount to be collected for tax in cents", json_schema_extra={"examples": [100]}) + description: Optional[Annotated[str, Field(min_length=2, strict=True)]] = Field(default=None, description="description or tax's name", json_schema_extra={"examples": ["testing"]}) + metadata: Optional[Any] = None __properties: ClassVar[List[str]] = ["amount", "description", "metadata"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,12 +48,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of UpdateOrderTaxRequest from a JSON string""" + """Create an instance of OrdersUpdateTaxesRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -72,11 +73,16 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of UpdateOrderTaxRequest from a dict""" + """Create an instance of OrdersUpdateTaxesRequest from a dict""" if obj is None: return None @@ -86,7 +92,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: _obj = cls.model_validate({ "amount": obj.get("amount"), "description": obj.get("description"), - "metadata": obj.get("metadata") }) return _obj diff --git a/conekta/models/page.py b/conekta/models/page.py deleted file mode 100644 index fb66c68..0000000 --- a/conekta/models/page.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, Field, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class Page(BaseModel): - """ - page metadata - """ # noqa: E501 - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") - __properties: ClassVar[List[str]] = ["next_page_url", "previous_page_url"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of Page from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of Page from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "next_page_url": obj.get("next_page_url"), - "previous_page_url": obj.get("previous_page_url") - }) - return _obj - - diff --git a/conekta/models/payment_method.py b/conekta/models/payment_method.py deleted file mode 100644 index 69ea94d..0000000 --- a/conekta/models/payment_method.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding: utf-8 - -""" - Conekta API - - Conekta sdk - - The version of the OpenAPI document: 2.2.0 - Contact: engineering@conekta.com - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class PaymentMethod(BaseModel): - """ - PaymentMethod - """ # noqa: E501 - type: Optional[StrictStr] = None - object: StrictStr - __properties: ClassVar[List[str]] = ["type", "object"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of PaymentMethod from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - """ - excluded_fields: Set[str] = set([ - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of PaymentMethod from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "type": obj.get("type"), - "object": obj.get("object") - }) - return _obj - - diff --git a/conekta/models/payment_method_bank_transfer.py b/conekta/models/payment_method_bank_transfer.py index 686912d..d2b80a8 100644 --- a/conekta/models/payment_method_bank_transfer.py +++ b/conekta/models/payment_method_bank_transfer.py @@ -18,38 +18,40 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodBankTransfer(BaseModel): """ PaymentMethodBankTransfer """ # noqa: E501 type: Optional[StrictStr] = None - object: StrictStr - bank: Optional[StrictStr] = None - clabe: Optional[StrictStr] = None + object: StrictStr = Field(json_schema_extra={"examples": ["payment_source"]}) + bank: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["STP"]}) + clabe: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["646180111805034237"]}) description: Optional[StrictStr] = None executed_at: Optional[StrictStr] = None - expires_at: Optional[StrictInt] = None + expires_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1683053729]}) issuing_account_bank: Optional[StrictStr] = None issuing_account_number: Optional[StrictStr] = None issuing_account_holder_name: Optional[StrictStr] = None issuing_account_tax_id: Optional[StrictStr] = None payment_attempts: Optional[List[Any]] = None receiving_account_holder_name: Optional[StrictStr] = None - receiving_account_number: Optional[StrictStr] = None - receiving_account_bank: Optional[StrictStr] = None + receiving_account_number: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["646180111805034237"]}) + receiving_account_bank: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["STP"]}) receiving_account_tax_id: Optional[StrictStr] = None reference_number: Optional[StrictStr] = None tracking_code: Optional[StrictStr] = None - customer_ip_address: Optional[StrictStr] = None + customer_ip_address: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["0.0.0.0"]}) __properties: ClassVar[List[str]] = ["type", "object", "bank", "clabe", "description", "executed_at", "expires_at", "issuing_account_bank", "issuing_account_number", "issuing_account_holder_name", "issuing_account_tax_id", "payment_attempts", "receiving_account_holder_name", "receiving_account_number", "receiving_account_bank", "receiving_account_tax_id", "reference_number", "tracking_code", "customer_ip_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -61,8 +63,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,56 +88,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if description (nullable) is None - # and model_fields_set contains the field - if self.description is None and "description" in self.model_fields_set: - _dict['description'] = None - - # set to None if executed_at (nullable) is None - # and model_fields_set contains the field - if self.executed_at is None and "executed_at" in self.model_fields_set: - _dict['executed_at'] = None - - # set to None if issuing_account_bank (nullable) is None - # and model_fields_set contains the field - if self.issuing_account_bank is None and "issuing_account_bank" in self.model_fields_set: - _dict['issuing_account_bank'] = None - - # set to None if issuing_account_number (nullable) is None - # and model_fields_set contains the field - if self.issuing_account_number is None and "issuing_account_number" in self.model_fields_set: - _dict['issuing_account_number'] = None - - # set to None if issuing_account_holder_name (nullable) is None - # and model_fields_set contains the field - if self.issuing_account_holder_name is None and "issuing_account_holder_name" in self.model_fields_set: - _dict['issuing_account_holder_name'] = None - - # set to None if issuing_account_tax_id (nullable) is None - # and model_fields_set contains the field - if self.issuing_account_tax_id is None and "issuing_account_tax_id" in self.model_fields_set: - _dict['issuing_account_tax_id'] = None - - # set to None if receiving_account_holder_name (nullable) is None - # and model_fields_set contains the field - if self.receiving_account_holder_name is None and "receiving_account_holder_name" in self.model_fields_set: - _dict['receiving_account_holder_name'] = None - - # set to None if receiving_account_tax_id (nullable) is None - # and model_fields_set contains the field - if self.receiving_account_tax_id is None and "receiving_account_tax_id" in self.model_fields_set: - _dict['receiving_account_tax_id'] = None - - # set to None if reference_number (nullable) is None - # and model_fields_set contains the field - if self.reference_number is None and "reference_number" in self.model_fields_set: - _dict['reference_number'] = None - - # set to None if tracking_code (nullable) is None - # and model_fields_set contains the field - if self.tracking_code is None and "tracking_code" in self.model_fields_set: - _dict['tracking_code'] = None - return _dict @classmethod diff --git a/conekta/models/payment_method_bnpl_payment.py b/conekta/models/payment_method_bnpl_payment.py index 947f9bb..56b3143 100644 --- a/conekta/models/payment_method_bnpl_payment.py +++ b/conekta/models/payment_method_bnpl_payment.py @@ -18,10 +18,11 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodBnplPayment(BaseModel): """ @@ -29,16 +30,24 @@ class PaymentMethodBnplPayment(BaseModel): """ # noqa: E501 type: Optional[StrictStr] = None object: StrictStr - cancel_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer after a canceled payment") - expires_at: StrictInt = Field(description="Expiration date of the charge") - failure_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer after a failed payment") + cancel_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer after a canceled payment", json_schema_extra={"examples": ["https://example.com/cancel"]}) + expires_at: StrictInt = Field(description="Expiration date of the charge", json_schema_extra={"examples": [1683053729]}) + failure_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer after a failed payment", json_schema_extra={"examples": ["https://example.com/failure"]}) product_type: StrictStr = Field(description="Product type of the charge") - redirect_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer to complete the payment") - success_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer after a successful payment") + redirect_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer to complete the payment", json_schema_extra={"examples": ["https://example.com/redirect"]}) + success_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer after a successful payment", json_schema_extra={"examples": ["https://example.com/success"]}) __properties: ClassVar[List[str]] = ["type", "object", "cancel_url", "expires_at", "failure_url", "product_type", "redirect_url", "success_url"] + @field_validator('object') + def object_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['bnpl_payment']): + raise ValueError("must be one of enum values ('bnpl_payment')") + return value + model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +59,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_bnpl_request.py b/conekta/models/payment_method_bnpl_request.py index 39d776c..dab73f9 100644 --- a/conekta/models/payment_method_bnpl_request.py +++ b/conekta/models/payment_method_bnpl_request.py @@ -22,28 +22,30 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodBnplRequest(BaseModel): """ PaymentMethodBnplRequest """ # noqa: E501 - type: StrictStr = Field(description="Type of the payment method") - cancel_url: StrictStr = Field(description="URL to redirect the customer after a canceled payment") - can_not_expire: StrictBool = Field(description="Indicates if the payment method can not expire") - failure_url: StrictStr = Field(description="URL to redirect the customer after a failed payment") - product_type: StrictStr = Field(description="Product type of the payment method, use for the payment method to know the product type") - success_url: StrictStr = Field(description="URL to redirect the customer after a successful payment") + type: StrictStr = Field(description="Type of the payment method", json_schema_extra={"examples": ["bnpl"]}) + cancel_url: StrictStr = Field(description="URL to redirect the customer after a canceled payment", json_schema_extra={"examples": ["https://example.com/cancel"]}) + can_not_expire: StrictBool = Field(description="Indicates if the payment method can not expire", json_schema_extra={"examples": [True]}) + failure_url: StrictStr = Field(description="URL to redirect the customer after a failed payment", json_schema_extra={"examples": ["https://example.com/failure"]}) + product_type: StrictStr = Field(description="Product type of the payment method, use for the payment method to know the product type", json_schema_extra={"examples": ["aplazo_bnpl"]}) + success_url: StrictStr = Field(description="URL to redirect the customer after a successful payment", json_schema_extra={"examples": ["https://example.com/success"]}) __properties: ClassVar[List[str]] = ["type", "cancel_url", "can_not_expire", "failure_url", "product_type", "success_url"] @field_validator('product_type') def product_type_validate_enum(cls, value): """Validates the enum""" - if value not in set(['aplazo_bnpl', 'creditea_bnpl']): - raise ValueError("must be one of enum values ('aplazo_bnpl', 'creditea_bnpl')") + if value not in set(['aplazo_bnpl', 'azteca_bnpl', 'coppel_bnpl', 'creditea_bnpl']): + raise ValueError("must be one of enum values ('aplazo_bnpl', 'azteca_bnpl', 'coppel_bnpl', 'creditea_bnpl')") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_card.py b/conekta/models/payment_method_card.py index 0bd9b91..b6fa6f0 100644 --- a/conekta/models/payment_method_card.py +++ b/conekta/models/payment_method_card.py @@ -22,29 +22,31 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodCard(BaseModel): """ PaymentMethodCard """ # noqa: E501 type: Optional[StrictStr] = None - object: StrictStr - account_type: Optional[StrictStr] = Field(default=None, description="Account type of the card") - auth_code: Optional[StrictStr] = None - brand: Optional[StrictStr] = Field(default=None, description="Brand of the card") - contract_id: Optional[StrictStr] = Field(default=None, description="Id sent for recurrent charges.") - country: Optional[StrictStr] = Field(default=None, description="Country of the card") - exp_month: Optional[StrictStr] = Field(default=None, description="Expiration month of the card") - exp_year: Optional[StrictStr] = Field(default=None, description="Expiration year of the card") + object: StrictStr = Field(json_schema_extra={"examples": ["payment_source"]}) + account_type: Optional[StrictStr] = Field(default=None, description="Account type of the card", json_schema_extra={"examples": ["Credit"]}) + auth_code: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["867372"]}) + brand: Optional[StrictStr] = Field(default=None, description="Brand of the card", json_schema_extra={"examples": ["visa"]}) + contract_id: Optional[StrictStr] = Field(default=None, description="Id sent for recurrent charges.", json_schema_extra={"examples": ["S781317595"]}) + country: Optional[StrictStr] = Field(default=None, description="Country of the card", json_schema_extra={"examples": ["MX"]}) + exp_month: Optional[StrictStr] = Field(default=None, description="Expiration month of the card", json_schema_extra={"examples": ["02"]}) + exp_year: Optional[StrictStr] = Field(default=None, description="Expiration year of the card", json_schema_extra={"examples": ["2026"]}) fraud_indicators: Optional[List[Any]] = None - issuer: Optional[StrictStr] = Field(default=None, description="Issuer of the card") - last4: Optional[StrictStr] = Field(default=None, description="Last 4 digits of the card") - name: Optional[StrictStr] = Field(default=None, description="Name of the cardholder") - customer_ip_address: Optional[StrictStr] = Field(default=None, description="Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes") + issuer: Optional[StrictStr] = Field(default=None, description="Issuer of the card", json_schema_extra={"examples": ["BANAMEX"]}) + last4: Optional[StrictStr] = Field(default=None, description="Last 4 digits of the card", json_schema_extra={"examples": ["4242"]}) + name: Optional[StrictStr] = Field(default=None, description="Name of the cardholder", json_schema_extra={"examples": ["Fulanito Perez"]}) + customer_ip_address: Optional[StrictStr] = Field(default=None, description="Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes", json_schema_extra={"examples": ["0.0.0.0"]}) __properties: ClassVar[List[str]] = ["type", "object", "account_type", "auth_code", "brand", "contract_id", "country", "exp_month", "exp_year", "fraud_indicators", "issuer", "last4", "name", "customer_ip_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -56,8 +58,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_card_request.py b/conekta/models/payment_method_card_request.py index 5baae03..ea357eb 100644 --- a/conekta/models/payment_method_card_request.py +++ b/conekta/models/payment_method_card_request.py @@ -23,22 +23,24 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodCardRequest(BaseModel): """ PaymentMethodCardRequest """ # noqa: E501 - type: StrictStr = Field(description="Type of payment method") - cvc: Annotated[str, Field(min_length=3, strict=True, max_length=4)] = Field(description="Card security code") - exp_month: Annotated[str, Field(min_length=2, strict=True, max_length=2)] = Field(description="Card expiration month") - exp_year: Annotated[str, Field(min_length=4, strict=True, max_length=4)] = Field(description="Card expiration year") - name: StrictStr = Field(description="Cardholder name") - number: StrictStr = Field(description="Card number") - customer_ip_address: Optional[StrictStr] = Field(default=None, description="Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes") + type: StrictStr = Field(description="Type of payment method", json_schema_extra={"examples": ["card | cash | spei | bnpl | pay_by_bank"]}) + cvc: Annotated[str, Field(min_length=3, strict=True, max_length=4)] = Field(description="Card security code", json_schema_extra={"examples": ["198"]}) + exp_month: Annotated[str, Field(min_length=2, strict=True, max_length=2)] = Field(description="Card expiration month", json_schema_extra={"examples": ["12"]}) + exp_year: Annotated[str, Field(min_length=4, strict=True, max_length=4)] = Field(description="Card expiration year", json_schema_extra={"examples": ["2025"]}) + name: StrictStr = Field(description="Cardholder name", json_schema_extra={"examples": ["John Doe"]}) + number: StrictStr = Field(description="Card number", json_schema_extra={"examples": ["4242424242424242"]}) + customer_ip_address: Optional[StrictStr] = Field(default=None, description="Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes", json_schema_extra={"examples": ["0.0.0.0"]}) __properties: ClassVar[List[str]] = ["type", "cvc", "exp_month", "exp_year", "name", "number", "customer_ip_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_card_response.py b/conekta/models/payment_method_card_response.py index 8ce88ca..d458741 100644 --- a/conekta/models/payment_method_card_response.py +++ b/conekta/models/payment_method_card_response.py @@ -18,34 +18,37 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodCardResponse(BaseModel): """ PaymentMethodCardResponse """ # noqa: E501 type: StrictStr - id: StrictStr - object: StrictStr - created_at: StrictInt - parent_id: Optional[StrictStr] = None - last4: Optional[StrictStr] = None - bin: Optional[StrictStr] = None - card_type: Optional[StrictStr] = None - exp_month: Optional[StrictStr] = None - exp_year: Optional[StrictStr] = None - brand: Optional[StrictStr] = None - name: Optional[StrictStr] = None + id: StrictStr = Field(json_schema_extra={"examples": ["src_2s8K1B3PBKDontpi9"]}) + object: StrictStr = Field(json_schema_extra={"examples": ["payment_source"]}) + created_at: StrictInt = Field(json_schema_extra={"examples": [1675715413]}) + parent_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2s8K1B3PBKDontpi8"]}) + last4: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["6410"]}) + bin: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["40276657"]}) + card_type: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["debit"]}) + exp_month: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["10"]}) + exp_year: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["25"]}) + brand: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["visa"]}) + issuer: Optional[StrictStr] = Field(default=None, description="Name of the institution that issued the card", json_schema_extra={"examples": ["santander"]}) + name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Fulano Perez\""]}) default: Optional[StrictBool] = None visible_on_checkout: Optional[StrictBool] = None - payment_source_status: Optional[StrictStr] = None - __properties: ClassVar[List[str]] = ["type", "id", "object", "created_at", "parent_id", "last4", "bin", "card_type", "exp_month", "exp_year", "brand", "name", "default", "visible_on_checkout", "payment_source_status"] + payment_source_status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["active"]}) + __properties: ClassVar[List[str]] = ["type", "id", "object", "created_at", "parent_id", "last4", "bin", "card_type", "exp_month", "exp_year", "brand", "issuer", "name", "default", "visible_on_checkout", "payment_source_status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -57,8 +60,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -106,6 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "exp_month": obj.get("exp_month"), "exp_year": obj.get("exp_year"), "brand": obj.get("brand"), + "issuer": obj.get("issuer"), "name": obj.get("name"), "default": obj.get("default"), "visible_on_checkout": obj.get("visible_on_checkout"), diff --git a/conekta/models/payment_method_cash.py b/conekta/models/payment_method_cash.py index 17faf71..ea3005a 100644 --- a/conekta/models/payment_method_cash.py +++ b/conekta/models/payment_method_cash.py @@ -22,28 +22,30 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodCash(BaseModel): """ PaymentMethodCash """ # noqa: E501 type: Optional[StrictStr] = None - object: StrictStr - agreement: Optional[StrictStr] = Field(default=None, description="Agreement ID") - auth_code: Optional[StrictInt] = None - cashier_id: Optional[StrictStr] = None - reference: Optional[StrictStr] = None - barcode_url: Optional[StrictStr] = None - expires_at: Optional[StrictInt] = None - product_type: Optional[StrictStr] = Field(default=None, description="Product type, e.g. bbva_cash_in, cash_in, pespay_cash_in, etc.") - service_name: Optional[StrictStr] = None - store: Optional[StrictStr] = None - store_name: Optional[StrictStr] = None - customer_ip_address: Optional[StrictStr] = None + object: StrictStr = Field(json_schema_extra={"examples": ["payment_source"]}) + agreement: Optional[StrictStr] = Field(default=None, description="Agreement ID", json_schema_extra={"examples": ["agreement_2tN73UdUSNrYRPD9r"]}) + auth_code: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [542563]}) + cashier_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["OINM01010"]}) + reference: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["93000262276908"]}) + barcode_url: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["https://barcodes.conekta.com/644ebf80f2243197aad6cd8810375b905b613dbe.png"]}) + expires_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) + product_type: Optional[StrictStr] = Field(default=None, description="Product type, e.g. bbva_cash_in, cash_in, pespay_cash_in, etc.", json_schema_extra={"examples": ["bbva_cash_in"]}) + service_name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["store"]}) + store: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["10MON50EDI"]}) + store_name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["wallmart"]}) + customer_ip_address: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["0.0.0.0"]}) __properties: ClassVar[List[str]] = ["type", "object", "agreement", "auth_code", "cashier_id", "reference", "barcode_url", "expires_at", "product_type", "service_name", "store", "store_name", "customer_ip_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,21 +82,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if auth_code (nullable) is None - # and model_fields_set contains the field - if self.auth_code is None and "auth_code" in self.model_fields_set: - _dict['auth_code'] = None - - # set to None if cashier_id (nullable) is None - # and model_fields_set contains the field - if self.cashier_id is None and "cashier_id" in self.model_fields_set: - _dict['cashier_id'] = None - - # set to None if store (nullable) is None - # and model_fields_set contains the field - if self.store is None and "store" in self.model_fields_set: - _dict['store'] = None - return _dict @classmethod diff --git a/conekta/models/payment_method_cash_recurrent_response.py b/conekta/models/payment_method_cash_recurrent_response.py index 3d4481a..b39c696 100644 --- a/conekta/models/payment_method_cash_recurrent_response.py +++ b/conekta/models/payment_method_cash_recurrent_response.py @@ -20,29 +20,31 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.payment_method_cash_response_all_of_agreements import PaymentMethodCashResponseAllOfAgreements +from conekta.models.cash_agreements_response import CashAgreementsResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodCashRecurrentResponse(BaseModel): """ Alias of cash response used when type=cash_recurrent """ # noqa: E501 type: StrictStr - id: StrictStr - object: StrictStr - created_at: StrictInt - parent_id: Optional[StrictStr] = None - agreements: Optional[List[PaymentMethodCashResponseAllOfAgreements]] = None - reference: Optional[StrictStr] = None - barcode: Optional[StrictStr] = None - barcode_url: Optional[StrictStr] = Field(default=None, description="URL to the barcode image, reference is the same as barcode") - expires_at: Optional[StrictInt] = None - provider: Optional[StrictStr] = None + id: StrictStr = Field(json_schema_extra={"examples": ["src_2s8K1B3PBKDontpi9"]}) + object: StrictStr = Field(json_schema_extra={"examples": ["payment_source"]}) + created_at: StrictInt = Field(json_schema_extra={"examples": [1675715413]}) + parent_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2s8K1B3PBKDontpi8"]}) + agreements: Optional[List[CashAgreementsResponse]] = None + reference: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["93000262276908"]}) + barcode: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["93000262276908"]}) + barcode_url: Optional[StrictStr] = Field(default=None, description="URL to the barcode image, reference is the same as barcode", json_schema_extra={"examples": ["https://barcodes.conekta.com/644ebf80f2243197aad6cd8810375b905b613dbe.png"]}) + expires_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1742483424]}) + provider: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Cash"]}) __properties: ClassVar[List[str]] = ["type", "id", "object", "created_at", "parent_id", "agreements", "reference", "barcode", "barcode_url", "expires_at", "provider"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -104,7 +105,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "object": obj.get("object"), "created_at": obj.get("created_at"), "parent_id": obj.get("parent_id"), - "agreements": [PaymentMethodCashResponseAllOfAgreements.from_dict(_item) for _item in obj["agreements"]] if obj.get("agreements") is not None else None, + "agreements": [CashAgreementsResponse.from_dict(_item) for _item in obj["agreements"]] if obj.get("agreements") is not None else None, "reference": obj.get("reference"), "barcode": obj.get("barcode"), "barcode_url": obj.get("barcode_url"), diff --git a/conekta/models/payment_method_cash_request.py b/conekta/models/payment_method_cash_request.py index 6983eaf..7f23b6b 100644 --- a/conekta/models/payment_method_cash_request.py +++ b/conekta/models/payment_method_cash_request.py @@ -22,17 +22,19 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodCashRequest(BaseModel): """ PaymentMethodCashRequest """ # noqa: E501 - type: StrictStr = Field(description="Type of payment method") - expires_at: Optional[StrictInt] = None + type: StrictStr = Field(description="Type of payment method", json_schema_extra={"examples": ["card | cash | spei | bnpl | pay_by_bank"]}) + expires_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1553273553]}) __properties: ClassVar[List[str]] = ["type", "expires_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_cash_response.py b/conekta/models/payment_method_cash_response.py index f29707c..95d59c4 100644 --- a/conekta/models/payment_method_cash_response.py +++ b/conekta/models/payment_method_cash_response.py @@ -20,29 +20,31 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.payment_method_cash_response_all_of_agreements import PaymentMethodCashResponseAllOfAgreements +from conekta.models.cash_agreements_response import CashAgreementsResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodCashResponse(BaseModel): """ PaymentMethodCashResponse """ # noqa: E501 type: StrictStr - id: StrictStr - object: StrictStr - created_at: StrictInt - parent_id: Optional[StrictStr] = None - agreements: Optional[List[PaymentMethodCashResponseAllOfAgreements]] = None - reference: Optional[StrictStr] = None - barcode: Optional[StrictStr] = None - barcode_url: Optional[StrictStr] = Field(default=None, description="URL to the barcode image, reference is the same as barcode") - expires_at: Optional[StrictInt] = None - provider: Optional[StrictStr] = None + id: StrictStr = Field(json_schema_extra={"examples": ["src_2s8K1B3PBKDontpi9"]}) + object: StrictStr = Field(json_schema_extra={"examples": ["payment_source"]}) + created_at: StrictInt = Field(json_schema_extra={"examples": [1675715413]}) + parent_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2s8K1B3PBKDontpi8"]}) + agreements: Optional[List[CashAgreementsResponse]] = None + reference: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["93000262276908"]}) + barcode: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["93000262276908"]}) + barcode_url: Optional[StrictStr] = Field(default=None, description="URL to the barcode image, reference is the same as barcode", json_schema_extra={"examples": ["https://barcodes.conekta.com/644ebf80f2243197aad6cd8810375b905b613dbe.png"]}) + expires_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1742483424]}) + provider: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Cash"]}) __properties: ClassVar[List[str]] = ["type", "id", "object", "created_at", "parent_id", "agreements", "reference", "barcode", "barcode_url", "expires_at", "provider"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -104,7 +105,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "object": obj.get("object"), "created_at": obj.get("created_at"), "parent_id": obj.get("parent_id"), - "agreements": [PaymentMethodCashResponseAllOfAgreements.from_dict(_item) for _item in obj["agreements"]] if obj.get("agreements") is not None else None, + "agreements": [CashAgreementsResponse.from_dict(_item) for _item in obj["agreements"]] if obj.get("agreements") is not None else None, "reference": obj.get("reference"), "barcode": obj.get("barcode"), "barcode_url": obj.get("barcode_url"), diff --git a/conekta/models/payment_method_general_request.py b/conekta/models/payment_method_general_request.py index c3ab109..ec3e03b 100644 --- a/conekta/models/payment_method_general_request.py +++ b/conekta/models/payment_method_general_request.py @@ -22,23 +22,25 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodGeneralRequest(BaseModel): """ Payment method used in the charge. Go to the [payment methods](https://developers.conekta.com/reference/m%C3%A9todos-de-pago) section for more details """ # noqa: E501 - expires_at: Optional[StrictInt] = Field(default=None, description="Method expiration date as unix timestamp") + expires_at: Optional[StrictInt] = Field(default=None, description="Method expiration date as unix timestamp", json_schema_extra={"examples": [1677196303]}) monthly_installments: Optional[StrictInt] = Field(default=None, description="How many months without interest to apply, it can be 3, 6, 9, 12 or 18") - type: StrictStr = Field(description="Type of payment method") - token_id: Optional[StrictStr] = None - payment_source_id: Optional[StrictStr] = None - cvc: Optional[StrictStr] = Field(default=None, description="Optional, It is a value that allows identifying the security code of the card. Only for PCI merchants") - contract_id: Optional[StrictStr] = Field(default=None, description="Optional id sent to indicate the bank contract for recurrent card charges.") - customer_ip_address: Optional[StrictStr] = Field(default=None, description="Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes") + type: StrictStr = Field(description="Type of payment method", json_schema_extra={"examples": ["card"]}) + token_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["tok_2897348234"]}) + payment_source_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["src_2tLkkyfMPh6v7pFry"]}) + cvc: Optional[StrictStr] = Field(default=None, description="Optional, It is a value that allows identifying the security code of the card. Only for PCI merchants", json_schema_extra={"examples": ["123"]}) + contract_id: Optional[StrictStr] = Field(default=None, description="Optional id sent to indicate the bank contract for recurrent card charges.", json_schema_extra={"examples": ["S781317595"]}) + customer_ip_address: Optional[StrictStr] = Field(default=None, description="Optional field used to capture the customer's IP address for fraud prevention and security monitoring purposes", json_schema_extra={"examples": ["0.0.0.0"]}) __properties: ClassVar[List[str]] = ["expires_at", "monthly_installments", "type", "token_id", "payment_source_id", "cvc", "contract_id", "customer_ip_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_pbb_payment.py b/conekta/models/payment_method_pbb_payment.py index 8953ce6..ac4318b 100644 --- a/conekta/models/payment_method_pbb_payment.py +++ b/conekta/models/payment_method_pbb_payment.py @@ -23,22 +23,24 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodPbbPayment(BaseModel): """ PaymentMethodPbbPayment """ # noqa: E501 type: Optional[StrictStr] = None - object: StrictStr - deep_link: StrictStr = Field(description="Deep link for the payment, use for mobile apps/flows") - expires_at: Annotated[int, Field(strict=True, gt=0)] = Field(description="Expiration date of the charge") + object: StrictStr = Field(json_schema_extra={"examples": ["payment_source"]}) + deep_link: StrictStr = Field(description="Deep link for the payment, use for mobile apps/flows", json_schema_extra={"examples": ["https://mgm.bbva.mx/WA3b/pbb?AGREEMENT=002484374&AMOUNT=1&CONCEPT=PagoDirecto&CURRENCY=MXN&REFERENCE=22277523174328893295"]}) + expires_at: Annotated[int, Field(strict=True, ge=0)] = Field(description="Expiration date of the charge", json_schema_extra={"examples": [1683053729]}) product_type: StrictStr = Field(description="Product type of the charge") - redirect_url: StrictStr = Field(description="URL to redirect the customer to complete the payment") - reference: StrictStr = Field(description="Reference for the payment") + redirect_url: StrictStr = Field(description="URL to redirect the customer to complete the payment", json_schema_extra={"examples": ["https://example.com/redirect"]}) + reference: StrictStr = Field(description="Reference for the payment", json_schema_extra={"examples": ["22277523174328893295"]}) __properties: ClassVar[List[str]] = ["type", "object", "deep_link", "expires_at", "product_type", "redirect_url", "reference"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_pbb_request.py b/conekta/models/payment_method_pbb_request.py index 0772e99..645024d 100644 --- a/conekta/models/payment_method_pbb_request.py +++ b/conekta/models/payment_method_pbb_request.py @@ -23,14 +23,15 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodPbbRequest(BaseModel): """ PaymentMethodPbbRequest """ # noqa: E501 - type: StrictStr = Field(description="Type of the payment method") - expires_at: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Expiration date of the payment method, in Unix timestamp format") - product_type: StrictStr = Field(description="Product type of the payment method, use for the payment method to know the product type") + type: StrictStr = Field(description="Type of the payment method", json_schema_extra={"examples": ["pay_by_bank"]}) + expires_at: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, description="Expiration date of the payment method, in Unix timestamp format", json_schema_extra={"examples": [1680397724]}) + product_type: StrictStr = Field(description="Product type of the payment method, use for the payment method to know the product type", json_schema_extra={"examples": ["bbva_pay_by_bank"]}) __properties: ClassVar[List[str]] = ["type", "expires_at", "product_type"] @field_validator('product_type') @@ -41,7 +42,8 @@ def product_type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +55,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_spei_recurrent.py b/conekta/models/payment_method_spei_recurrent_response.py similarity index 69% rename from conekta/models/payment_method_spei_recurrent.py rename to conekta/models/payment_method_spei_recurrent_response.py index 346a482..8c11a80 100644 --- a/conekta/models/payment_method_spei_recurrent.py +++ b/conekta/models/payment_method_spei_recurrent_response.py @@ -22,23 +22,25 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class PaymentMethodSpeiRecurrent(BaseModel): +class PaymentMethodSpeiRecurrentResponse(BaseModel): """ - PaymentMethodSpeiRecurrent + PaymentMethodSpeiRecurrentResponse """ # noqa: E501 type: StrictStr - id: StrictStr - object: StrictStr - created_at: StrictInt - parent_id: Optional[StrictStr] = None - bank: Optional[StrictStr] = Field(default=None, description="Bank name for the SPEI payment method") - reference: Optional[StrictStr] = None - expires_at: Optional[StrictStr] = None + id: StrictStr = Field(json_schema_extra={"examples": ["src_2s8K1B3PBKDontpi9"]}) + object: StrictStr = Field(json_schema_extra={"examples": ["payment_source"]}) + created_at: StrictInt = Field(json_schema_extra={"examples": [1675715413]}) + parent_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2s8K1B3PBKDontpi8"]}) + bank: Optional[StrictStr] = Field(default=None, description="Bank name for the SPEI payment method", json_schema_extra={"examples": ["STP"]}) + reference: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["93000262276908"]}) + expires_at: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["none"]}) __properties: ClassVar[List[str]] = ["type", "id", "object", "created_at", "parent_id", "bank", "reference", "expires_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,12 +52,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of PaymentMethodSpeiRecurrent from a JSON string""" + """Create an instance of PaymentMethodSpeiRecurrentResponse from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -80,7 +81,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of PaymentMethodSpeiRecurrent from a dict""" + """Create an instance of PaymentMethodSpeiRecurrentResponse from a dict""" if obj is None: return None diff --git a/conekta/models/payment_method_spei_request.py b/conekta/models/payment_method_spei_request.py index a9e01d9..1c31039 100644 --- a/conekta/models/payment_method_spei_request.py +++ b/conekta/models/payment_method_spei_request.py @@ -22,17 +22,19 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodSpeiRequest(BaseModel): """ PaymentMethodSpeiRequest """ # noqa: E501 - type: StrictStr = Field(description="Type of payment method") - expires_at: Optional[StrictInt] = None + type: StrictStr = Field(description="Type of payment method", json_schema_extra={"examples": ["card | cash | spei | bnpl | pay_by_bank"]}) + expires_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1553273553]}) __properties: ClassVar[List[str]] = ["type", "expires_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payment_method_token_request.py b/conekta/models/payment_method_token_request.py index ee70f4e..8abde26 100644 --- a/conekta/models/payment_method_token_request.py +++ b/conekta/models/payment_method_token_request.py @@ -22,17 +22,19 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PaymentMethodTokenRequest(BaseModel): """ PaymentMethodTokenRequest """ # noqa: E501 - type: StrictStr = Field(description="Type of payment method") - token_id: StrictStr = Field(description="Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.2.0/reference/createsubscription] tutorial for more information on how to tokenize cards.") + type: StrictStr = Field(description="Type of payment method", json_schema_extra={"examples": ["card | cash | spei | bnpl | pay_by_bank"]}) + token_id: StrictStr = Field(description="Token id that will be used to create a \"card\" type payment method. See the (subscriptions)[https://developers.conekta.com/v2.2.0/reference/createsubscription] tutorial for more information on how to tokenize cards.", json_schema_extra={"examples": ["tok_32hj4g234as"]}) __properties: ClassVar[List[str]] = ["type", "token_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payout.py b/conekta/models/payout.py index 6bf9b0a..7ad6406 100644 --- a/conekta/models/payout.py +++ b/conekta/models/payout.py @@ -23,6 +23,7 @@ from conekta.models.payout_method import PayoutMethod from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Payout(BaseModel): """ @@ -32,7 +33,8 @@ class Payout(BaseModel): __properties: ClassVar[List[str]] = ["payout_method"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payout_method.py b/conekta/models/payout_method.py index 4222370..974a832 100644 --- a/conekta/models/payout_method.py +++ b/conekta/models/payout_method.py @@ -22,16 +22,18 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayoutMethod(BaseModel): """ The payout method of the payout order. """ # noqa: E501 - type: StrictStr = Field(description="The type of the payout method.") + type: StrictStr = Field(description="The type of the payout method.", json_schema_extra={"examples": ["cashout"]}) __properties: ClassVar[List[str]] = ["type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payout_order_payouts_item.py b/conekta/models/payout_order_payouts_item.py index 7d2eb76..9581272 100644 --- a/conekta/models/payout_order_payouts_item.py +++ b/conekta/models/payout_order_payouts_item.py @@ -22,23 +22,25 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayoutOrderPayoutsItem(BaseModel): """ PayoutOrderPayoutsItem """ # noqa: E501 - amount: StrictInt = Field(description="The amount of the payout.") - currency: StrictStr = Field(description="The currency in which the payout is made.") - expires_at: Optional[StrictInt] = Field(default=None, description="The expiration date of the payout.") - id: StrictStr = Field(description="The id of the payout.") - livemode: StrictBool = Field(description="The live mode of the payout.") - object: StrictStr = Field(description="The object of the payout.") - payout_order_id: Optional[StrictStr] = Field(default=None, description="The id of the payout order.") - status: Optional[StrictStr] = Field(default=None, description="The status of the payout.") + amount: StrictInt = Field(description="The amount of the payout.", json_schema_extra={"examples": [3000]}) + currency: StrictStr = Field(description="The currency in which the payout is made.", json_schema_extra={"examples": ["MXN"]}) + expires_at: Optional[StrictInt] = Field(default=None, description="The expiration date of the payout.", json_schema_extra={"examples": [1677626837]}) + id: StrictStr = Field(description="The id of the payout.", json_schema_extra={"examples": ["payout_2vZwsRAhhGp2dFDJx"]}) + livemode: StrictBool = Field(description="The live mode of the payout.", json_schema_extra={"examples": [True]}) + object: StrictStr = Field(description="The object of the payout.", json_schema_extra={"examples": ["payout"]}) + payout_order_id: Optional[StrictStr] = Field(default=None, description="The id of the payout order.", json_schema_extra={"examples": ["f2654d66-d740-457a-9a8c-f96b5196f44e"]}) + status: Optional[StrictStr] = Field(default=None, description="The status of the payout.", json_schema_extra={"examples": ["open"]}) __properties: ClassVar[List[str]] = ["amount", "currency", "expires_at", "id", "livemode", "object", "payout_order_id", "status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payout_order.py b/conekta/models/payout_order_request.py similarity index 70% rename from conekta/models/payout_order.py rename to conekta/models/payout_order_request.py index 3f517a6..672225c 100644 --- a/conekta/models/payout_order.py +++ b/conekta/models/payout_order_request.py @@ -20,26 +20,29 @@ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_info_just_customer_id import CustomerInfoJustCustomerId from conekta.models.payout import Payout +from conekta.models.payout_order_request_customer_info import PayoutOrderRequestCustomerInfo from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class PayoutOrder(BaseModel): +class PayoutOrderRequest(BaseModel): """ a payout order """ # noqa: E501 - allowed_payout_methods: List[StrictStr] = Field(description="The payout methods that are allowed for the payout order.") - amount: StrictInt = Field(description="The amount of the payout order.") - currency: StrictStr = Field(description="The currency in which the payout order is made.") - customer_info: CustomerInfoJustCustomerId - metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata of the payout order.") + allowed_payout_methods: List[StrictStr] = Field(description="The payout methods that are allowed for the payout order.", json_schema_extra={"examples": [["cashout"]]}) + amount: StrictInt = Field(description="The amount of the payout order.", json_schema_extra={"examples": [100]}) + currency: StrictStr = Field(description="The currency in which the payout order is made.", json_schema_extra={"examples": ["MXN"]}) + customer_info: PayoutOrderRequestCustomerInfo + expires_at: StrictInt = Field(description="The expiration time of the payout order in Unix timestamp.", json_schema_extra={"examples": [1700000000]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata of the payout order.", json_schema_extra={"examples": [{"custom_client_id": "12345"}]}) payout: Payout - reason: StrictStr = Field(description="The reason for the payout order.") - __properties: ClassVar[List[str]] = ["allowed_payout_methods", "amount", "currency", "customer_info", "metadata", "payout", "reason"] + reason: StrictStr = Field(description="The reason for the payout order.", json_schema_extra={"examples": ["Payout order for the customer"]}) + __properties: ClassVar[List[str]] = ["allowed_payout_methods", "amount", "currency", "customer_info", "expires_at", "metadata", "payout", "reason"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,12 +54,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of PayoutOrder from a JSON string""" + """Create an instance of PayoutOrderRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -87,7 +89,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of PayoutOrder from a dict""" + """Create an instance of PayoutOrderRequest from a dict""" if obj is None: return None @@ -98,7 +100,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "allowed_payout_methods": obj.get("allowed_payout_methods"), "amount": obj.get("amount"), "currency": obj.get("currency") if obj.get("currency") is not None else 'MXN', - "customer_info": CustomerInfoJustCustomerId.from_dict(obj["customer_info"]) if obj.get("customer_info") is not None else None, + "customer_info": PayoutOrderRequestCustomerInfo.from_dict(obj["customer_info"]) if obj.get("customer_info") is not None else None, + "expires_at": obj.get("expires_at"), "metadata": obj.get("metadata"), "payout": Payout.from_dict(obj["payout"]) if obj.get("payout") is not None else None, "reason": obj.get("reason") diff --git a/conekta/models/customer_info_just_customer_id_response.py b/conekta/models/payout_order_request_customer_info.py similarity index 75% rename from conekta/models/customer_info_just_customer_id_response.py rename to conekta/models/payout_order_request_customer_info.py index 638f676..e4b9874 100644 --- a/conekta/models/customer_info_just_customer_id_response.py +++ b/conekta/models/payout_order_request_customer_info.py @@ -18,20 +18,22 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CustomerInfoJustCustomerIdResponse(BaseModel): +class PayoutOrderRequestCustomerInfo(BaseModel): """ - CustomerInfoJustCustomerIdResponse + The customer information to whom the payout order is made. """ # noqa: E501 - customer_id: Optional[StrictStr] = None + customer_id: StrictStr = Field(json_schema_extra={"examples": ["cus_23874283647"]}) __properties: ClassVar[List[str]] = ["customer_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,12 +45,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomerInfoJustCustomerIdResponse from a JSON string""" + """Create an instance of PayoutOrderRequestCustomerInfo from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,7 +74,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomerInfoJustCustomerIdResponse from a dict""" + """Create an instance of PayoutOrderRequestCustomerInfo from a dict""" if obj is None: return None diff --git a/conekta/models/payout_order_response.py b/conekta/models/payout_order_response.py index 55cf99d..397481f 100644 --- a/conekta/models/payout_order_response.py +++ b/conekta/models/payout_order_response.py @@ -25,29 +25,31 @@ from conekta.models.payout_order_response_customer_info import PayoutOrderResponseCustomerInfo from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayoutOrderResponse(BaseModel): """ payout order model response """ # noqa: E501 - allowed_payout_methods: Annotated[List[StrictStr], Field(min_length=1)] = Field(description="The payout methods that are allowed for the payout order.") - amount: StrictInt = Field(description="The amount of the payout order.") - created_at: StrictInt = Field(description="The creation date of the payout order.") - currency: StrictStr = Field(description="The currency in which the payout order is made.") + allowed_payout_methods: Annotated[List[StrictStr], Field(min_length=1)] = Field(description="The payout methods that are allowed for the payout order.", json_schema_extra={"examples": [["cashout"]]}) + amount: StrictInt = Field(description="The amount of the payout order.", json_schema_extra={"examples": [100]}) + created_at: StrictInt = Field(description="The creation date of the payout order.", json_schema_extra={"examples": [1677626837]}) + currency: StrictStr = Field(description="The currency in which the payout order is made.", json_schema_extra={"examples": ["MXN"]}) customer_info: PayoutOrderResponseCustomerInfo - expires_at: Optional[StrictInt] = Field(default=None, description="The expiration date of the payout order.") - id: StrictStr = Field(description="The id of the payout order.") - livemode: StrictBool = Field(description="The live mode of the payout order.") - object: StrictStr = Field(description="The object of the payout order.") - metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata of the payout order.") + expires_at: StrictInt = Field(description="The expiration date of the payout order.", json_schema_extra={"examples": [1677626837]}) + id: StrictStr = Field(description="The id of the payout order.", json_schema_extra={"examples": ["f2654d66-d740-457a-9a8c-f96b5196f44e"]}) + livemode: StrictBool = Field(description="The live mode of the payout order.", json_schema_extra={"examples": [True]}) + object: StrictStr = Field(description="The object of the payout order.", json_schema_extra={"examples": ["payout_order"]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, description="The metadata of the payout order.", json_schema_extra={"examples": [{"custom_client_id": "12345"}]}) payouts: List[PayoutOrderPayoutsItem] = Field(description="The payout information of the payout order.") - reason: StrictStr = Field(description="The reason for the payout order.") - status: Optional[StrictStr] = Field(default=None, description="The status of the payout order.") - updated_at: StrictInt = Field(description="The update date of the payout order.") + reason: StrictStr = Field(description="The reason for the payout order.", json_schema_extra={"examples": ["Payout order for the customer"]}) + status: StrictStr = Field(description="The status of the payout order.", json_schema_extra={"examples": ["open"]}) + updated_at: StrictInt = Field(description="The update date of the payout order.", json_schema_extra={"examples": [1677626837]}) __properties: ClassVar[List[str]] = ["allowed_payout_methods", "amount", "created_at", "currency", "customer_info", "expires_at", "id", "livemode", "object", "metadata", "payouts", "reason", "status", "updated_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -59,8 +61,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/payout_order_response_customer_info.py b/conekta/models/payout_order_response_customer_info.py index e49f1b8..c2815c9 100644 --- a/conekta/models/payout_order_response_customer_info.py +++ b/conekta/models/payout_order_response_customer_info.py @@ -22,22 +22,24 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayoutOrderResponseCustomerInfo(BaseModel): """ The customer information of the payout order. """ # noqa: E501 - customer_custom_reference: Optional[StrictStr] = Field(default=None, description="Custom reference") - name: Optional[StrictStr] = None - email: Optional[StrictStr] = None - phone: Optional[StrictStr] = None + id: StrictStr = Field(description="The id of the customer.", json_schema_extra={"examples": ["cus_23874283647"]}) + customer_custom_reference: Optional[StrictStr] = Field(default=None, description="Custom reference", json_schema_extra={"examples": ["custom_reference"]}) + name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["DevTest"]}) + email: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["test@conekta.com"]}) + phone: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["5522997233"]}) corporate: Optional[StrictBool] = False - object: Optional[StrictStr] = None - id: StrictStr = Field(description="The id of the customer.") - __properties: ClassVar[List[str]] = ["customer_custom_reference", "name", "email", "phone", "corporate", "object", "id"] + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["customer_info"]}) + __properties: ClassVar[List[str]] = ["id", "customer_custom_reference", "name", "email", "phone", "corporate", "object"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -75,11 +76,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if customer_custom_reference (nullable) is None - # and model_fields_set contains the field - if self.customer_custom_reference is None and "customer_custom_reference" in self.model_fields_set: - _dict['customer_custom_reference'] = None - return _dict @classmethod @@ -92,13 +88,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "id": obj.get("id"), "customer_custom_reference": obj.get("customer_custom_reference"), "name": obj.get("name"), "email": obj.get("email"), "phone": obj.get("phone"), "corporate": obj.get("corporate") if obj.get("corporate") is not None else False, - "object": obj.get("object"), - "id": obj.get("id") + "object": obj.get("object") }) return _obj diff --git a/conekta/models/payout_orders_response.py b/conekta/models/payout_orders_response.py index fbfa910..1dd475a 100644 --- a/conekta/models/payout_orders_response.py +++ b/conekta/models/payout_orders_response.py @@ -23,20 +23,22 @@ from conekta.models.payout_order_response import PayoutOrderResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PayoutOrdersResponse(BaseModel): """ PayoutOrdersResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") data: Optional[List[PayoutOrderResponse]] = None - __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) + __properties: ClassVar[List[str]] = ["data", "has_more", "object", "next_page_url", "previous_page_url"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod @@ -103,11 +94,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ + "data": [PayoutOrderResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None, "has_more": obj.get("has_more"), "object": obj.get("object"), "next_page_url": obj.get("next_page_url"), - "previous_page_url": obj.get("previous_page_url"), - "data": [PayoutOrderResponse.from_dict(_item) for _item in obj["data"]] if obj.get("data") is not None else None + "previous_page_url": obj.get("previous_page_url") }) return _obj diff --git a/conekta/models/plan_request.py b/conekta/models/plan_request.py index 0b60dd2..b9177d4 100644 --- a/conekta/models/plan_request.py +++ b/conekta/models/plan_request.py @@ -23,21 +23,22 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanRequest(BaseModel): """ a plan """ # noqa: E501 - amount: Annotated[int, Field(strict=True, ge=1)] = Field(description="The amount in cents that will be charged on the interval specified.") - currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="ISO 4217 for currencies, for the Mexican peso it is MXN/USD") - expiry_count: Optional[StrictInt] = Field(default=None, description="Number of repetitions of the frequency NUMBER OF CHARGES TO BE MADE, considering the interval and frequency, this evolves over time, but is subject to the expiration count.") - frequency: Annotated[int, Field(strict=True, ge=1)] = Field(description="Frequency of the charge, which together with the interval, can be every 3 weeks, every 4 months, every 2 years, every 5 fortnights") - id: Optional[StrictStr] = Field(default=None, description="internal reference id") + amount: Annotated[int, Field(strict=True, ge=1)] = Field(description="The amount in cents that will be charged on the interval specified.", json_schema_extra={"examples": [10000]}) + currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="ISO 4217 for currencies, for the Mexican peso it is MXN/USD", json_schema_extra={"examples": ["MXN"]}) + expiry_count: Optional[StrictInt] = Field(default=None, description="Number of repetitions of the frequency NUMBER OF CHARGES TO BE MADE, considering the interval and frequency, this evolves over time, but is subject to the expiration count.", json_schema_extra={"examples": [12]}) + frequency: Annotated[int, Field(strict=True, ge=1)] = Field(description="Frequency of the charge, which together with the interval, can be every 3 weeks, every 4 months, every 2 years, every 5 fortnights", json_schema_extra={"examples": [1]}) + id: Optional[StrictStr] = Field(default=None, description="internal reference id", json_schema_extra={"examples": ["plan_24234"]}) interval: StrictStr = Field(description="The interval of time between each charge.") - name: StrictStr = Field(description="The name of the plan.") - trial_period_days: Optional[StrictInt] = Field(default=None, description="The number of days the customer will have a free trial.") - max_retries: Optional[Annotated[int, Field(strict=True, ge=3)]] = Field(default=None, description="(optional) Specifies the maximum number of retry attempts for a subscription payment before it is canceled.") - retry_delay_hours: Optional[Annotated[int, Field(strict=True, ge=48)]] = Field(default=None, description="(optional) Defines the number of hours between subscription payment retry attempts.") + name: StrictStr = Field(description="The name of the plan.", json_schema_extra={"examples": ["Extra Plan3"]}) + trial_period_days: Optional[StrictInt] = Field(default=None, description="The number of days the customer will have a free trial.", json_schema_extra={"examples": [0]}) + max_retries: Optional[Annotated[int, Field(strict=True, ge=3)]] = Field(default=None, description="(optional) Specifies the maximum number of retry attempts for a subscription payment before it is canceled.", json_schema_extra={"examples": [3]}) + retry_delay_hours: Optional[Annotated[int, Field(strict=True, ge=48)]] = Field(default=None, description="(optional) Defines the number of hours between subscription payment retry attempts.", json_schema_extra={"examples": [50]}) __properties: ClassVar[List[str]] = ["amount", "currency", "expiry_count", "frequency", "id", "interval", "name", "trial_period_days", "max_retries", "retry_delay_hours"] @field_validator('interval') @@ -48,7 +49,8 @@ def interval_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -60,8 +62,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/plan_response.py b/conekta/models/plan_response.py index 27bd197..cb24fdb 100644 --- a/conekta/models/plan_response.py +++ b/conekta/models/plan_response.py @@ -23,28 +23,30 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PlanResponse(BaseModel): """ plans model """ # noqa: E501 - amount: Optional[StrictInt] = None - created_at: Optional[StrictInt] = None - currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = None - expiry_count: Optional[StrictInt] = None - frequency: Optional[StrictInt] = None - id: Optional[StrictStr] = None - interval: Optional[StrictStr] = None - livemode: Optional[StrictBool] = None - name: Optional[StrictStr] = None - object: Optional[StrictStr] = None - trial_period_days: Optional[StrictInt] = None - max_retries: Optional[StrictInt] = None - retry_delay_hours: Optional[StrictInt] = None + amount: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [10000]}) + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1666900846]}) + currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, json_schema_extra={"examples": ["MXN"]}) + expiry_count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [12]}) + frequency: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["gold-plan"]}) + interval: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["month"]}) + livemode: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Extra Plan3"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["plan"]}) + trial_period_days: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) + max_retries: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [3]}) + retry_delay_hours: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [48]}) __properties: ClassVar[List[str]] = ["amount", "created_at", "currency", "expiry_count", "frequency", "id", "interval", "livemode", "name", "object", "trial_period_days", "max_retries", "retry_delay_hours"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -56,8 +58,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -82,16 +83,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if expiry_count (nullable) is None - # and model_fields_set contains the field - if self.expiry_count is None and "expiry_count" in self.model_fields_set: - _dict['expiry_count'] = None - - # set to None if trial_period_days (nullable) is None - # and model_fields_set contains the field - if self.trial_period_days is None and "trial_period_days" in self.model_fields_set: - _dict['trial_period_days'] = None - return _dict @classmethod diff --git a/conekta/models/product.py b/conekta/models/product.py index 3e2b030..523fed3 100644 --- a/conekta/models/product.py +++ b/conekta/models/product.py @@ -23,24 +23,26 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Product(BaseModel): """ Product """ # noqa: E501 - antifraud_info: Optional[Dict[str, Any]] = None - brand: Optional[StrictStr] = Field(default=None, description="The brand of the item.") - description: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, description="Short description of the item") - metadata: Optional[Dict[str, Any]] = Field(default=None, description="It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters.") - name: StrictStr = Field(description="The name of the item. It will be displayed in the order.") - quantity: Annotated[int, Field(strict=True, ge=1)] = Field(description="The quantity of the item in the order.") - sku: Optional[StrictStr] = Field(default=None, description="The stock keeping unit for the item. It is used to identify the item in the order.") - tags: Optional[List[StrictStr]] = Field(default=None, description="List of tags for the item. It is used to identify the item in the order.") - unit_price: Annotated[int, Field(strict=True, ge=0)] = Field(description="The price of the item in cents.") + antifraud_info: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"key": "value"}]}) + brand: Optional[StrictStr] = Field(default=None, description="The brand of the item.", json_schema_extra={"examples": ["Cohiba"]}) + description: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, description="Short description of the item", json_schema_extra={"examples": ["Imported From Mex."]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, description="It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters.", json_schema_extra={"examples": [{"key": "value"}]}) + name: StrictStr = Field(description="The name of the item. It will be displayed in the order.", json_schema_extra={"examples": ["Box of Cohiba S1s"]}) + quantity: Annotated[int, Field(strict=True, ge=1)] = Field(description="The quantity of the item in the order.", json_schema_extra={"examples": [1]}) + sku: Optional[StrictStr] = Field(default=None, description="The stock keeping unit for the item. It is used to identify the item in the order.", json_schema_extra={"examples": ["XYZ12345"]}) + tags: Optional[List[StrictStr]] = Field(default=None, description="List of tags for the item. It is used to identify the item in the order.", json_schema_extra={"examples": [["food", "mexican food"]]}) + unit_price: Annotated[int, Field(strict=True, ge=0)] = Field(description="The price of the item in cents.", json_schema_extra={"examples": [20000]}) __properties: ClassVar[List[str]] = ["antifraud_info", "brand", "description", "metadata", "name", "quantity", "sku", "tags", "unit_price"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/product_data_response.py b/conekta/models/product_data_response.py index b18d62e..fa72714 100644 --- a/conekta/models/product_data_response.py +++ b/conekta/models/product_data_response.py @@ -23,27 +23,29 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ProductDataResponse(BaseModel): """ ProductDataResponse """ # noqa: E501 - antifraud_info: Optional[Dict[str, Any]] = None - brand: Optional[StrictStr] = Field(default=None, description="The brand of the item.") - description: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, description="Short description of the item") - metadata: Optional[Dict[str, Any]] = Field(default=None, description="It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters.") - name: StrictStr = Field(description="The name of the item. It will be displayed in the order.") - quantity: Annotated[int, Field(strict=True, ge=1)] = Field(description="The quantity of the item in the order.") - sku: Optional[StrictStr] = Field(default=None, description="The stock keeping unit for the item. It is used to identify the item in the order.") - tags: Optional[List[StrictStr]] = Field(default=None, description="List of tags for the item. It is used to identify the item in the order.") - unit_price: Annotated[int, Field(strict=True, ge=0)] = Field(description="The price of the item in cents.") + antifraud_info: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"key": "value"}]}) + brand: Optional[StrictStr] = Field(default=None, description="The brand of the item.", json_schema_extra={"examples": ["Cohiba"]}) + description: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, description="Short description of the item", json_schema_extra={"examples": ["Imported From Mex."]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, description="It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters.", json_schema_extra={"examples": [{"key": "value"}]}) + name: StrictStr = Field(description="The name of the item. It will be displayed in the order.", json_schema_extra={"examples": ["Box of Cohiba S1s"]}) + quantity: Annotated[int, Field(strict=True, ge=1)] = Field(description="The quantity of the item in the order.", json_schema_extra={"examples": [1]}) + sku: Optional[StrictStr] = Field(default=None, description="The stock keeping unit for the item. It is used to identify the item in the order.", json_schema_extra={"examples": ["XYZ12345"]}) + tags: Optional[List[StrictStr]] = Field(default=None, description="List of tags for the item. It is used to identify the item in the order.", json_schema_extra={"examples": [["food", "mexican food"]]}) + unit_price: Annotated[int, Field(strict=True, ge=0)] = Field(description="The price of the item in cents.", json_schema_extra={"examples": [20000]}) id: Optional[StrictStr] = None object: Optional[StrictStr] = None parent_id: Optional[StrictStr] = None __properties: ClassVar[List[str]] = ["antifraud_info", "brand", "description", "metadata", "name", "quantity", "sku", "tags", "unit_price", "id", "object", "parent_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/product_order_response.py b/conekta/models/product_order_response.py index 86050fc..cd27931 100644 --- a/conekta/models/product_order_response.py +++ b/conekta/models/product_order_response.py @@ -23,27 +23,29 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ProductOrderResponse(BaseModel): """ ProductOrderResponse """ # noqa: E501 - antifraud_info: Optional[Dict[str, Any]] = None - brand: Optional[StrictStr] = Field(default=None, description="The brand of the item.") - description: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, description="Short description of the item") - metadata: Optional[Dict[str, Any]] = Field(default=None, description="It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters.") - name: StrictStr = Field(description="The name of the item. It will be displayed in the order.") - quantity: Annotated[int, Field(strict=True, ge=1)] = Field(description="The quantity of the item in the order.") - sku: Optional[StrictStr] = Field(default=None, description="The stock keeping unit for the item. It is used to identify the item in the order.") - tags: Optional[List[StrictStr]] = Field(default=None, description="List of tags for the item. It is used to identify the item in the order.") - unit_price: Annotated[int, Field(strict=True, ge=0)] = Field(description="The price of the item in cents.") + antifraud_info: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"key": "value"}]}) + brand: Optional[StrictStr] = Field(default=None, description="The brand of the item.", json_schema_extra={"examples": ["Cohiba"]}) + description: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, description="Short description of the item", json_schema_extra={"examples": ["Imported From Mex."]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, description="It is a key/value hash that can hold custom fields. Maximum 100 elements and allows special characters.", json_schema_extra={"examples": [{"key": "value"}]}) + name: StrictStr = Field(description="The name of the item. It will be displayed in the order.", json_schema_extra={"examples": ["Box of Cohiba S1s"]}) + quantity: Annotated[int, Field(strict=True, ge=1)] = Field(description="The quantity of the item in the order.", json_schema_extra={"examples": [1]}) + sku: Optional[StrictStr] = Field(default=None, description="The stock keeping unit for the item. It is used to identify the item in the order.", json_schema_extra={"examples": ["XYZ12345"]}) + tags: Optional[List[StrictStr]] = Field(default=None, description="List of tags for the item. It is used to identify the item in the order.", json_schema_extra={"examples": [["food", "mexican food"]]}) + unit_price: Annotated[int, Field(strict=True, ge=0)] = Field(description="The price of the item in cents.", json_schema_extra={"examples": [20000]}) id: Optional[StrictStr] = None object: Optional[StrictStr] = None parent_id: Optional[StrictStr] = None __properties: ClassVar[List[str]] = ["antifraud_info", "brand", "description", "metadata", "name", "quantity", "sku", "tags", "unit_price", "id", "object", "parent_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/resend_request.py b/conekta/models/resend_event_request.py similarity index 81% rename from conekta/models/resend_request.py rename to conekta/models/resend_event_request.py index 5f4593e..8290594 100644 --- a/conekta/models/resend_request.py +++ b/conekta/models/resend_event_request.py @@ -22,16 +22,18 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class ResendRequest(BaseModel): +class ResendEventRequest(BaseModel): """ - ResendRequest + ResendEventRequest """ # noqa: E501 - webhooks_ids: List[StrictStr] = Field(description="webhooks ids to resend event") + webhooks_ids: List[StrictStr] = Field(description="webhooks ids to resend event", json_schema_extra={"examples": [["6307a60c41de27127515a575", "6307a60c41de27127515a571"]]}) __properties: ClassVar[List[str]] = ["webhooks_ids"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,12 +45,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ResendRequest from a JSON string""" + """Create an instance of ResendEventRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,7 +74,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ResendRequest from a dict""" + """Create an instance of ResendEventRequest from a dict""" if obj is None: return None diff --git a/conekta/models/risk_rules_data.py b/conekta/models/risk_rules_data.py index 3301abc..f586f42 100644 --- a/conekta/models/risk_rules_data.py +++ b/conekta/models/risk_rules_data.py @@ -22,22 +22,24 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RiskRulesData(BaseModel): """ RiskRulesData """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="rule id") - var_field: Optional[StrictStr] = Field(default=None, description="field to be used for the rule", alias="field") - created_at: Optional[StrictStr] = Field(default=None, description="rule creation date") - value: Optional[StrictStr] = Field(default=None, description="value to be used for the rule") - is_global: Optional[StrictBool] = Field(default=None, description="if the rule is global") - is_test: Optional[StrictBool] = Field(default=None, description="if the rule is test") - description: Optional[StrictStr] = Field(default=None, description="description of the rule") + id: Optional[StrictStr] = Field(default=None, description="rule id", json_schema_extra={"examples": ["618c3f2fdb8b8da9be376af9"]}) + var_field: Optional[StrictStr] = Field(default=None, description="field to be used for the rule", alias="field", json_schema_extra={"examples": ["email"]}) + created_at: Optional[StrictStr] = Field(default=None, description="rule creation date", json_schema_extra={"examples": ["2021-11-10T21:52:47.339+00:00"]}) + value: Optional[StrictStr] = Field(default=None, description="value to be used for the rule", json_schema_extra={"examples": ["email@example.com"]}) + is_global: Optional[StrictBool] = Field(default=None, description="if the rule is global", json_schema_extra={"examples": [False]}) + is_test: Optional[StrictBool] = Field(default=None, description="if the rule is test", json_schema_extra={"examples": [False]}) + description: Optional[StrictStr] = Field(default=None, description="description of the rule", json_schema_extra={"examples": ["secure customer example@example.com"]}) __properties: ClassVar[List[str]] = ["id", "field", "created_at", "value", "is_global", "is_test", "description"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/risk_rules_list.py b/conekta/models/risk_rules_list.py index f76328a..00c86aa 100644 --- a/conekta/models/risk_rules_list.py +++ b/conekta/models/risk_rules_list.py @@ -23,20 +23,22 @@ from conekta.models.risk_rules_data import RiskRulesData from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RiskRulesList(BaseModel): """ RiskRulesList """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[RiskRulesData]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/shipping_lines_data_response.py b/conekta/models/shipping_lines_data_response.py new file mode 100644 index 0000000..52e69db --- /dev/null +++ b/conekta/models/shipping_lines_data_response.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class ShippingLinesDataResponse(BaseModel): + """ + ShippingLinesDataResponse + """ # noqa: E501 + amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="Shipping amount in cents", json_schema_extra={"examples": [100]}) + carrier: Optional[StrictStr] = Field(default=None, description="Carrier name for the shipment", json_schema_extra={"examples": ["FEDEX"]}) + tracking_number: Optional[StrictStr] = Field(default=None, description="Tracking number can be used to track the shipment", json_schema_extra={"examples": ["TRACK123"]}) + method: Optional[StrictStr] = Field(default=None, description="Method of shipment", json_schema_extra={"examples": ["Same day"]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, description="Hash where the user can send additional information for each 'shipping'.", json_schema_extra={"examples": [{"key": "value"}]}) + id: Optional[StrictStr] = None + object: Optional[StrictStr] = None + parent_id: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["amount", "carrier", "tracking_number", "method", "metadata", "id", "object", "parent_id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ShippingLinesDataResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ShippingLinesDataResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "carrier": obj.get("carrier"), + "tracking_number": obj.get("tracking_number"), + "method": obj.get("method"), + "metadata": obj.get("metadata"), + "id": obj.get("id"), + "object": obj.get("object"), + "parent_id": obj.get("parent_id") + }) + return _obj + + diff --git a/conekta/models/shipping_order_response.py b/conekta/models/shipping_order_response.py index 7382942..52fa73a 100644 --- a/conekta/models/shipping_order_response.py +++ b/conekta/models/shipping_order_response.py @@ -23,23 +23,25 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ShippingOrderResponse(BaseModel): """ ShippingOrderResponse """ # noqa: E501 - amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="Shipping amount in cents") - carrier: Optional[StrictStr] = Field(default=None, description="Carrier name for the shipment") - tracking_number: Optional[StrictStr] = Field(default=None, description="Tracking number can be used to track the shipment") - method: Optional[StrictStr] = Field(default=None, description="Method of shipment") - metadata: Optional[Dict[str, Any]] = Field(default=None, description="Hash where the user can send additional information for each 'shipping'.") + amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="Shipping amount in cents", json_schema_extra={"examples": [100]}) + carrier: Optional[StrictStr] = Field(default=None, description="Carrier name for the shipment", json_schema_extra={"examples": ["FEDEX"]}) + tracking_number: Optional[StrictStr] = Field(default=None, description="Tracking number can be used to track the shipment", json_schema_extra={"examples": ["TRACK123"]}) + method: Optional[StrictStr] = Field(default=None, description="Method of shipment", json_schema_extra={"examples": ["Same day"]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, description="Hash where the user can send additional information for each 'shipping'.", json_schema_extra={"examples": [{"key": "value"}]}) id: Optional[StrictStr] = None object: Optional[StrictStr] = None parent_id: Optional[StrictStr] = None __properties: ClassVar[List[str]] = ["amount", "carrier", "tracking_number", "method", "metadata", "id", "object", "parent_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,8 +53,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/shipping_request.py b/conekta/models/shipping_request.py index bc3c0a6..d4aeb4e 100644 --- a/conekta/models/shipping_request.py +++ b/conekta/models/shipping_request.py @@ -23,20 +23,22 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ShippingRequest(BaseModel): """ ShippingRequest """ # noqa: E501 - amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="Shipping amount in cents") - carrier: Optional[StrictStr] = Field(default=None, description="Carrier name for the shipment") - tracking_number: Optional[StrictStr] = Field(default=None, description="Tracking number can be used to track the shipment") - method: Optional[StrictStr] = Field(default=None, description="Method of shipment") - metadata: Optional[Dict[str, Any]] = Field(default=None, description="Hash where the user can send additional information for each 'shipping'.") + amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="Shipping amount in cents", json_schema_extra={"examples": [100]}) + carrier: Optional[StrictStr] = Field(default=None, description="Carrier name for the shipment", json_schema_extra={"examples": ["FEDEX"]}) + tracking_number: Optional[StrictStr] = Field(default=None, description="Tracking number can be used to track the shipment", json_schema_extra={"examples": ["TRACK123"]}) + method: Optional[StrictStr] = Field(default=None, description="Method of shipment", json_schema_extra={"examples": ["Same day"]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, description="Hash where the user can send additional information for each 'shipping'.", json_schema_extra={"examples": [{"key": "value"}]}) __properties: ClassVar[List[str]] = ["amount", "carrier", "tracking_number", "method", "metadata"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/sms_checkout_request.py b/conekta/models/sms_checkout_request.py index 4d07a55..38eb278 100644 --- a/conekta/models/sms_checkout_request.py +++ b/conekta/models/sms_checkout_request.py @@ -18,20 +18,22 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SmsCheckoutRequest(BaseModel): """ SmsCheckoutRequest """ # noqa: E501 - phonenumber: StrictStr + phonenumber: StrictStr = Field(json_schema_extra={"examples": ["5566982090"]}) __properties: ClassVar[List[str]] = ["phonenumber"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/subscription_details.py b/conekta/models/subscription_details.py new file mode 100644 index 0000000..cab5ec6 --- /dev/null +++ b/conekta/models/subscription_details.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from conekta.models.subscription_details_card import SubscriptionDetailsCard +from conekta.models.subscription_details_plan import SubscriptionDetailsPlan +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SubscriptionDetails(BaseModel): + """ + Subscription details for customer portal + """ # noqa: E501 + card: Optional[SubscriptionDetailsCard] = None + plan: Optional[SubscriptionDetailsPlan] = None + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["sub_2yYsQuYtXAbP1fdYu"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["subscription"]}) + status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["canceled"]}) + plan_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["VG5"]}) + customer_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2yDzKtEAD3khH8Sga"]}) + next_billing_cycle: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1876833632]}) + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1755873642]}) + updated_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1761745218]}) + __properties: ClassVar[List[str]] = ["card", "plan", "id", "object", "status", "plan_id", "customer_id", "next_billing_cycle", "created_at", "updated_at"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubscriptionDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of card + if self.card: + _dict['card'] = self.card.to_dict() + # override the default output from pydantic by calling `to_dict()` of plan + if self.plan: + _dict['plan'] = self.plan.to_dict() + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubscriptionDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "card": SubscriptionDetailsCard.from_dict(obj["card"]) if obj.get("card") is not None else None, + "plan": SubscriptionDetailsPlan.from_dict(obj["plan"]) if obj.get("plan") is not None else None, + "id": obj.get("id"), + "object": obj.get("object"), + "status": obj.get("status"), + "plan_id": obj.get("plan_id"), + "customer_id": obj.get("customer_id"), + "next_billing_cycle": obj.get("next_billing_cycle"), + "created_at": obj.get("created_at"), + "updated_at": obj.get("updated_at") + }) + return _obj + + diff --git a/conekta/models/subscription_details_card.py b/conekta/models/subscription_details_card.py new file mode 100644 index 0000000..d033601 --- /dev/null +++ b/conekta/models/subscription_details_card.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SubscriptionDetailsCard(BaseModel): + """ + SubscriptionDetailsCard + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["src_2yw5zPrVahTy7xy7P"]}) + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1761745218]}) + active: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["card"]}) + exp_month: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["05"]}) + exp_year: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["26"]}) + brand: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["mastercard"]}) + last4: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["1005"]}) + name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["test"]}) + payment_source_status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["active"]}) + customer_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2yDzKtEAD3khH8Sga"]}) + customer_custom_reference: Optional[StrictStr] = None + __properties: ClassVar[List[str]] = ["id", "created_at", "active", "object", "exp_month", "exp_year", "brand", "last4", "name", "payment_source_status", "customer_id", "customer_custom_reference"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubscriptionDetailsCard from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubscriptionDetailsCard from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "created_at": obj.get("created_at"), + "active": obj.get("active"), + "object": obj.get("object"), + "exp_month": obj.get("exp_month"), + "exp_year": obj.get("exp_year"), + "brand": obj.get("brand"), + "last4": obj.get("last4"), + "name": obj.get("name"), + "payment_source_status": obj.get("payment_source_status"), + "customer_id": obj.get("customer_id"), + "customer_custom_reference": obj.get("customer_custom_reference") + }) + return _obj + + diff --git a/conekta/models/subscription_details_plan.py b/conekta/models/subscription_details_plan.py new file mode 100644 index 0000000..f24279e --- /dev/null +++ b/conekta/models/subscription_details_plan.py @@ -0,0 +1,107 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class SubscriptionDetailsPlan(BaseModel): + """ + SubscriptionDetailsPlan + """ # noqa: E501 + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["VG5"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["plan"]}) + name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["CLARO"]}) + amount: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [30000]}) + currency: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["USD"]}) + interval: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["month"]}) + frequency: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1]}) + trial_period_days: Optional[StrictInt] = None + expiry_count: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1]}) + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1742087277]}) + __properties: ClassVar[List[str]] = ["id", "object", "name", "amount", "currency", "interval", "frequency", "trial_period_days", "expiry_count", "created_at"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubscriptionDetailsPlan from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubscriptionDetailsPlan from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "object": obj.get("object"), + "name": obj.get("name"), + "amount": obj.get("amount"), + "currency": obj.get("currency"), + "interval": obj.get("interval"), + "frequency": obj.get("frequency"), + "trial_period_days": obj.get("trial_period_days"), + "expiry_count": obj.get("expiry_count"), + "created_at": obj.get("created_at") + }) + return _obj + + diff --git a/conekta/models/subscription_events_response.py b/conekta/models/subscription_events_response.py index d293403..5242a28 100644 --- a/conekta/models/subscription_events_response.py +++ b/conekta/models/subscription_events_response.py @@ -23,20 +23,22 @@ from conekta.models.event_response import EventResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SubscriptionEventsResponse(BaseModel): """ SubscriptionEventsResponse """ # noqa: E501 - has_more: StrictBool = Field(description="Indicates if there are more pages to be requested") - object: StrictStr = Field(description="Object type, in this case is list") - next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.") - previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.") + has_more: StrictBool = Field(description="Indicates if there are more pages to be requested", json_schema_extra={"examples": [False]}) + object: StrictStr = Field(description="Object type, in this case is list", json_schema_extra={"examples": ["list"]}) + next_page_url: Optional[StrictStr] = Field(default=None, description="URL of the next page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&next=chrg_1"]}) + previous_page_url: Optional[StrictStr] = Field(default=None, description="Url of the previous page.", json_schema_extra={"examples": ["https://api.conekta.io/resources?limit=10&previous=chrg_1"]}) data: Optional[List[EventResponse]] = None __properties: ClassVar[List[str]] = ["has_more", "object", "next_page_url", "previous_page_url", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -81,16 +82,6 @@ def to_dict(self) -> Dict[str, Any]: if _item_data: _items.append(_item_data.to_dict()) _dict['data'] = _items - # set to None if next_page_url (nullable) is None - # and model_fields_set contains the field - if self.next_page_url is None and "next_page_url" in self.model_fields_set: - _dict['next_page_url'] = None - - # set to None if previous_page_url (nullable) is None - # and model_fields_set contains the field - if self.previous_page_url is None and "previous_page_url" in self.model_fields_set: - _dict['previous_page_url'] = None - return _dict @classmethod diff --git a/conekta/models/subscription_request.py b/conekta/models/subscription_request.py index 561dafc..e5c9471 100644 --- a/conekta/models/subscription_request.py +++ b/conekta/models/subscription_request.py @@ -18,22 +18,24 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SubscriptionRequest(BaseModel): """ It is a parameter that allows to identify in the response, the detailed content of the plans to which the client has subscribed """ # noqa: E501 - plan_id: StrictStr - card_id: Optional[StrictStr] = None - trial_end: Optional[StrictInt] = None + plan_id: StrictStr = Field(json_schema_extra={"examples": ["f84gdgf5g48r15fd21g8w424fd1"]}) + card_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["src_2qUCNd5AyQqfPMBuV"]}) + trial_end: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1484040996]}) __properties: ClassVar[List[str]] = ["plan_id", "card_id", "trial_end"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/subscription_response.py b/conekta/models/subscription_response.py index e313d85..6948d39 100644 --- a/conekta/models/subscription_response.py +++ b/conekta/models/subscription_response.py @@ -22,33 +22,35 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SubscriptionResponse(BaseModel): """ subscription model """ # noqa: E501 - billing_cycle_start: Optional[StrictInt] = None - billing_cycle_end: Optional[StrictInt] = None - canceled_at: Optional[StrictInt] = None - canceled_reason: Optional[StrictStr] = Field(default=None, description="Reason for cancellation. This field appears when the subscription status is 'canceled'.") - card_id: Optional[StrictStr] = None - charge_id: Optional[StrictStr] = None - created_at: Optional[StrictInt] = None - customer_custom_reference: Optional[StrictStr] = None - customer_id: Optional[StrictStr] = None - id: Optional[StrictStr] = None - last_billing_cycle_order_id: Optional[StrictStr] = None - object: Optional[StrictStr] = None - paused_at: Optional[StrictInt] = None - plan_id: Optional[StrictStr] = None - status: Optional[StrictStr] = None - subscription_start: Optional[StrictInt] = None - trial_start: Optional[StrictInt] = None - trial_end: Optional[StrictInt] = None + billing_cycle_start: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626827]}) + billing_cycle_end: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626827]}) + canceled_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1678258162]}) + canceled_reason: Optional[StrictStr] = Field(default=None, description="Reason for cancellation. This field appears when the subscription status is 'canceled'.", json_schema_extra={"examples": ["user_cancelation"]}) + card_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["src_2tKcHxhTz7xU5SymL"]}) + charge_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["2tKcHxhTz7xU5SymL"]}) + created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626837]}) + customer_custom_reference: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["dotnet_123456"]}) + customer_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2tKcHxhTz7xU5SymF"]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["gold-plan"]}) + last_billing_cycle_order_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["ord_2tSoMP7bZJbLiq4z8"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["subscription"]}) + paused_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1678258162]}) + plan_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["plan_2tXx672QLQ68CkmMn"]}) + status: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["past_due"]}) + subscription_start: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626837]}) + trial_start: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626837]}) + trial_end: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1677626837]}) __properties: ClassVar[List[str]] = ["billing_cycle_start", "billing_cycle_end", "canceled_at", "canceled_reason", "card_id", "charge_id", "created_at", "customer_custom_reference", "customer_id", "id", "last_billing_cycle_order_id", "object", "paused_at", "plan_id", "status", "subscription_start", "trial_start", "trial_end"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -60,8 +62,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -86,41 +87,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if billing_cycle_start (nullable) is None - # and model_fields_set contains the field - if self.billing_cycle_start is None and "billing_cycle_start" in self.model_fields_set: - _dict['billing_cycle_start'] = None - - # set to None if billing_cycle_end (nullable) is None - # and model_fields_set contains the field - if self.billing_cycle_end is None and "billing_cycle_end" in self.model_fields_set: - _dict['billing_cycle_end'] = None - - # set to None if canceled_at (nullable) is None - # and model_fields_set contains the field - if self.canceled_at is None and "canceled_at" in self.model_fields_set: - _dict['canceled_at'] = None - - # set to None if charge_id (nullable) is None - # and model_fields_set contains the field - if self.charge_id is None and "charge_id" in self.model_fields_set: - _dict['charge_id'] = None - - # set to None if paused_at (nullable) is None - # and model_fields_set contains the field - if self.paused_at is None and "paused_at" in self.model_fields_set: - _dict['paused_at'] = None - - # set to None if trial_start (nullable) is None - # and model_fields_set contains the field - if self.trial_start is None and "trial_start" in self.model_fields_set: - _dict['trial_start'] = None - - # set to None if trial_end (nullable) is None - # and model_fields_set contains the field - if self.trial_end is None and "trial_end" in self.model_fields_set: - _dict['trial_end'] = None - return _dict @classmethod diff --git a/conekta/models/tax_lines_data_response.py b/conekta/models/tax_lines_data_response.py new file mode 100644 index 0000000..807cb6c --- /dev/null +++ b/conekta/models/tax_lines_data_response.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self +from pydantic_core import to_jsonable_python + +class TaxLinesDataResponse(BaseModel): + """ + TaxLinesDataResponse + """ # noqa: E501 + amount: Annotated[int, Field(strict=True, ge=0)] = Field(description="The amount to be collected for tax in cents", json_schema_extra={"examples": [100]}) + description: Annotated[str, Field(min_length=2, strict=True)] = Field(description="description or tax's name", json_schema_extra={"examples": ["testing"]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"key": "value"}]}) + id: StrictStr = Field(json_schema_extra={"examples": ["tax_lin_2tQ8dC5mg1UADmVPo"]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["tax_line"]}) + parent_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["ord_2tPAmKCEJqh8RE6nY"]}) + __properties: ClassVar[List[str]] = ["amount", "description", "metadata", "id", "object", "parent_id"] + + model_config = ConfigDict( + validate_by_name=True, + validate_by_alias=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + return json.dumps(to_jsonable_python(self.to_dict())) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TaxLinesDataResponse from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([ + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TaxLinesDataResponse from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "amount": obj.get("amount"), + "description": obj.get("description"), + "metadata": obj.get("metadata"), + "id": obj.get("id"), + "object": obj.get("object"), + "parent_id": obj.get("parent_id") + }) + return _obj + + diff --git a/conekta/models/token.py b/conekta/models/token_request.py similarity index 67% rename from conekta/models/token.py rename to conekta/models/token_request.py index 9ea374d..7ea52fe 100644 --- a/conekta/models/token.py +++ b/conekta/models/token_request.py @@ -20,21 +20,23 @@ from pydantic import BaseModel, ConfigDict from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.token_card import TokenCard -from conekta.models.token_checkout import TokenCheckout +from conekta.models.token_request_card import TokenRequestCard +from conekta.models.token_request_checkout import TokenRequestCheckout from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class Token(BaseModel): +class TokenRequest(BaseModel): """ a token """ # noqa: E501 - card: Optional[TokenCard] = None - checkout: Optional[TokenCheckout] = None + card: Optional[TokenRequestCard] = None + checkout: Optional[TokenRequestCheckout] = None __properties: ClassVar[List[str]] = ["card", "checkout"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,12 +48,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of Token from a JSON string""" + """Create an instance of TokenRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -78,21 +79,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of checkout if self.checkout: _dict['checkout'] = self.checkout.to_dict() - # set to None if card (nullable) is None - # and model_fields_set contains the field - if self.card is None and "card" in self.model_fields_set: - _dict['card'] = None - - # set to None if checkout (nullable) is None - # and model_fields_set contains the field - if self.checkout is None and "checkout" in self.model_fields_set: - _dict['checkout'] = None - return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of Token from a dict""" + """Create an instance of TokenRequest from a dict""" if obj is None: return None @@ -100,8 +91,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "card": TokenCard.from_dict(obj["card"]) if obj.get("card") is not None else None, - "checkout": TokenCheckout.from_dict(obj["checkout"]) if obj.get("checkout") is not None else None + "card": TokenRequestCard.from_dict(obj["card"]) if obj.get("card") is not None else None, + "checkout": TokenRequestCheckout.from_dict(obj["checkout"]) if obj.get("checkout") is not None else None }) return _obj diff --git a/conekta/models/token_card.py b/conekta/models/token_request_card.py similarity index 78% rename from conekta/models/token_card.py rename to conekta/models/token_request_card.py index d7539c5..8862935 100644 --- a/conekta/models/token_card.py +++ b/conekta/models/token_request_card.py @@ -23,21 +23,23 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class TokenCard(BaseModel): +class TokenRequestCard(BaseModel): """ - TokenCard + TokenRequestCard """ # noqa: E501 - cvc: Annotated[str, Field(strict=True, max_length=4)] = Field(description="It is a value that allows identifying the security code of the card.") - device_fingerprint: Optional[StrictStr] = Field(default=None, description="It is a value that allows identifying the device fingerprint.") - exp_month: Annotated[str, Field(strict=True, max_length=2)] = Field(description="It is a value that allows identifying the expiration month of the card.") - exp_year: Annotated[str, Field(strict=True, max_length=2)] = Field(description="It is a value that allows identifying the expiration year of the card.") - name: StrictStr = Field(description="It is a value that allows identifying the name of the cardholder.") - number: StrictStr = Field(description="It is a value that allows identifying the number of the card.") + cvc: Annotated[str, Field(strict=True, max_length=4)] = Field(description="It is a value that allows identifying the security code of the card.", json_schema_extra={"examples": ["123"]}) + device_fingerprint: Optional[StrictStr] = Field(default=None, description="It is a value that allows identifying the device fingerprint.", json_schema_extra={"examples": ["zptcxk4p6w1ijwz85snf1l3bqe5g09ie"]}) + exp_month: Annotated[str, Field(strict=True, max_length=2)] = Field(description="It is a value that allows identifying the expiration month of the card.", json_schema_extra={"examples": ["12"]}) + exp_year: Annotated[str, Field(strict=True, max_length=2)] = Field(description="It is a value that allows identifying the expiration year of the card.", json_schema_extra={"examples": ["26"]}) + name: StrictStr = Field(description="It is a value that allows identifying the name of the cardholder.", json_schema_extra={"examples": ["Miguel"]}) + number: StrictStr = Field(description="It is a value that allows identifying the number of the card.", json_schema_extra={"examples": ["4242424242424242"]}) __properties: ClassVar[List[str]] = ["cvc", "device_fingerprint", "exp_month", "exp_year", "name", "number"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,12 +51,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of TokenCard from a JSON string""" + """Create an instance of TokenRequestCard from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -79,7 +80,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of TokenCard from a dict""" + """Create an instance of TokenRequestCard from a dict""" if obj is None: return None diff --git a/conekta/models/token_checkout.py b/conekta/models/token_request_checkout.py similarity index 83% rename from conekta/models/token_checkout.py rename to conekta/models/token_request_checkout.py index 64bb8a7..59a92d3 100644 --- a/conekta/models/token_checkout.py +++ b/conekta/models/token_request_checkout.py @@ -22,16 +22,18 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class TokenCheckout(BaseModel): +class TokenRequestCheckout(BaseModel): """ - TokenCheckout + TokenRequestCheckout """ # noqa: E501 - returns_control_on: Optional[StrictStr] = Field(default=None, description="It is a value that allows identifying the returns control on.") + returns_control_on: Optional[StrictStr] = Field(default=None, description="It is a value that allows identifying the returns control on.", json_schema_extra={"examples": ["Token"]}) __properties: ClassVar[List[str]] = ["returns_control_on"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,12 +45,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of TokenCheckout from a JSON string""" + """Create an instance of TokenRequestCheckout from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -73,7 +74,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of TokenCheckout from a dict""" + """Create an instance of TokenRequestCheckout from a dict""" if obj is None: return None diff --git a/conekta/models/token_response.py b/conekta/models/token_response.py index e5750a2..7308525 100644 --- a/conekta/models/token_response.py +++ b/conekta/models/token_response.py @@ -23,20 +23,22 @@ from conekta.models.token_response_checkout import TokenResponseCheckout from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TokenResponse(BaseModel): """ token response """ # noqa: E501 checkout: Optional[TokenResponseCheckout] = None - id: StrictStr = Field(description="Unique identifier for the token generated by Conekta.") - livemode: StrictBool = Field(description="Indicates whether the token is in live mode or test mode.") - object: StrictStr = Field(description="Indicates the type of object, in this case token") - used: StrictBool = Field(description="Indicates if the token has been used") + id: StrictStr = Field(description="Unique identifier for the token generated by Conekta.", json_schema_extra={"examples": ["cus_2tHJfJ79KyUwpxTik"]}) + livemode: StrictBool = Field(description="Indicates whether the token is in live mode or test mode.", json_schema_extra={"examples": [True]}) + object: StrictStr = Field(description="Indicates the type of object, in this case token", json_schema_extra={"examples": ["token"]}) + used: StrictBool = Field(description="Indicates if the token has been used", json_schema_extra={"examples": [False]}) __properties: ClassVar[List[str]] = ["checkout", "id", "livemode", "object", "used"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,11 +78,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of checkout if self.checkout: _dict['checkout'] = self.checkout.to_dict() - # set to None if checkout (nullable) is None - # and model_fields_set contains the field - if self.checkout is None and "checkout" in self.model_fields_set: - _dict['checkout'] = None - return _dict @classmethod diff --git a/conekta/models/token_response_checkout.py b/conekta/models/token_response_checkout.py index 1a886b5..0b141a8 100644 --- a/conekta/models/token_response_checkout.py +++ b/conekta/models/token_response_checkout.py @@ -22,38 +22,40 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TokenResponseCheckout(BaseModel): """ TokenResponseCheckout """ # noqa: E501 allowed_payment_methods: Optional[List[StrictStr]] = None - can_not_expire: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout can not expire.") - emails_sent: Optional[StrictInt] = None + can_not_expire: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout can not expire.", json_schema_extra={"examples": [False]}) + emails_sent: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) exclude_card_networks: Optional[List[StrictStr]] = None - expires_at: Optional[StrictInt] = Field(default=None, description="Date and time when the checkout expires.") - failure_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer to if the payment process fails.") - force_3ds_flow: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout forces the 3DS flow.") - id: Optional[StrictStr] = None - livemode: Optional[StrictBool] = None - metadata: Optional[Dict[str, Any]] = None - monthly_installments_enabled: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout allows monthly installments.") + expires_at: Optional[StrictInt] = Field(default=None, description="Date and time when the checkout expires.", json_schema_extra={"examples": [1675715413]}) + failure_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer to if the payment process fails.", json_schema_extra={"examples": ["https://example.com/failure"]}) + force_3ds_flow: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout forces the 3DS flow.", json_schema_extra={"examples": [False]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["524f9d2f-8c2e-4e64-a33d-6006711a91bd"]}) + livemode: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [True]}) + metadata: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"key": "value"}]}) + monthly_installments_enabled: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout allows monthly installments.", json_schema_extra={"examples": [False]}) monthly_installments_options: Optional[List[StrictInt]] = Field(default=None, description="List of monthly installments options.") - name: Optional[StrictStr] = None - needs_shipping_contact: Optional[StrictBool] = None - object: Optional[StrictStr] = Field(default=None, description="Indicates the type of object, in this case checkout.") - on_demand_enabled: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout allows on demand payments.") - paid_payments_count: Optional[StrictInt] = Field(default=None, description="Number of payments that have been paid.") - recurrent: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout is recurrent.") - sms_sent: Optional[StrictInt] = None - starts_at: Optional[StrictInt] = Field(default=None, description="Date and time when the checkout starts.") - status: Optional[StrictStr] = Field(default=None, description="Status of the checkout.") - success_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer to after the payment process is completed.") - type: Optional[StrictStr] = Field(default=None, description="Type of checkout.") + name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["tok-2toNoPZpJgRU4PvgZ"]}) + needs_shipping_contact: Optional[StrictBool] = Field(default=None, json_schema_extra={"examples": [False]}) + object: Optional[StrictStr] = Field(default=None, description="Indicates the type of object, in this case checkout.", json_schema_extra={"examples": ["checkout"]}) + on_demand_enabled: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout allows on demand payments.", json_schema_extra={"examples": [False]}) + paid_payments_count: Optional[StrictInt] = Field(default=None, description="Number of payments that have been paid.", json_schema_extra={"examples": [0]}) + recurrent: Optional[StrictBool] = Field(default=None, description="Indicates if the checkout is recurrent.", json_schema_extra={"examples": [False]}) + sms_sent: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [0]}) + starts_at: Optional[StrictInt] = Field(default=None, description="Date and time when the checkout starts.", json_schema_extra={"examples": [1675715413]}) + status: Optional[StrictStr] = Field(default=None, description="Status of the checkout.", json_schema_extra={"examples": ["Issued"]}) + success_url: Optional[StrictStr] = Field(default=None, description="URL to redirect the customer to after the payment process is completed.", json_schema_extra={"examples": ["https://example.com/success"]}) + type: Optional[StrictStr] = Field(default=None, description="Type of checkout.", json_schema_extra={"examples": ["Integration"]}) __properties: ClassVar[List[str]] = ["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", "on_demand_enabled", "paid_payments_count", "recurrent", "sms_sent", "starts_at", "status", "success_url", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -65,8 +67,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/transaction_response.py b/conekta/models/transaction_response.py index fc26982..3e9cb18 100644 --- a/conekta/models/transaction_response.py +++ b/conekta/models/transaction_response.py @@ -23,26 +23,28 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransactionResponse(BaseModel): """ The Transaction object represents the actions or steps of an order. Statuses can be: unprocessed, pending, available, owen, paid_out, voided, capture, capture_reversal, liquidation, liquidation_reversal, payout, payout_reversal, refund, refund_reversal, chargeback, chargeback_reversal, rounding_adjustment, won_chargeback, transferred, and transferred. """ # noqa: E501 - amount: StrictInt = Field(description="The amount of the transaction.") - charge: StrictStr = Field(description="Randomly assigned unique order identifier associated with the charge.") - created_at: StrictInt = Field(description="Date and time of creation of the transaction in Unix format.") - currency: Annotated[str, Field(strict=True, max_length=3)] = Field(description="The currency of the transaction. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)") - fee: StrictInt = Field(description="The amount to be deducted for taxes and commissions.") - id: StrictStr = Field(description="Unique identifier of the transaction.") - livemode: StrictBool = Field(description="Indicates whether the transaction was created in live mode or test mode.") - net: StrictInt = Field(description="The net amount after deducting commissions and taxes.") - object: StrictStr = Field(description="Object name, which is transaction.") - status: StrictStr = Field(description="Code indicating transaction status.") - type: StrictStr = Field(description="Transaction Type") + amount: StrictInt = Field(description="The amount of the transaction.", json_schema_extra={"examples": [1000]}) + charge: StrictStr = Field(description="Randomly assigned unique order identifier associated with the charge.", json_schema_extra={"examples": ["5ee7ec58885a45585e6d9f8m"]}) + created_at: StrictInt = Field(description="Date and time of creation of the transaction in Unix format.", json_schema_extra={"examples": [1553273553]}) + currency: Annotated[str, Field(strict=True, max_length=3)] = Field(description="The currency of the transaction. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)", json_schema_extra={"examples": ["MXN"]}) + fee: StrictInt = Field(description="The amount to be deducted for taxes and commissions.", json_schema_extra={"examples": [560]}) + id: StrictStr = Field(description="Unique identifier of the transaction.", json_schema_extra={"examples": ["5ee7ec5b8dea41085erb7f9e"]}) + livemode: StrictBool = Field(description="Indicates whether the transaction was created in live mode or test mode.", json_schema_extra={"examples": [True]}) + net: StrictInt = Field(description="The net amount after deducting commissions and taxes.", json_schema_extra={"examples": [440]}) + object: StrictStr = Field(description="Object name, which is transaction.", json_schema_extra={"examples": ["transaction"]}) + status: StrictStr = Field(description="Code indicating transaction status.", json_schema_extra={"examples": ["pending"]}) + type: StrictStr = Field(description="Transaction Type", json_schema_extra={"examples": ["capture"]}) __properties: ClassVar[List[str]] = ["amount", "charge", "created_at", "currency", "fee", "id", "livemode", "net", "object", "status", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/transfer_destination_response.py b/conekta/models/transfer_destination_response.py index 8a67d5c..1ee70fd 100644 --- a/conekta/models/transfer_destination_response.py +++ b/conekta/models/transfer_destination_response.py @@ -22,23 +22,25 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransferDestinationResponse(BaseModel): """ Method used to make the transfer. """ # noqa: E501 - account_holder: Optional[StrictStr] = Field(default=None, description="Name of the account holder.") - account_number: Optional[StrictStr] = Field(default=None, description="Account number of the bank account.") - bank: Optional[StrictStr] = Field(default=None, description="Name of the bank.") - created_at: Optional[StrictInt] = Field(default=None, description="Date and time of creation of the transfer.") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the transfer.") - object: Optional[StrictStr] = Field(default=None, description="Object name, which is bank_transfer_payout_method.") - payee_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the payee.") - type: Optional[StrictStr] = Field(default=None, description="Type of the payee.") + account_holder: Optional[StrictStr] = Field(default=None, description="Name of the account holder.", json_schema_extra={"examples": ["John Doe"]}) + account_number: Optional[StrictStr] = Field(default=None, description="Account number of the bank account.", json_schema_extra={"examples": ["012180023547896764"]}) + bank: Optional[StrictStr] = Field(default=None, description="Name of the bank.", json_schema_extra={"examples": ["BBVA Bancomer"]}) + created_at: Optional[StrictInt] = Field(default=None, description="Date and time of creation of the transfer.", json_schema_extra={"examples": [1553273553]}) + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the transfer.", json_schema_extra={"examples": ["pytmtd_2ide3qwTdDvNBosEC"]}) + object: Optional[StrictStr] = Field(default=None, description="Object name, which is bank_transfer_payout_method.", json_schema_extra={"examples": ["bank_transfer_payout_method"]}) + payee_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the payee.", json_schema_extra={"examples": ["payee_2icdDewRxDENBos85"]}) + type: Optional[StrictStr] = Field(default=None, description="Type of the payee.", json_schema_extra={"examples": ["BankTransferPayoutMethod"]}) __properties: ClassVar[List[str]] = ["account_holder", "account_number", "bank", "created_at", "id", "object", "payee_id", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/transfer_method_response.py b/conekta/models/transfer_method_response.py index 65c6962..74fb3d8 100644 --- a/conekta/models/transfer_method_response.py +++ b/conekta/models/transfer_method_response.py @@ -22,23 +22,25 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransferMethodResponse(BaseModel): """ Method used to make the transfer. """ # noqa: E501 - account_holder: Optional[StrictStr] = Field(default=None, description="Name of the account holder.") - account_number: Optional[StrictStr] = Field(default=None, description="Account number of the bank account.") - bank: Optional[StrictStr] = Field(default=None, description="Name of the bank.") - created_at: Optional[StrictInt] = Field(default=None, description="Date and time of creation of the transfer.") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the transfer.") - object: Optional[StrictStr] = Field(default=None, description="Object name, which is bank_transfer_payout_method.") - payee_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the payee.") - type: Optional[StrictStr] = Field(default=None, description="Type of the payee.") + account_holder: Optional[StrictStr] = Field(default=None, description="Name of the account holder.", json_schema_extra={"examples": ["John Doe"]}) + account_number: Optional[StrictStr] = Field(default=None, description="Account number of the bank account.", json_schema_extra={"examples": ["012180023547896764"]}) + bank: Optional[StrictStr] = Field(default=None, description="Name of the bank.", json_schema_extra={"examples": ["BBVA Bancomer"]}) + created_at: Optional[StrictInt] = Field(default=None, description="Date and time of creation of the transfer.", json_schema_extra={"examples": [1553273553]}) + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the transfer.", json_schema_extra={"examples": ["pytmtd_2ide3qwTdDvNBosEC"]}) + object: Optional[StrictStr] = Field(default=None, description="Object name, which is bank_transfer_payout_method.", json_schema_extra={"examples": ["bank_transfer_payout_method"]}) + payee_id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the payee.", json_schema_extra={"examples": ["payee_2icdDewRxDENBos85"]}) + type: Optional[StrictStr] = Field(default=None, description="Type of the payee.", json_schema_extra={"examples": ["BankTransferPayoutMethod"]}) __properties: ClassVar[List[str]] = ["account_holder", "account_number", "bank", "created_at", "id", "object", "payee_id", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/transfer_response.py b/conekta/models/transfer_response.py index 3c4afa2..ba13ddc 100644 --- a/conekta/models/transfer_response.py +++ b/conekta/models/transfer_response.py @@ -24,25 +24,27 @@ from conekta.models.transfer_destination_response import TransferDestinationResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransferResponse(BaseModel): """ A transfer represents the action of sending an amount to a business bank account including the status, amount and method used to make the transfer. """ # noqa: E501 - amount: Optional[StrictInt] = Field(default=None, description="Amount in cents of the transfer.") - created_at: Optional[StrictInt] = Field(default=None, description="Date and time of creation of the transfer in Unix format.") - currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="The currency of the transfer. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the transfer.") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates whether the transfer was created in live mode or test mode.") + amount: Optional[StrictInt] = Field(default=None, description="Amount in cents of the transfer.", json_schema_extra={"examples": [10000]}) + created_at: Optional[StrictInt] = Field(default=None, description="Date and time of creation of the transfer in Unix format.", json_schema_extra={"examples": [1553273553]}) + currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="The currency of the transfer. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)", json_schema_extra={"examples": ["MXN"]}) + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the transfer.", json_schema_extra={"examples": ["5b0337d4dD344ef954fe1X4b6"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Indicates whether the transfer was created in live mode or test mode.", json_schema_extra={"examples": [True]}) destination: Optional[TransferDestinationResponse] = None - object: Optional[StrictStr] = Field(default=None, description="Object name, which is transfer.") - statement_description: Optional[StrictStr] = Field(default=None, description="Description of the transfer.") - statement_reference: Optional[StrictStr] = Field(default=None, description="Reference number of the transfer.") - status: Optional[StrictStr] = Field(default=None, description="Code indicating transfer status.") + object: Optional[StrictStr] = Field(default=None, description="Object name, which is transfer.", json_schema_extra={"examples": ["transfer"]}) + statement_description: Optional[StrictStr] = Field(default=None, description="Description of the transfer.", json_schema_extra={"examples": ["Conekta 4401234"]}) + statement_reference: Optional[StrictStr] = Field(default=None, description="Reference number of the transfer.", json_schema_extra={"examples": ["4401234"]}) + status: Optional[StrictStr] = Field(default=None, description="Code indicating transfer status.", json_schema_extra={"examples": ["pending"]}) __properties: ClassVar[List[str]] = ["amount", "created_at", "currency", "id", "livemode", "destination", "object", "statement_description", "statement_reference", "status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/transfers_response.py b/conekta/models/transfers_response.py index 6cef6f7..b47be90 100644 --- a/conekta/models/transfers_response.py +++ b/conekta/models/transfers_response.py @@ -24,25 +24,27 @@ from conekta.models.transfer_method_response import TransferMethodResponse from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransfersResponse(BaseModel): """ A transfer represents the action of sending an amount to a business bank account including the status, amount and method used to make the transfer. """ # noqa: E501 - amount: Optional[StrictInt] = Field(default=None, description="Amount in cents of the transfer.") - created_at: Optional[StrictInt] = Field(default=None, description="Date and time of creation of the transfer.") - currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="The currency of the transfer. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the transfer.") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates whether the transfer was created in live mode or test mode.") + amount: Optional[StrictInt] = Field(default=None, description="Amount in cents of the transfer.", json_schema_extra={"examples": [10000]}) + created_at: Optional[StrictInt] = Field(default=None, description="Date and time of creation of the transfer.", json_schema_extra={"examples": [1553273553]}) + currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="The currency of the transfer. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217)", json_schema_extra={"examples": ["MXN"]}) + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the transfer.", json_schema_extra={"examples": ["5b0337d4dD344ef954fe1X4b6"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Indicates whether the transfer was created in live mode or test mode.", json_schema_extra={"examples": [True]}) method: Optional[TransferMethodResponse] = None - object: Optional[StrictStr] = Field(default=None, description="Object name, which is transfer.") - statement_description: Optional[StrictStr] = Field(default=None, description="Description of the transfer.") - statement_reference: Optional[StrictStr] = Field(default=None, description="Reference number of the transfer.") - status: Optional[StrictStr] = Field(default=None, description="Code indicating transfer status.") + object: Optional[StrictStr] = Field(default=None, description="Object name, which is transfer.", json_schema_extra={"examples": ["transfer"]}) + statement_description: Optional[StrictStr] = Field(default=None, description="Description of the transfer.", json_schema_extra={"examples": ["Conekta 4401234"]}) + statement_reference: Optional[StrictStr] = Field(default=None, description="Reference number of the transfer.", json_schema_extra={"examples": ["4401234"]}) + status: Optional[StrictStr] = Field(default=None, description="Code indicating transfer status.", json_schema_extra={"examples": ["pending"]}) __properties: ClassVar[List[str]] = ["amount", "created_at", "currency", "id", "livemode", "method", "object", "statement_description", "statement_reference", "status"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/update_customer.py b/conekta/models/update_customer.py index 0b8a938..1405cfa 100644 --- a/conekta/models/update_customer.py +++ b/conekta/models/update_customer.py @@ -20,38 +20,40 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_fiscal_entities_request import CustomerFiscalEntitiesRequest from conekta.models.customer_payment_methods_request import CustomerPaymentMethodsRequest -from conekta.models.customer_shipping_contacts import CustomerShippingContacts +from conekta.models.customer_shipping_contacts_request import CustomerShippingContactsRequest +from conekta.models.fiscal_entity_request import FiscalEntityRequest from conekta.models.subscription_request import SubscriptionRequest from conekta.models.update_customer_antifraud_info import UpdateCustomerAntifraudInfo from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class UpdateCustomer(BaseModel): """ update customer """ # noqa: E501 antifraud_info: Optional[UpdateCustomerAntifraudInfo] = None - date_of_birth: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the date of birth of the client.") - default_payment_source_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id)") - email: Optional[StrictStr] = Field(default=None, description="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).") - name: Optional[StrictStr] = Field(default=None, description="Client's name") - phone: Optional[StrictStr] = Field(default=None, description="Is the customer's phone number") - plan_id: Optional[StrictStr] = Field(default=None, description="Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription") - default_shipping_contact_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact)") - corporate: Optional[StrictBool] = Field(default=False, description="It is a value that allows identifying if the email is corporate or not.") + date_of_birth: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the date of birth of the client.", json_schema_extra={"examples": ["24/07/1992"]}) + default_payment_source_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify in the response, the Conekta ID of a payment method (payment_id)", json_schema_extra={"examples": ["src_1a2b3c4d5e6f7g8h"]}) + email: Optional[StrictStr] = Field(default=None, description="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).", json_schema_extra={"examples": ["miguel@gmail.com"]}) + name: Optional[StrictStr] = Field(default=None, description="Client's name", json_schema_extra={"examples": ["miguel"]}) + phone: Optional[StrictStr] = Field(default=None, description="Is the customer's phone number", json_schema_extra={"examples": ["+5215555555555"]}) + plan_id: Optional[StrictStr] = Field(default=None, description="Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription", json_schema_extra={"examples": ["plan_987234823"]}) + default_shipping_contact_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact)", json_schema_extra={"examples": ["ship_cont_1a2b3c4d5e6f7g8h"]}) + corporate: Optional[StrictBool] = Field(default=False, description="It is a value that allows identifying if the email is corporate or not.", json_schema_extra={"examples": [False]}) custom_reference: Optional[StrictStr] = Field(default=None, description="It is an undefined value.") - fiscal_entities: Optional[List[CustomerFiscalEntitiesRequest]] = None + fiscal_entities: Optional[List[FiscalEntityRequest]] = None metadata: Optional[Dict[str, Any]] = None - national_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the national identification number of the client.") + national_id: Optional[StrictStr] = Field(default=None, description="It is a parameter that allows to identify the national identification number of the client.", json_schema_extra={"examples": ["HEGG560427MVZRRL04"]}) payment_sources: Optional[List[CustomerPaymentMethodsRequest]] = Field(default=None, description="Contains details of the payment methods that the customer has active or has used in Conekta") - shipping_contacts: Optional[List[CustomerShippingContacts]] = Field(default=None, description="Contains the detail of the shipping addresses that the client has active or has used in Conekta") + shipping_contacts: Optional[List[CustomerShippingContactsRequest]] = Field(default=None, description="Contains the detail of the shipping addresses that the client has active or has used in Conekta") subscription: Optional[SubscriptionRequest] = None __properties: ClassVar[List[str]] = ["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"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +65,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -116,11 +117,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of subscription if self.subscription: _dict['subscription'] = self.subscription.to_dict() - # set to None if antifraud_info (nullable) is None - # and model_fields_set contains the field - if self.antifraud_info is None and "antifraud_info" in self.model_fields_set: - _dict['antifraud_info'] = None - return _dict @classmethod @@ -143,11 +139,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "default_shipping_contact_id": obj.get("default_shipping_contact_id"), "corporate": obj.get("corporate") if obj.get("corporate") is not None else False, "custom_reference": obj.get("custom_reference"), - "fiscal_entities": [CustomerFiscalEntitiesRequest.from_dict(_item) for _item in obj["fiscal_entities"]] if obj.get("fiscal_entities") is not None else None, + "fiscal_entities": [FiscalEntityRequest.from_dict(_item) for _item in obj["fiscal_entities"]] if obj.get("fiscal_entities") is not None else None, "metadata": obj.get("metadata"), "national_id": obj.get("national_id"), "payment_sources": [CustomerPaymentMethodsRequest.from_dict(_item) for _item in obj["payment_sources"]] if obj.get("payment_sources") is not None else None, - "shipping_contacts": [CustomerShippingContacts.from_dict(_item) for _item in obj["shipping_contacts"]] if obj.get("shipping_contacts") is not None else None, + "shipping_contacts": [CustomerShippingContactsRequest.from_dict(_item) for _item in obj["shipping_contacts"]] if obj.get("shipping_contacts") is not None else None, "subscription": SubscriptionRequest.from_dict(obj["subscription"]) if obj.get("subscription") is not None else None }) return _obj diff --git a/conekta/models/update_customer_antifraud_info.py b/conekta/models/update_customer_antifraud_info.py index 6cc94b8..ff8d1ca 100644 --- a/conekta/models/update_customer_antifraud_info.py +++ b/conekta/models/update_customer_antifraud_info.py @@ -18,21 +18,23 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt +from pydantic import BaseModel, ConfigDict, Field, StrictInt from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class UpdateCustomerAntifraudInfo(BaseModel): """ UpdateCustomerAntifraudInfo """ # noqa: E501 - account_created_at: Optional[StrictInt] = None - first_paid_at: Optional[StrictInt] = None + account_created_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1484040996]}) + first_paid_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1485151007]}) __properties: ClassVar[List[str]] = ["account_created_at", "first_paid_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/update_customer_fiscal_entities_response.py b/conekta/models/update_customer_fiscal_entities_response.py index 561df3b..2554062 100644 --- a/conekta/models/update_customer_fiscal_entities_response.py +++ b/conekta/models/update_customer_fiscal_entities_response.py @@ -18,31 +18,33 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_address import CustomerAddress +from conekta.models.fiscal_entity_request_address import FiscalEntityRequestAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class UpdateCustomerFiscalEntitiesResponse(BaseModel): """ UpdateCustomerFiscalEntitiesResponse """ # noqa: E501 - address: CustomerAddress + address: FiscalEntityRequestAddress tax_id: Optional[StrictStr] = None email: Optional[StrictStr] = None phone: Optional[StrictStr] = None - metadata: Optional[Dict[str, Dict[str, Any]]] = None - company_name: Optional[StrictStr] = None - id: StrictStr - object: StrictStr - created_at: StrictInt - parent_id: Optional[StrictStr] = None + metadata: Optional[Any] = None + company_name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["conekta"]}) + id: StrictStr = Field(json_schema_extra={"examples": ["fis_ent_2tKZsTYcsryyu7Ah8"]}) + object: StrictStr = Field(json_schema_extra={"examples": ["fiscal_entities"]}) + created_at: StrictInt = Field(json_schema_extra={"examples": [1675715413]}) + parent_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["cus_2tKcHxhTz7xU5SymF"]}) default: Optional[StrictBool] = None __properties: ClassVar[List[str]] = ["address", "tax_id", "email", "phone", "metadata", "company_name", "id", "object", "created_at", "parent_id", "default"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -83,6 +84,11 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + return _dict @classmethod @@ -95,11 +101,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "address": CustomerAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": FiscalEntityRequestAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "tax_id": obj.get("tax_id"), "email": obj.get("email"), "phone": obj.get("phone"), - "metadata": obj.get("metadata"), "company_name": obj.get("company_name"), "id": obj.get("id"), "object": obj.get("object"), diff --git a/conekta/models/update_customer_payment_methods_response.py b/conekta/models/update_customer_payment_methods_response.py index 91fd1e1..4d21bc7 100644 --- a/conekta/models/update_customer_payment_methods_response.py +++ b/conekta/models/update_customer_payment_methods_response.py @@ -21,12 +21,12 @@ from conekta.models.payment_method_card_response import PaymentMethodCardResponse from conekta.models.payment_method_cash_recurrent_response import PaymentMethodCashRecurrentResponse from conekta.models.payment_method_cash_response import PaymentMethodCashResponse -from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent +from conekta.models.payment_method_spei_recurrent_response import PaymentMethodSpeiRecurrentResponse from pydantic import StrictStr, Field from typing import Union, List, Set, Optional, Dict from typing_extensions import Literal, Self -UPDATECUSTOMERPAYMENTMETHODSRESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent"] +UPDATECUSTOMERPAYMENTMETHODSRESPONSE_ONE_OF_SCHEMAS = ["PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrentResponse"] class UpdateCustomerPaymentMethodsResponse(BaseModel): """ @@ -38,10 +38,10 @@ class UpdateCustomerPaymentMethodsResponse(BaseModel): oneof_schema_2_validator: Optional[PaymentMethodCashRecurrentResponse] = None # data type: PaymentMethodCardResponse oneof_schema_3_validator: Optional[PaymentMethodCardResponse] = None - # data type: PaymentMethodSpeiRecurrent - oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrent] = None - actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]] = None - one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrent" } + # data type: PaymentMethodSpeiRecurrentResponse + oneof_schema_4_validator: Optional[PaymentMethodSpeiRecurrentResponse] = None + actual_instance: Optional[Union[PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse]] = None + one_of_schemas: Set[str] = { "PaymentMethodCardResponse", "PaymentMethodCashRecurrentResponse", "PaymentMethodCashResponse", "PaymentMethodSpeiRecurrentResponse" } model_config = ConfigDict( validate_assignment=True, @@ -82,17 +82,17 @@ def actual_instance_must_validate_oneof(cls, v): error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodCardResponse`") else: match += 1 - # validate data type: PaymentMethodSpeiRecurrent - if not isinstance(v, PaymentMethodSpeiRecurrent): - error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodSpeiRecurrent`") + # validate data type: PaymentMethodSpeiRecurrentResponse + if not isinstance(v, PaymentMethodSpeiRecurrentResponse): + error_messages.append(f"Error! Input type `{type(v)}` is not `PaymentMethodSpeiRecurrentResponse`") else: match += 1 if match > 1: # more than 1 match - raise ValueError("Multiple matches found when setting `actual_instance` in UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when setting `actual_instance` in UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when setting `actual_instance` in UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when setting `actual_instance` in UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) else: return v @@ -108,9 +108,10 @@ def from_json(cls, json_str: str) -> Self: match = 0 # use oneOf discriminator to lookup the data type - _data_type = json.loads(json_str).get("type") + _discriminator_property = "type" + _data_type = json.loads(json_str).get(_discriminator_property) if not _data_type: - raise ValueError("Failed to lookup data type from the field `type` in the input.") + raise ValueError(f"Failed to lookup data type from the field `{_discriminator_property}` in the input.") # check if data type is `PaymentMethodCardResponse` if _data_type == "card": @@ -127,29 +128,9 @@ def from_json(cls, json_str: str) -> Self: instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) return instance - # check if data type is `PaymentMethodSpeiRecurrent` + # check if data type is `PaymentMethodSpeiRecurrentResponse` if _data_type == "spei_recurrent": - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCardResponse` - if _data_type == "payment_method_card_response": - instance.actual_instance = PaymentMethodCardResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashRecurrentResponse` - if _data_type == "payment_method_cash_recurrent_response": - instance.actual_instance = PaymentMethodCashRecurrentResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodCashResponse` - if _data_type == "payment_method_cash_response": - instance.actual_instance = PaymentMethodCashResponse.from_json(json_str) - return instance - - # check if data type is `PaymentMethodSpeiRecurrent` - if _data_type == "payment_method_spei_recurrent": - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) + instance.actual_instance = PaymentMethodSpeiRecurrentResponse.from_json(json_str) return instance # deserialize data into PaymentMethodCashResponse @@ -170,19 +151,19 @@ def from_json(cls, json_str: str) -> Self: match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) - # deserialize data into PaymentMethodSpeiRecurrent + # deserialize data into PaymentMethodSpeiRecurrentResponse try: - instance.actual_instance = PaymentMethodSpeiRecurrent.from_json(json_str) + instance.actual_instance = PaymentMethodSpeiRecurrentResponse.from_json(json_str) match += 1 except (ValidationError, ValueError) as e: error_messages.append(str(e)) if match > 1: # more than 1 match - raise ValueError("Multiple matches found when deserializing the JSON string into UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("Multiple matches found when deserializing the JSON string into UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) elif match == 0: # no match - raise ValueError("No match found when deserializing the JSON string into UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent. Details: " + ", ".join(error_messages)) + raise ValueError("No match found when deserializing the JSON string into UpdateCustomerPaymentMethodsResponse with oneOf schemas: PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse. Details: " + ", ".join(error_messages)) else: return instance @@ -196,7 +177,7 @@ def to_json(self) -> str: else: return json.dumps(self.actual_instance) - def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrent]]: + def to_dict(self) -> Optional[Union[Dict[str, Any], PaymentMethodCardResponse, PaymentMethodCashRecurrentResponse, PaymentMethodCashResponse, PaymentMethodSpeiRecurrentResponse]]: """Returns the dict representation of the actual instance""" if self.actual_instance is None: return None diff --git a/conekta/models/customer_update_fiscal_entities_request.py b/conekta/models/update_fiscal_entity_request.py similarity index 69% rename from conekta/models/customer_update_fiscal_entities_request.py rename to conekta/models/update_fiscal_entity_request.py index 1e535a5..6d6d1d6 100644 --- a/conekta/models/customer_update_fiscal_entities_request.py +++ b/conekta/models/update_fiscal_entity_request.py @@ -18,26 +18,28 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictStr from typing import Any, ClassVar, Dict, List, Optional -from conekta.models.customer_address import CustomerAddress +from conekta.models.fiscal_entity_request_address import FiscalEntityRequestAddress from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class CustomerUpdateFiscalEntitiesRequest(BaseModel): +class UpdateFiscalEntityRequest(BaseModel): """ - CustomerUpdateFiscalEntitiesRequest + UpdateFiscalEntityRequest """ # noqa: E501 - address: Optional[CustomerAddress] = None + address: Optional[FiscalEntityRequestAddress] = None tax_id: Optional[StrictStr] = None email: Optional[StrictStr] = None phone: Optional[StrictStr] = None - metadata: Optional[Dict[str, Dict[str, Any]]] = None - company_name: Optional[StrictStr] = None + metadata: Optional[Any] = None + company_name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["conekta"]}) __properties: ClassVar[List[str]] = ["address", "tax_id", "email", "phone", "metadata", "company_name"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,12 +51,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of CustomerUpdateFiscalEntitiesRequest from a JSON string""" + """Create an instance of UpdateFiscalEntityRequest from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -78,11 +79,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of address if self.address: _dict['address'] = self.address.to_dict() + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + return _dict @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of CustomerUpdateFiscalEntitiesRequest from a dict""" + """Create an instance of UpdateFiscalEntityRequest from a dict""" if obj is None: return None @@ -90,11 +96,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "address": CustomerAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, + "address": FiscalEntityRequestAddress.from_dict(obj["address"]) if obj.get("address") is not None else None, "tax_id": obj.get("tax_id"), "email": obj.get("email"), "phone": obj.get("phone"), - "metadata": obj.get("metadata"), "company_name": obj.get("company_name") }) return _obj diff --git a/conekta/models/update_order_discount_lines_request.py b/conekta/models/update_order_discount_lines_request.py index ab507db..4beb79e 100644 --- a/conekta/models/update_order_discount_lines_request.py +++ b/conekta/models/update_order_discount_lines_request.py @@ -23,18 +23,20 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class UpdateOrderDiscountLinesRequest(BaseModel): """ List of discounts that apply to the order. """ # noqa: E501 - amount: Optional[Annotated[int, Field(strict=True, ge=0)]] = None - code: Optional[StrictStr] = Field(default=None, description="Discount code.") - type: Optional[StrictStr] = None + amount: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, json_schema_extra={"examples": [500]}) + code: Optional[StrictStr] = Field(default=None, description="Discount code.", json_schema_extra={"examples": ["123"]}) + type: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["loyalty"]}) __properties: ClassVar[List[str]] = ["amount", "code", "type"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/update_payment_methods.py b/conekta/models/update_payment_methods_card.py similarity index 80% rename from conekta/models/update_payment_methods.py rename to conekta/models/update_payment_methods_card.py index 5b6fa62..b35f991 100644 --- a/conekta/models/update_payment_methods.py +++ b/conekta/models/update_payment_methods_card.py @@ -23,17 +23,19 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class UpdatePaymentMethods(BaseModel): +class UpdatePaymentMethodsCard(BaseModel): """ - UpdatePaymentMethods + UpdatePaymentMethodsCard """ # noqa: E501 - name: Optional[StrictStr] = Field(default=None, description="The name of the payment method holder") - expires_at: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="The expiration date of the payment method in Unix timestamp format") + name: Optional[StrictStr] = Field(default=None, description="The name of the payment method holder", json_schema_extra={"examples": ["Payment recurrent"]}) + expires_at: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="The expiration date of the payment method in Unix timestamp format", json_schema_extra={"examples": [1760457350]}) __properties: ClassVar[List[str]] = ["name", "expires_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,12 +47,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of UpdatePaymentMethods from a JSON string""" + """Create an instance of UpdatePaymentMethodsCard from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -75,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of UpdatePaymentMethods from a dict""" + """Create an instance of UpdatePaymentMethodsCard from a dict""" if obj is None: return None diff --git a/conekta/models/plan_update_request.py b/conekta/models/update_plan.py similarity index 81% rename from conekta/models/plan_update_request.py rename to conekta/models/update_plan.py index b2f51c8..191e99a 100644 --- a/conekta/models/plan_update_request.py +++ b/conekta/models/update_plan.py @@ -23,19 +23,21 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class PlanUpdateRequest(BaseModel): +class UpdatePlan(BaseModel): """ a plan """ # noqa: E501 - amount: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="The amount in cents that will be charged on the interval specified.") - currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="ISO 4217 for currencies, for the Mexican peso it is MXN/USD") - expiry_count: Optional[StrictInt] = Field(default=None, description="Number of repetitions of the frequency NUMBER OF CHARGES TO BE MADE, considering the interval and frequency, this evolves over time, but is subject to the expiration count.") - name: Optional[StrictStr] = Field(default=None, description="The name of the plan.") + amount: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="The amount in cents that will be charged on the interval specified.", json_schema_extra={"examples": [10000]}) + currency: Optional[Annotated[str, Field(strict=True, max_length=3)]] = Field(default=None, description="ISO 4217 for currencies, for the Mexican peso it is MXN/USD", json_schema_extra={"examples": ["MXN"]}) + expiry_count: Optional[StrictInt] = Field(default=None, description="Number of repetitions of the frequency NUMBER OF CHARGES TO BE MADE, considering the interval and frequency, this evolves over time, but is subject to the expiration count.", json_schema_extra={"examples": [12]}) + name: Optional[StrictStr] = Field(default=None, description="The name of the plan.", json_schema_extra={"examples": ["Extra Plan3"]}) __properties: ClassVar[List[str]] = ["amount", "currency", "expiry_count", "name"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,12 +49,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of PlanUpdateRequest from a JSON string""" + """Create an instance of UpdatePlan from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -77,7 +78,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of PlanUpdateRequest from a dict""" + """Create an instance of UpdatePlan from a dict""" if obj is None: return None diff --git a/conekta/models/update_product.py b/conekta/models/update_product.py index b7ef81c..3d0aafa 100644 --- a/conekta/models/update_product.py +++ b/conekta/models/update_product.py @@ -23,24 +23,26 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class UpdateProduct(BaseModel): """ UpdateProduct """ # noqa: E501 - antifraud_info: Optional[Dict[str, Dict[str, Any]]] = None + antifraud_info: Optional[Any] = None description: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None sku: Optional[StrictStr] = None - name: Optional[StrictStr] = None - unit_price: Optional[Annotated[int, Field(strict=True, ge=0)]] = None - quantity: Optional[Annotated[int, Field(strict=True, ge=1)]] = None + name: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["Box of Cohiba S1s"]}) + unit_price: Optional[Annotated[int, Field(strict=True, ge=0)]] = Field(default=None, json_schema_extra={"examples": [20000]}) + quantity: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, json_schema_extra={"examples": [1]}) tags: Optional[List[StrictStr]] = None brand: Optional[StrictStr] = None - metadata: Optional[Dict[str, StrictStr]] = None + metadata: Optional[Any] = None __properties: ClassVar[List[str]] = ["antifraud_info", "description", "sku", "name", "unit_price", "quantity", "tags", "brand", "metadata"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,6 +79,16 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) + # set to None if antifraud_info (nullable) is None + # and model_fields_set contains the field + if self.antifraud_info is None and "antifraud_info" in self.model_fields_set: + _dict['antifraud_info'] = None + + # set to None if metadata (nullable) is None + # and model_fields_set contains the field + if self.metadata is None and "metadata" in self.model_fields_set: + _dict['metadata'] = None + return _dict @classmethod @@ -90,7 +101,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: return cls.model_validate(obj) _obj = cls.model_validate({ - "antifraud_info": obj.get("antifraud_info"), "description": obj.get("description"), "sku": obj.get("sku"), "name": obj.get("name"), @@ -98,7 +108,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "quantity": obj.get("quantity"), "tags": obj.get("tags"), "brand": obj.get("brand"), - "metadata": obj.get("metadata") }) return _obj diff --git a/conekta/models/webhook_update_request.py b/conekta/models/update_webhook.py similarity index 78% rename from conekta/models/webhook_update_request.py rename to conekta/models/update_webhook.py index 1e4fa01..82d45a8 100644 --- a/conekta/models/webhook_update_request.py +++ b/conekta/models/update_webhook.py @@ -23,28 +23,30 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class WebhookUpdateRequest(BaseModel): +class UpdateWebhook(BaseModel): """ an updated webhook """ # noqa: E501 - url: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Here you must place the URL of your Webhook remember that you must program what you will do with the events received. Also do not forget to handle the HTTPS protocol for greater security.") - subscribed_events: Optional[List[StrictStr]] = Field(default=None, description="events that will be sent to the webhook") - active: Optional[StrictBool] = Field(default=None, description="whether the webhook is active or not") + url: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Here you must place the URL of your Webhook remember that you must program what you will do with the events received. Also do not forget to handle the HTTPS protocol for greater security.", json_schema_extra={"examples": ["https://webhook.site/89277eaa-a8e4-4306-8dc5-f55c80703dc8"]}) + subscribed_events: Optional[List[StrictStr]] = Field(default=None, description="events that will be sent to the webhook", json_schema_extra={"examples": ["customer.created"]}) + active: Optional[StrictBool] = Field(default=None, description="whether the webhook is active or not", json_schema_extra={"examples": [True]}) __properties: ClassVar[List[str]] = ["url", "subscribed_events", "active"] - @field_validator('url') + @field_validator('url', mode="before") def url_validate_regular_expression(cls, value): """Validates the regular expression""" if value is None: return value - if not re.match(r"^(?!.*(localhost|127\.0\.0\.1)).*$", value): + if isinstance(value, str) and not re.match(r"^(?!.*(localhost|127\.0\.0\.1)).*$", value): raise ValueError(r"must validate the regular expression /^(?!.*(localhost|127\.0\.0\.1)).*$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -56,12 +58,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of WebhookUpdateRequest from a JSON string""" + """Create an instance of UpdateWebhook from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -86,7 +87,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of WebhookUpdateRequest from a dict""" + """Create an instance of UpdateWebhook from a dict""" if obj is None: return None diff --git a/conekta/models/subscription_update_request.py b/conekta/models/updates_a_subscription.py similarity index 74% rename from conekta/models/subscription_update_request.py rename to conekta/models/updates_a_subscription.py index de775eb..f2c437e 100644 --- a/conekta/models/subscription_update_request.py +++ b/conekta/models/updates_a_subscription.py @@ -18,22 +18,24 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python -class SubscriptionUpdateRequest(BaseModel): +class UpdatesASubscription(BaseModel): """ You can modify the subscription to change the plan used by your customers. """ # noqa: E501 - plan_id: Optional[StrictStr] = None - card_id: Optional[StrictStr] = None - trial_end: Optional[StrictInt] = None + plan_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["f84gdgf5g48r15fd21g8w424fd1"]}) + card_id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["src_2qUCNd5AyQqfPMBuV"]}) + trial_end: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1484040996]}) __properties: ClassVar[List[str]] = ["plan_id", "card_id", "trial_end"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,12 +47,11 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of SubscriptionUpdateRequest from a JSON string""" + """Create an instance of UpdatesASubscription from a JSON string""" return cls.from_dict(json.loads(json_str)) def to_dict(self) -> Dict[str, Any]: @@ -75,7 +76,7 @@ def to_dict(self) -> Dict[str, Any]: @classmethod def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of SubscriptionUpdateRequest from a dict""" + """Create an instance of UpdatesASubscription from a dict""" if obj is None: return None diff --git a/conekta/models/webhook_key_create_response.py b/conekta/models/webhook_key_create_response.py index 7c8134c..6191da8 100644 --- a/conekta/models/webhook_key_create_response.py +++ b/conekta/models/webhook_key_create_response.py @@ -22,21 +22,23 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WebhookKeyCreateResponse(BaseModel): """ webhook keys model """ # noqa: E501 - active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is active") - created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the creation date of the webhook key") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the webhook key") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is in live mode") - object: Optional[StrictStr] = Field(default=None, description="Object name, value is webhook_key") - public_key: Optional[StrictStr] = Field(default=None, description="Public key to be used in the webhook") + active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is active", json_schema_extra={"examples": [True]}) + created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the creation date of the webhook key", json_schema_extra={"examples": [1577836800]}) + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the webhook key", json_schema_extra={"examples": ["62730ba6fb7dfd6a712f118e"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is in live mode", json_schema_extra={"examples": [False]}) + object: Optional[StrictStr] = Field(default=None, description="Object name, value is webhook_key", json_schema_extra={"examples": ["webhook_key"]}) + public_key: Optional[StrictStr] = Field(default=None, description="Public key to be used in the webhook", json_schema_extra={"examples": ["-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqULpUc6D6mSAq5a0yLY/\\noOjd1mWm6q+QI8y/FI4STr2F+XgKeNnMxSqnyFrHtKQ/ut4Zi45WFnJLfEQL7aW5\\n67yE2dWyo6GaL7yZUfLC0Y3sHPGzaGtvDF36ISW7LliYNoMiA3Bx5/1Sr0G23pGW\\n0Mp8IO1Nlz0sJWuU/d7zCz/UN6cl9g/BP4eaQ7deS56YuWcj5sTlwqFTlwN12kpA\\nIzMZ7gnvYQnZTpPny5lben6QEuxTvZcPApcyOweiESjMnXfkfWOyuYtgMrbsU6oL\\nA6sWa6j0pePW7AYeBqB4tyAlenkCSqzHg8bMk5Bm7hiT6I9Pls774lJbnOYmmuNE\\n8QIDAQAB\\n-----END PUBLIC KEY-----\\n"]}) __properties: ClassVar[List[str]] = ["active", "created_at", "id", "livemode", "object", "public_key"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/webhook_key_delete_response.py b/conekta/models/webhook_key_delete_response.py index a17c0a4..3c893d3 100644 --- a/conekta/models/webhook_key_delete_response.py +++ b/conekta/models/webhook_key_delete_response.py @@ -22,21 +22,23 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WebhookKeyDeleteResponse(BaseModel): """ webhook keys model """ # noqa: E501 - active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is active") - created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the creation date of the webhook key") - deleted: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is deleted") - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the webhook key") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is in live mode") - object: Optional[StrictStr] = Field(default=None, description="Object name, value is webhook_key") + active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is active", json_schema_extra={"examples": [True]}) + created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the creation date of the webhook key", json_schema_extra={"examples": [1577836800]}) + deleted: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is deleted", json_schema_extra={"examples": [True]}) + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the webhook key", json_schema_extra={"examples": ["62730ba6fb7dfd6a712f118e"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is in live mode", json_schema_extra={"examples": [False]}) + object: Optional[StrictStr] = Field(default=None, description="Object name, value is webhook_key", json_schema_extra={"examples": ["webhook_key"]}) __properties: ClassVar[List[str]] = ["active", "created_at", "deleted", "id", "livemode", "object"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/webhook_key_request.py b/conekta/models/webhook_key_request.py index a76d04f..34e67a7 100644 --- a/conekta/models/webhook_key_request.py +++ b/conekta/models/webhook_key_request.py @@ -22,16 +22,18 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WebhookKeyRequest(BaseModel): """ WebhookKeyRequest """ # noqa: E501 - active: Optional[StrictBool] = Field(default=True, description="Indicates if the webhook key is active") + active: Optional[StrictBool] = Field(default=True, description="Indicates if the webhook key is active", json_schema_extra={"examples": [True]}) __properties: ClassVar[List[str]] = ["active"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/webhook_key_response.py b/conekta/models/webhook_key_response.py index 5efa20b..35537be 100644 --- a/conekta/models/webhook_key_response.py +++ b/conekta/models/webhook_key_response.py @@ -22,22 +22,24 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WebhookKeyResponse(BaseModel): """ webhook keys model """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the webhook key") - active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is active") - created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the creation date of the webhook key") + id: Optional[StrictStr] = Field(default=None, description="Unique identifier of the webhook key", json_schema_extra={"examples": ["62730ba6fb7dfd6a712f118e"]}) + active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is active", json_schema_extra={"examples": [True]}) + created_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the creation date of the webhook key", json_schema_extra={"examples": [1577836800]}) deactivated_at: Optional[StrictInt] = Field(default=None, description="Unix timestamp in seconds with the deactivation date of the webhook key") - public_key: Optional[StrictStr] = Field(default=None, description="Public key to be used in the webhook") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is in live mode") - object: Optional[StrictStr] = Field(default=None, description="Object name, value is webhook_key") + public_key: Optional[StrictStr] = Field(default=None, description="Public key to be used in the webhook", json_schema_extra={"examples": ["-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqULpUc6D6mSAq5a0yLY/\\noOjd1mWm6q+QI8y/FI4STr2F+XgKeNnMxSqnyFrHtKQ/ut4Zi45WFnJLfEQL7aW5\\n67yE2dWyo6GaL7yZUfLC0Y3sHPGzaGtvDF36ISW7LliYNoMiA3Bx5/1Sr0G23pGW\\n0Mp8IO1Nlz0sJWuU/d7zCz/UN6cl9g/BP4eaQ7deS56YuWcj5sTlwqFTlwN12kpA\\nIzMZ7gnvYQnZTpPny5lben6QEuxTvZcPApcyOweiESjMnXfkfWOyuYtgMrbsU6oL\\nA6sWa6j0pePW7AYeBqB4tyAlenkCSqzHg8bMk5Bm7hiT6I9Pls774lJbnOYmmuNE\\n8QIDAQAB\\n-----END PUBLIC KEY-----\\n"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook key is in live mode", json_schema_extra={"examples": [False]}) + object: Optional[StrictStr] = Field(default=None, description="Object name, value is webhook_key", json_schema_extra={"examples": ["webhook_key"]}) __properties: ClassVar[List[str]] = ["id", "active", "created_at", "deactivated_at", "public_key", "livemode", "object"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -75,11 +76,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # set to None if deactivated_at (nullable) is None - # and model_fields_set contains the field - if self.deactivated_at is None and "deactivated_at" in self.model_fields_set: - _dict['deactivated_at'] = None - return _dict @classmethod diff --git a/conekta/models/webhook_key_update_request.py b/conekta/models/webhook_key_update_request.py index f05c5cb..aaf52f7 100644 --- a/conekta/models/webhook_key_update_request.py +++ b/conekta/models/webhook_key_update_request.py @@ -22,16 +22,18 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WebhookKeyUpdateRequest(BaseModel): """ WebhookKeyUpdateRequest """ # noqa: E501 - active: Optional[StrictBool] = Field(default=False, description="Indicates if the webhook key is active") + active: Optional[StrictBool] = Field(default=False, description="Indicates if the webhook key is active", json_schema_extra={"examples": [False]}) __properties: ClassVar[List[str]] = ["active"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/webhook_log.py b/conekta/models/webhook_log.py index bd371c8..c24602d 100644 --- a/conekta/models/webhook_log.py +++ b/conekta/models/webhook_log.py @@ -18,26 +18,28 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WebhookLog(BaseModel): """ WebhookLog """ # noqa: E501 - failed_attempts: Optional[StrictInt] = None - id: Optional[StrictStr] = None - last_attempted_at: Optional[StrictInt] = None - last_http_response_status: Optional[StrictInt] = None - object: Optional[StrictStr] = None - response_data: Optional[Dict[str, Any]] = None - url: Optional[StrictStr] = None + failed_attempts: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [10]}) + id: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["webhl_2svd2sh6GbqzyWBNZ"]}) + last_attempted_at: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [1669651274]}) + last_http_response_status: Optional[StrictInt] = Field(default=None, json_schema_extra={"examples": [200]}) + object: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["webhook_log"]}) + response_data: Optional[Dict[str, Any]] = Field(default=None, json_schema_extra={"examples": [{"amount": 3000, "payable": True}]}) + url: Optional[StrictStr] = Field(default=None, json_schema_extra={"examples": ["https://username:password@mockoon.conekta.io/payments-api/cash/merchant_approval"]}) __properties: ClassVar[List[str]] = ["failed_attempts", "id", "last_attempted_at", "last_http_response_status", "object", "response_data", "url"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/webhook_request.py b/conekta/models/webhook_request.py index 1e107b4..96a52a2 100644 --- a/conekta/models/webhook_request.py +++ b/conekta/models/webhook_request.py @@ -23,24 +23,26 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WebhookRequest(BaseModel): """ a webhook """ # noqa: E501 - url: Annotated[str, Field(strict=True)] = Field(description="Here you must place the URL of your Webhook remember that you must program what you will do with the events received. Also do not forget to handle the HTTPS protocol for greater security.") - subscribed_events: Optional[List[StrictStr]] = Field(default=None, description="events that will be sent to the webhook") + url: Annotated[str, Field(strict=True)] = Field(description="Here you must place the URL of your Webhook remember that you must program what you will do with the events received. Also do not forget to handle the HTTPS protocol for greater security.", json_schema_extra={"examples": ["https://webhook.site/89277eaa-a8e4-4306-8dc5-f55c80703dc8"]}) + subscribed_events: Optional[List[StrictStr]] = Field(default=None, description="events that will be sent to the webhook", json_schema_extra={"examples": ["customer.created"]}) __properties: ClassVar[List[str]] = ["url", "subscribed_events"] - @field_validator('url') + @field_validator('url', mode="before") def url_validate_regular_expression(cls, value): """Validates the regular expression""" - if not re.match(r"^(?!.*(localhost|127\.0\.0\.1)).*$", value): + if isinstance(value, str) and not re.match(r"^(?!.*(localhost|127\.0\.0\.1)).*$", value): raise ValueError(r"must validate the regular expression /^(?!.*(localhost|127\.0\.0\.1)).*$/") return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/webhook_response.py b/conekta/models/webhook_response.py index be3baaa..89f9e4e 100644 --- a/conekta/models/webhook_response.py +++ b/conekta/models/webhook_response.py @@ -22,23 +22,25 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WebhookResponse(BaseModel): """ webhooks model """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="id of the webhook") - description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this webhook is used for") - livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook is in production") - active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook is actived or not") - object: Optional[StrictStr] = Field(default=None, description="Object name, value is 'webhook'") - status: Optional[StrictStr] = Field(default=None, description="Indicates if the webhook is ready to receive events or failing") - subscribed_events: Optional[List[StrictStr]] = Field(default=None, description="lists the events that will be sent to the webhook") - url: Optional[StrictStr] = Field(default=None, description="url or endpoint of the webhook") + id: Optional[StrictStr] = Field(default=None, description="id of the webhook", json_schema_extra={"examples": ["6307a60c41de27127515a575"]}) + description: Optional[StrictStr] = Field(default=None, description="A name or brief explanation of what this webhook is used for", json_schema_extra={"examples": ["Server payments processor"]}) + livemode: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook is in production", json_schema_extra={"examples": [True]}) + active: Optional[StrictBool] = Field(default=None, description="Indicates if the webhook is actived or not", json_schema_extra={"examples": [True]}) + object: Optional[StrictStr] = Field(default=None, description="Object name, value is 'webhook'", json_schema_extra={"examples": ["event"]}) + status: Optional[StrictStr] = Field(default=None, description="Indicates if the webhook is ready to receive events or failing", json_schema_extra={"examples": ["listening"]}) + subscribed_events: Optional[List[StrictStr]] = Field(default=None, description="lists the events that will be sent to the webhook", json_schema_extra={"examples": [["charge.created", "charge.paid", "charge.under_fraud_review", "charge.fraudulent", "charge.refunded", "charge.preauthorized", "charge.declined", "charge.canceled", "charge.reversed", "charge.pending_confirmation"]]}) + url: Optional[StrictStr] = Field(default=None, description="url or endpoint of the webhook", json_schema_extra={"examples": ["https://username:password@mockoon.conekta.io/payments-api/cash/merchant_approval"]}) __properties: ClassVar[List[str]] = ["id", "description", "livemode", "active", "object", "status", "subscribed_events", "url"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/models/whitelistlist_rule_response.py b/conekta/models/whitelistlist_rule_response.py index 6eb833f..2c40d11 100644 --- a/conekta/models/whitelistlist_rule_response.py +++ b/conekta/models/whitelistlist_rule_response.py @@ -22,19 +22,21 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WhitelistlistRuleResponse(BaseModel): """ WhitelistlistRuleResponse """ # noqa: E501 - id: Optional[StrictStr] = Field(default=None, description="Whitelist rule id") - var_field: Optional[StrictStr] = Field(default=None, description="field used for whitelists rule", alias="field") - value: Optional[StrictStr] = Field(default=None, description="value used for whitelists rule") - description: Optional[StrictStr] = Field(default=None, description="use an description for whitelisted rule") + id: Optional[StrictStr] = Field(default=None, description="Whitelist rule id", json_schema_extra={"examples": ["2fw8EWJusiRrxdPzT"]}) + var_field: Optional[StrictStr] = Field(default=None, description="field used for whitelists rule", alias="field", json_schema_extra={"examples": ["email"]}) + value: Optional[StrictStr] = Field(default=None, description="value used for whitelists rule", json_schema_extra={"examples": ["email@example.com"]}) + description: Optional[StrictStr] = Field(default=None, description="use an description for whitelisted rule", json_schema_extra={"examples": ["banned customer example@example.com"]}) __properties: ClassVar[List[str]] = ["id", "field", "value", "description"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: def to_json(self) -> str: """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: diff --git a/conekta/rest.py b/conekta/rest.py index ba6be74..3d6819e 100644 --- a/conekta/rest.py +++ b/conekta/rest.py @@ -13,10 +13,12 @@ """ # noqa: E501 +import ipaddress import io import json import re import ssl +from urllib.parse import urlparse import urllib3 @@ -36,6 +38,44 @@ def is_socks_proxy_url(url): return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES +def should_bypass_proxies(url: str, no_proxy: str) -> bool: + """Return whether ``url`` matches the comma-separated ``no_proxy`` rules.""" + parsed_url = urlparse(url) + if not parsed_url.hostname: + return True + + host = parsed_url.hostname.lower() + host_and_port = parsed_url.netloc.lower() + try: + host_ip = ipaddress.ip_address(host) + except ValueError: + host_ip = None + + for entry in (entry.strip().lower() for entry in no_proxy.split(',')): + if not entry: + continue + if entry == '*': + return True + + if host_ip is not None: + try: + if host_ip in ipaddress.ip_network(entry, strict=False): + return True + except ValueError: + pass + + entry = entry.lstrip('.') + if ( + host == entry + or host.endswith('.' + entry) + or host_and_port == entry + or host_and_port.endswith('.' + entry) + ): + return True + + return False + + class RESTResponse(io.IOBase): def __init__(self, resp) -> None: @@ -49,12 +89,17 @@ def read(self): self.data = self.response.data return self.data + @property + def headers(self): + """Returns a dictionary of response headers.""" + return self.response.headers + def getheaders(self): - """Returns a dictionary of the response headers.""" + """Returns a dictionary of the response headers; use ``headers`` instead.""" return self.response.headers def getheader(self, name, default=None): - """Returns a given response header.""" + """Returns a given response header; use ``headers.get()`` instead.""" return self.response.headers.get(name, default) @@ -77,6 +122,7 @@ def __init__(self, configuration) -> None: "ca_certs": configuration.ssl_ca_cert, "cert_file": configuration.cert_file, "key_file": configuration.key_file, + "ca_cert_data": configuration.ca_cert_data, } if configuration.assert_hostname is not None: pool_args['assert_hostname'] = ( @@ -99,7 +145,9 @@ def __init__(self, configuration) -> None: # https pool manager self.pool_manager: urllib3.PoolManager - if configuration.proxy: + if configuration.proxy and not should_bypass_proxies( + configuration.host, configuration.no_proxy or '' + ): if is_socks_proxy_url(configuration.proxy): from urllib3.contrib.socks import SOCKSProxyManager pool_args["proxy_url"] = configuration.proxy @@ -171,12 +219,20 @@ def request( # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: - # no content type provided or payload is json content_type = headers.get('Content-Type') - if ( + is_json = ( not content_type or re.search('json', content_type, re.IGNORECASE) - ): + ) + # JSON is valid YAML 1.2, so structured YAML bodies can use + # the existing JSON serializer: + # https://yaml.org/spec/1.2.2/#13-relation-to-json + is_structured_yaml = ( + content_type + and re.search('yaml', content_type, re.IGNORECASE) + and not isinstance(body, (str, bytes)) + ) + if is_json or is_structured_yaml: request_body = None if body is not None: request_body = json.dumps(body) diff --git a/config-python.json b/config-python.json index d237f02..c615cdb 100644 --- a/config-python.json +++ b/config-python.json @@ -7,14 +7,14 @@ "licenseName": "MIT License", "licenseUrl": "https://www.opensource.org/licenses/mit-license.php", "generateSourceCodeOnly": "false", - "packageVersion": "7.0.3", + "packageVersion": "7.1.0", "packageUrl": "https://github.com/conekta/conekta-python", "projectName": "conekta", "templateDir": "/local/templates/python", "hasBearerMethods" : true, "useOneOfDiscriminatorLookup" : true, "nonCompliantUseDiscriminatorIfCompositionFails" : false, - "httpUserAgent": "Conekta/v2 PythonBindings/7.0.3", + "httpUserAgent": "Conekta/v2 PythonBindings/7.1.0", "files": { "/local/AUTHORS.md" : {}, "/local/CODE_OF_CONDUCT.md": {}, diff --git a/docs/AntifraudApi.md b/docs/AntifraudApi.md index f34e8c4..3ce6008 100644 --- a/docs/AntifraudApi.md +++ b/docs/AntifraudApi.md @@ -13,7 +13,7 @@ Method | HTTP request | Description # **create_rule_blacklist** -> BlacklistRuleResponse create_rule_blacklist(create_risk_rules_data, accept_language=accept_language) +> BlacklistRuleResponse create_rule_blacklist(create_rule_whitelist_request, accept_language=accept_language) Create blacklisted rule @@ -24,7 +24,7 @@ Create blacklisted rule ```python import conekta from conekta.models.blacklist_rule_response import BlacklistRuleResponse -from conekta.models.create_risk_rules_data import CreateRiskRulesData +from conekta.models.create_rule_whitelist_request import CreateRuleWhitelistRequest from conekta.rest import ApiException from pprint import pprint @@ -48,12 +48,12 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.AntifraudApi(api_client) - create_risk_rules_data = conekta.CreateRiskRulesData() # CreateRiskRulesData | requested field for blacklist rule - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + create_rule_whitelist_request = conekta.CreateRuleWhitelistRequest() # CreateRuleWhitelistRequest | requested field for blacklist rule + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Create blacklisted rule - api_response = api_instance.create_rule_blacklist(create_risk_rules_data, accept_language=accept_language) + api_response = api_instance.create_rule_blacklist(create_rule_whitelist_request, accept_language=accept_language) print("The response of AntifraudApi->create_rule_blacklist:\n") pprint(api_response) except Exception as e: @@ -67,8 +67,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **create_risk_rules_data** | [**CreateRiskRulesData**](CreateRiskRulesData.md)| requested field for blacklist rule | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **create_rule_whitelist_request** | [**CreateRuleWhitelistRequest**](CreateRuleWhitelistRequest.md)| requested field for blacklist rule | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -94,7 +94,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **create_rule_whitelist** -> WhitelistlistRuleResponse create_rule_whitelist(accept_language=accept_language, create_risk_rules_data=create_risk_rules_data) +> WhitelistlistRuleResponse create_rule_whitelist(accept_language=accept_language, create_rule_whitelist_request=create_rule_whitelist_request) Create whitelisted rule @@ -104,7 +104,7 @@ Create whitelisted rule ```python import conekta -from conekta.models.create_risk_rules_data import CreateRiskRulesData +from conekta.models.create_rule_whitelist_request import CreateRuleWhitelistRequest from conekta.models.whitelistlist_rule_response import WhitelistlistRuleResponse from conekta.rest import ApiException from pprint import pprint @@ -129,12 +129,12 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.AntifraudApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) - create_risk_rules_data = conekta.CreateRiskRulesData() # CreateRiskRulesData | (optional) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') + create_rule_whitelist_request = conekta.CreateRuleWhitelistRequest() # CreateRuleWhitelistRequest | (optional) try: # Create whitelisted rule - api_response = api_instance.create_rule_whitelist(accept_language=accept_language, create_risk_rules_data=create_risk_rules_data) + api_response = api_instance.create_rule_whitelist(accept_language=accept_language, create_rule_whitelist_request=create_rule_whitelist_request) print("The response of AntifraudApi->create_rule_whitelist:\n") pprint(api_response) except Exception as e: @@ -148,8 +148,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] - **create_risk_rules_data** | [**CreateRiskRulesData**](CreateRiskRulesData.md)| | [optional] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] + **create_rule_whitelist_request** | [**CreateRuleWhitelistRequest**](CreateRuleWhitelistRequest.md)| | [optional] ### Return type @@ -211,7 +211,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.AntifraudApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -231,7 +231,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -294,7 +294,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.AntifraudApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -314,7 +314,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -379,7 +379,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.AntifraudApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Get list of blacklisted rules @@ -397,7 +397,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -459,7 +459,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.AntifraudApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Get a list of whitelisted rules @@ -477,7 +477,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type diff --git a/docs/ApiKeyCreateResponse.md b/docs/ApiKeyCreateResponse.md index d6bd300..ee59163 100644 --- a/docs/ApiKeyCreateResponse.md +++ b/docs/ApiKeyCreateResponse.md @@ -5,6 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**authentication_token** | **str** | It is occupied as a user when authenticated with basic authentication, with a blank password. This value will only appear once, in the request to create a new key. Copy and save it in a safe place. | [optional] **active** | **bool** | Indicates if the api key is active | [optional] **created_at** | **int** | Unix timestamp in seconds of when the api key was created | [optional] **updated_at** | **int** | Unix timestamp in seconds of when the api key was last updated | [optional] @@ -16,7 +17,6 @@ Name | Type | Description | Notes **object** | **str** | Object name, value is 'api_key' | [optional] **prefix** | **str** | The first few characters of the authentication_token | [optional] **role** | **str** | Indicates if the api key is private or public | [optional] -**authentication_token** | **str** | It is occupied as a user when authenticated with basic authentication, with a blank password. This value will only appear once, in the request to create a new key. Copy and save it in a safe place. | [optional] ## Example diff --git a/docs/ApiKeyResponseOnDelete.md b/docs/ApiKeyResponseOnDelete.md deleted file mode 100644 index e6a8d57..0000000 --- a/docs/ApiKeyResponseOnDelete.md +++ /dev/null @@ -1,38 +0,0 @@ -# ApiKeyResponseOnDelete - -api keys model - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**active** | **bool** | Indicates if the api key is active | [optional] -**created_at** | **int** | Unix timestamp in seconds of when the api key was created | [optional] -**description** | **str** | A name or brief explanation of what this api key is used for | [optional] -**livemode** | **bool** | Indicates if the api key is in production | [optional] -**prefix** | **str** | The first few characters of the authentication_token | [optional] -**id** | **str** | Unique identifier of the api key | [optional] -**object** | **str** | Object name, value is 'api_key' | [optional] -**last_used_at** | **int** | Unix timestamp in seconds with the api key was used | [optional] -**role** | **str** | Indicates if the api key is private or public | [optional] - -## Example - -```python -from conekta.models.api_key_response_on_delete import ApiKeyResponseOnDelete - -# TODO update the JSON string below -json = "{}" -# create an instance of ApiKeyResponseOnDelete from a JSON string -api_key_response_on_delete_instance = ApiKeyResponseOnDelete.from_json(json) -# print the JSON string representation of the object -print(ApiKeyResponseOnDelete.to_json()) - -# convert the object into a dict -api_key_response_on_delete_dict = api_key_response_on_delete_instance.to_dict() -# create an instance of ApiKeyResponseOnDelete from a dict -api_key_response_on_delete_from_dict = ApiKeyResponseOnDelete.from_dict(api_key_response_on_delete_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ApiKeysApi.md b/docs/ApiKeysApi.md index 90bf80e..1b78fb5 100644 --- a/docs/ApiKeysApi.md +++ b/docs/ApiKeysApi.md @@ -50,7 +50,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.ApiKeysApi(api_client) api_key_request = conekta.ApiKeyRequest() # ApiKeyRequest | requested field for a api keys - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -70,7 +70,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **api_key_request** | [**ApiKeyRequest**](ApiKeyRequest.md)| requested field for a api keys | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -135,7 +135,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.ApiKeysApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Delete Api Key @@ -154,7 +154,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -218,7 +218,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.ApiKeysApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -238,7 +238,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -302,7 +302,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.ApiKeysApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) next = 'next_example' # str | next page (optional) @@ -325,7 +325,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **next** | **str**| next page | [optional] @@ -394,7 +394,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.ApiKeysApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') api_key_update_request = conekta.ApiKeyUpdateRequest() # ApiKeyUpdateRequest | (optional) try: @@ -414,7 +414,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **api_key_update_request** | [**ApiKeyUpdateRequest**](ApiKeyUpdateRequest.md)| | [optional] ### Return type diff --git a/docs/BalanceCommonField.md b/docs/BalanceCommonFielsResponse.md similarity index 50% rename from docs/BalanceCommonField.md rename to docs/BalanceCommonFielsResponse.md index aa1dfed..5b852e2 100644 --- a/docs/BalanceCommonField.md +++ b/docs/BalanceCommonFielsResponse.md @@ -1,4 +1,4 @@ -# BalanceCommonField +# BalanceCommonFielsResponse balance common fields model @@ -12,19 +12,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.balance_common_field import BalanceCommonField +from conekta.models.balance_common_fiels_response import BalanceCommonFielsResponse # TODO update the JSON string below json = "{}" -# create an instance of BalanceCommonField from a JSON string -balance_common_field_instance = BalanceCommonField.from_json(json) +# create an instance of BalanceCommonFielsResponse from a JSON string +balance_common_fiels_response_instance = BalanceCommonFielsResponse.from_json(json) # print the JSON string representation of the object -print(BalanceCommonField.to_json()) +print(BalanceCommonFielsResponse.to_json()) # convert the object into a dict -balance_common_field_dict = balance_common_field_instance.to_dict() -# create an instance of BalanceCommonField from a dict -balance_common_field_from_dict = BalanceCommonField.from_dict(balance_common_field_dict) +balance_common_fiels_response_dict = balance_common_fiels_response_instance.to_dict() +# create an instance of BalanceCommonFielsResponse from a dict +balance_common_fiels_response_from_dict = BalanceCommonFielsResponse.from_dict(balance_common_fiels_response_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/BalanceResponse.md b/docs/BalanceResponse.md index f918f8b..2328da0 100644 --- a/docs/BalanceResponse.md +++ b/docs/BalanceResponse.md @@ -6,16 +6,16 @@ balance model Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**available** | [**List[BalanceCommonField]**](BalanceCommonField.md) | The balance's available | [optional] -**cashout_retention_amount** | [**List[BalanceCommonField]**](BalanceCommonField.md) | The balance's cashout retention amount | [optional] -**conekta_retention** | [**List[BalanceCommonField]**](BalanceCommonField.md) | The balance's conekta retention | [optional] -**gateway** | [**List[BalanceCommonField]**](BalanceCommonField.md) | The balance's gateway | [optional] -**pending** | [**List[BalanceCommonField]**](BalanceCommonField.md) | The balance's pending | [optional] -**retained** | [**List[BalanceCommonField]**](BalanceCommonField.md) | The balance's retained | [optional] -**retention_amount** | [**List[BalanceCommonField]**](BalanceCommonField.md) | The balance's retention amount | [optional] +**available** | [**List[BalanceCommonFielsResponse]**](BalanceCommonFielsResponse.md) | The balance's available | [optional] +**cashout_retention_amount** | [**List[BalanceCommonFielsResponse]**](BalanceCommonFielsResponse.md) | The balance's cashout retention amount | [optional] +**conekta_retention** | [**List[BalanceCommonFielsResponse]**](BalanceCommonFielsResponse.md) | The balance's conekta retention | [optional] +**gateway** | [**List[BalanceCommonFielsResponse]**](BalanceCommonFielsResponse.md) | The balance's gateway | [optional] +**pending** | [**List[BalanceCommonFielsResponse]**](BalanceCommonFielsResponse.md) | The balance's pending | [optional] +**retained** | [**List[BalanceCommonFielsResponse]**](BalanceCommonFielsResponse.md) | The balance's retained | [optional] +**retention_amount** | [**List[BalanceCommonFielsResponse]**](BalanceCommonFielsResponse.md) | The balance's retention amount | [optional] **target_collateral_amount** | **object** | The balance's target collateral amount | [optional] -**target_retention_amount** | [**List[BalanceCommonField]**](BalanceCommonField.md) | The balance's target retention amount | [optional] -**temporarily_retained** | [**List[BalanceCommonField]**](BalanceCommonField.md) | The balance's temporarily retained | [optional] +**target_retention_amount** | [**List[BalanceCommonFielsResponse]**](BalanceCommonFielsResponse.md) | The balance's target retention amount | [optional] +**temporarily_retained** | [**List[BalanceCommonFielsResponse]**](BalanceCommonFielsResponse.md) | The balance's temporarily retained | [optional] ## Example diff --git a/docs/BalancesApi.md b/docs/BalancesApi.md index 8c8930e..7a6cf32 100644 --- a/docs/BalancesApi.md +++ b/docs/BalancesApi.md @@ -44,7 +44,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.BalancesApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Get a company's balance @@ -62,7 +62,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type diff --git a/docs/CashAgreementsResponse.md b/docs/CashAgreementsResponse.md new file mode 100644 index 0000000..b610b14 --- /dev/null +++ b/docs/CashAgreementsResponse.md @@ -0,0 +1,30 @@ +# CashAgreementsResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**agreement** | **str** | Agreement number, you can use this number to pay in the store/bbva | [optional] +**provider** | **str** | Provider name, you can use this to know where to pay | [optional] + +## Example + +```python +from conekta.models.cash_agreements_response import CashAgreementsResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CashAgreementsResponse from a JSON string +cash_agreements_response_instance = CashAgreementsResponse.from_json(json) +# print the JSON string representation of the object +print(CashAgreementsResponse.to_json()) + +# convert the object into a dict +cash_agreements_response_dict = cash_agreements_response_instance.to_dict() +# create an instance of CashAgreementsResponse from a dict +cash_agreements_response_from_dict = CashAgreementsResponse.from_dict(cash_agreements_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ChargeResponse.md b/docs/ChargeResponse.md index 1f573bd..0c1c744 100644 --- a/docs/ChargeResponse.md +++ b/docs/ChargeResponse.md @@ -18,10 +18,11 @@ Name | Type | Description | Notes **livemode** | **bool** | Whether the charge was made in live mode or not | **object** | **str** | | **order_id** | **str** | Order ID | -**paid_at** | **int** | Payment date | [optional] +**paid_at** | **int** | charge Payment date | [optional] **payment_method** | [**ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional] **reference_id** | **str** | Reference ID of the charge | [optional] **refunds** | [**ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional] +**chargeback** | [**ChargebackResponse**](ChargebackResponse.md) | | [optional] **status** | **str** | Charge status | ## Example diff --git a/docs/ChargebackFileResponse.md b/docs/ChargebackFileResponse.md new file mode 100644 index 0000000..0b53d4b --- /dev/null +++ b/docs/ChargebackFileResponse.md @@ -0,0 +1,33 @@ +# ChargebackFileResponse + +A file associated with a chargeback (e.g. evidence document) + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**file_name** | **str** | | [optional] +**url** | **str** | | [optional] +**created_at** | **int** | | [optional] + +## Example + +```python +from conekta.models.chargeback_file_response import ChargebackFileResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ChargebackFileResponse from a JSON string +chargeback_file_response_instance = ChargebackFileResponse.from_json(json) +# print the JSON string representation of the object +print(ChargebackFileResponse.to_json()) + +# convert the object into a dict +chargeback_file_response_dict = chargeback_file_response_instance.to_dict() +# create an instance of ChargebackFileResponse from a dict +chargeback_file_response_from_dict = ChargebackFileResponse.from_dict(chargeback_file_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ChargebackResponse.md b/docs/ChargebackResponse.md new file mode 100644 index 0000000..3ff0aa9 --- /dev/null +++ b/docs/ChargebackResponse.md @@ -0,0 +1,40 @@ +# ChargebackResponse + +Chargeback object + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**status** | **str** | | [optional] +**reason** | **str** | | [optional] +**note** | **str** | | [optional] +**followup_status** | **str** | | [optional] +**response_from_client** | **str** | | [optional] +**files** | [**List[ChargebackFileResponse]**](ChargebackFileResponse.md) | | [optional] +**object** | **str** | | [optional] +**charge_id** | **str** | | [optional] +**created_at** | **int** | | [optional] +**evidence_due_by** | **int** | | [optional] + +## Example + +```python +from conekta.models.chargeback_response import ChargebackResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ChargebackResponse from a JSON string +chargeback_response_instance = ChargebackResponse.from_json(json) +# print the JSON string representation of the object +print(ChargebackResponse.to_json()) + +# convert the object into a dict +chargeback_response_dict = chargeback_response_instance.to_dict() +# create an instance of ChargebackResponse from a dict +chargeback_response_from_dict = ChargebackResponse.from_dict(chargeback_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ChargesApi.md b/docs/ChargesApi.md index 359ff36..5b9e923 100644 --- a/docs/ChargesApi.md +++ b/docs/ChargesApi.md @@ -45,7 +45,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.ChargesApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -68,7 +68,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -137,8 +137,8 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.ChargesApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - charge_request = conekta.ChargeRequest() # ChargeRequest | requested field for a charge - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + charge_request = {"payment_method":{"can_not_expire":true,"cancel_url":"https://pay.conekta.io/payment-status/fdcb06d6-c9e1-44ee-921f-17723b63852f/cancel","failure_url":"https://pay.conekta.io/payment-status/fdcb06d6-c9e1-44ee-921f-17723b63852f/failure","product_type":"aplazo_bnpl","success_url":"https://pay.conekta.io/payment-status/fdcb06d6-c9e1-44ee-921f-17723b63852f/success","type":"bnpl"}} # ChargeRequest | requested field for a charge + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -159,7 +159,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **charge_request** | [**ChargeRequest**](ChargeRequest.md)| requested field for a charge | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -226,8 +226,8 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.ChargesApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - charge_request = conekta.ChargeRequest() # ChargeRequest | requested field for a charge - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + charge_request = {payment_method={can_not_expire=true, cancel_url=https://pay.conekta.io/payment-status/fdcb06d6-c9e1-44ee-921f-17723b63852f/cancel, failure_url=https://pay.conekta.io/payment-status/fdcb06d6-c9e1-44ee-921f-17723b63852f/failure, product_type=aplazo_bnpl, success_url=https://pay.conekta.io/payment-status/fdcb06d6-c9e1-44ee-921f-17723b63852f/success, type=bnpl}} # ChargeRequest | requested field for a charge + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -248,7 +248,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **charge_request** | [**ChargeRequest**](ChargeRequest.md)| requested field for a charge | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -314,7 +314,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.ChargesApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource charge_update_request = conekta.ChargeUpdateRequest() # ChargeUpdateRequest | requested field for update a charge - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -335,7 +335,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **charge_update_request** | [**ChargeUpdateRequest**](ChargeUpdateRequest.md)| requested field for update a charge | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/ChargesDataResponse.md b/docs/ChargesDataResponse.md index 78973cd..3846946 100644 --- a/docs/ChargesDataResponse.md +++ b/docs/ChargesDataResponse.md @@ -18,10 +18,11 @@ Name | Type | Description | Notes **livemode** | **bool** | Whether the charge was made in live mode or not | **object** | **str** | | **order_id** | **str** | Order ID | -**paid_at** | **int** | Payment date | [optional] +**paid_at** | **int** | charge Payment date | [optional] **payment_method** | [**ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional] **reference_id** | **str** | Reference ID of the charge | [optional] **refunds** | [**ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional] +**chargeback** | [**ChargebackResponse**](ChargebackResponse.md) | | [optional] **status** | **str** | Charge status | ## Example diff --git a/docs/ChargesOrderResponse.md b/docs/ChargesOrderResponse.md index 82bf875..6bd2554 100644 --- a/docs/ChargesOrderResponse.md +++ b/docs/ChargesOrderResponse.md @@ -8,7 +8,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **has_more** | **bool** | Indicates if there are more pages to be requested | **object** | **str** | Object type, in this case is list | -**data** | [**List[ChargesOrderResponseAllOfData]**](ChargesOrderResponseAllOfData.md) | | [optional] +**next_page_url** | **str** | URL of the next page. | [optional] +**previous_page_url** | **str** | Url of the previous page. | [optional] +**data** | [**List[ChargeResponse]**](ChargeResponse.md) | | [optional] ## Example diff --git a/docs/ChargesOrderResponseAllOfData.md b/docs/ChargesOrderResponseAllOfData.md deleted file mode 100644 index 30f8bdc..0000000 --- a/docs/ChargesOrderResponseAllOfData.md +++ /dev/null @@ -1,46 +0,0 @@ -# ChargesOrderResponseAllOfData - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**amount** | **int** | | -**channel** | [**ChargeResponseChannel**](ChargeResponseChannel.md) | | [optional] -**created_at** | **int** | | -**currency** | **str** | | -**customer_id** | **str** | | [optional] -**description** | **str** | | [optional] -**device_fingerprint** | **str** | | [optional] -**failure_code** | **str** | | [optional] -**failure_message** | **str** | | [optional] -**id** | **str** | Charge ID | -**livemode** | **bool** | Whether the charge was made in live mode or not | -**object** | **str** | | -**order_id** | **str** | Order ID | -**paid_at** | **int** | Payment date | [optional] -**payment_method** | [**ChargeResponsePaymentMethod**](ChargeResponsePaymentMethod.md) | | [optional] -**reference_id** | **str** | Reference ID of the charge | [optional] -**refunds** | [**ChargeResponseRefunds**](ChargeResponseRefunds.md) | | [optional] -**status** | **str** | Charge status | - -## Example - -```python -from conekta.models.charges_order_response_all_of_data import ChargesOrderResponseAllOfData - -# TODO update the JSON string below -json = "{}" -# create an instance of ChargesOrderResponseAllOfData from a JSON string -charges_order_response_all_of_data_instance = ChargesOrderResponseAllOfData.from_json(json) -# print the JSON string representation of the object -print(ChargesOrderResponseAllOfData.to_json()) - -# convert the object into a dict -charges_order_response_all_of_data_dict = charges_order_response_all_of_data_instance.to_dict() -# create an instance of ChargesOrderResponseAllOfData from a dict -charges_order_response_all_of_data_from_dict = ChargesOrderResponseAllOfData.from_dict(charges_order_response_all_of_data_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/Checkout.md b/docs/Checkout.md index a4dfb3d..a83c4e5 100644 --- a/docs/Checkout.md +++ b/docs/Checkout.md @@ -7,15 +7,18 @@ It is a sub-resource of the Order model that can be stipulated in order to confi Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **allowed_payment_methods** | **List[str]** | Those are the payment methods that will be available for the link | -**expires_at** | **int** | It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 2 to 365 days (the valid range will be taken from the next day of the creation date at 00:01 hrs) | +**exclude_card_networks** | **List[str]** | List of card networks to exclude from the checkout. This field is only applicable for card payments. | [optional] +**expires_at** | **int** | It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 5 minutes to 365 days from the creation date. | **monthly_installments_enabled** | **bool** | This flag allows you to specify if months without interest will be active. | [optional] **monthly_installments_options** | **List[int]** | This field allows you to specify the number of months without interest. | [optional] -**three_ds_mode** | **str** | Indicates the 3DS2 mode for the order, either smart or strict. | [optional] +**three_ds_mode** | **str** | Indicates the 3DS2 mode for the order, either smart or strict. This property is only applicable when 3DS is enabled. When 3DS is disabled, this field should be null. | [optional] **name** | **str** | Reason for charge | **needs_shipping_contact** | **bool** | This flag allows you to fill in the shipping information at checkout. | [optional] **on_demand_enabled** | **bool** | This flag allows you to specify if the link will be on demand. | [optional] +**plan_ids** | **List[str]** | It is a list of plan IDs that will be associated with the order. | [optional] **order_template** | [**CheckoutOrderTemplate**](CheckoutOrderTemplate.md) | | **payments_limit_count** | **int** | It is the number of payments that can be made through the link. | [optional] +**success_url** | **str** | The URL to redirect to after a successful payment. | [optional] **recurrent** | **bool** | false: single use. true: multiple payments | **type** | **str** | It is the type of link that will be created. It must be a valid type. | diff --git a/docs/CheckoutOrderTemplate.md b/docs/CheckoutOrderTemplate.md index 7cc2dc7..36328d6 100644 --- a/docs/CheckoutOrderTemplate.md +++ b/docs/CheckoutOrderTemplate.md @@ -7,10 +7,11 @@ It maintains the attributes with which the order will be created when receiving Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **currency** | **str** | It is the currency in which the order will be created. It must be a valid ISO 4217 currency code. | -**customer_info** | [**CheckoutOrderTemplateCustomerInfo**](CheckoutOrderTemplateCustomerInfo.md) | | [optional] +**customer_info** | [**OrderRequestCustomerInfo**](OrderRequestCustomerInfo.md) | | [optional] **line_items** | [**List[Product]**](Product.md) | 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. | -**plan_ids** | **List[str]** | It is a list of plan IDs that will be associated with the order. | [optional] **metadata** | **Dict[str, object]** | 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. | [optional] +**tax_lines** | [**List[OrderTaxRequest]**](OrderTaxRequest.md) | List of [taxes](https://developers.conekta.com/v2.2.0/reference/orderscreatetaxes) that are applied to the order. | [optional] +**discount_lines** | [**List[OrderDiscountLinesRequest]**](OrderDiscountLinesRequest.md) | List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order. | [optional] ## Example diff --git a/docs/CheckoutOrderTemplateCustomerInfo.md b/docs/CheckoutOrderTemplateCustomerInfo.md deleted file mode 100644 index 310b3fd..0000000 --- a/docs/CheckoutOrderTemplateCustomerInfo.md +++ /dev/null @@ -1,35 +0,0 @@ -# CheckoutOrderTemplateCustomerInfo - -It is the information of the customer who will be created when receiving a new payment. - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | | -**email** | **str** | | -**phone** | **str** | | -**corporate** | **bool** | | [optional] -**object** | **str** | | [optional] -**customer_id** | **str** | | - -## Example - -```python -from conekta.models.checkout_order_template_customer_info import CheckoutOrderTemplateCustomerInfo - -# TODO update the JSON string below -json = "{}" -# create an instance of CheckoutOrderTemplateCustomerInfo from a JSON string -checkout_order_template_customer_info_instance = CheckoutOrderTemplateCustomerInfo.from_json(json) -# print the JSON string representation of the object -print(CheckoutOrderTemplateCustomerInfo.to_json()) - -# convert the object into a dict -checkout_order_template_customer_info_dict = checkout_order_template_customer_info_instance.to_dict() -# create an instance of CheckoutOrderTemplateCustomerInfo from a dict -checkout_order_template_customer_info_from_dict = CheckoutOrderTemplateCustomerInfo.from_dict(checkout_order_template_customer_info_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CheckoutResponse.md b/docs/CheckoutResponse.md index ee8c6b8..3b71342 100644 --- a/docs/CheckoutResponse.md +++ b/docs/CheckoutResponse.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **plan_ids** | **List[str]** | List of plan IDs that are available for subscription | [optional] **can_not_expire** | **bool** | | [optional] **emails_sent** | **int** | | [optional] -**exclude_card_networks** | **List[object]** | | [optional] +**exclude_card_networks** | **List[str]** | | [optional] **expires_at** | **int** | | [optional] **failure_url** | **str** | | [optional] **force_3ds_flow** | **bool** | | [optional] @@ -29,7 +29,7 @@ Name | Type | Description | Notes **sms_sent** | **int** | | [optional] **starts_at** | **int** | | [optional] **status** | **str** | | [optional] -**success_url** | **str** | | [optional] +**success_url** | **str** | The URL to redirect to after a successful payment. | [optional] **type** | **str** | | [optional] **url** | **str** | | [optional] diff --git a/docs/CompaniesApi.md b/docs/CompaniesApi.md index 4114f42..18107e9 100644 --- a/docs/CompaniesApi.md +++ b/docs/CompaniesApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**get_companies**](CompaniesApi.md#get_companies) | **GET** /companies | Get List of Companies [**get_company**](CompaniesApi.md#get_company) | **GET** /companies/{id} | Get Company [**get_company_documents**](CompaniesApi.md#get_company_documents) | **GET** /companies/{company_id}/documents | Get Company Documents +[**get_current_company**](CompaniesApi.md#get_current_company) | **GET** /companies/current | Get Current Company [**update_company_document**](CompaniesApi.md#update_company_document) | **PATCH** /companies/{company_id}/document | Update Company Document [**upload_company_document**](CompaniesApi.md#upload_company_document) | **POST** /companies/{company_id}/document | Upload Company Document @@ -130,7 +131,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.CompaniesApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) next = 'next_example' # str | next page (optional) @@ -152,7 +153,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] **next** | **str**| next page | [optional] @@ -217,7 +218,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.CompaniesApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Get Company @@ -236,7 +237,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -300,7 +301,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.CompaniesApi(api_client) company_id = '6307a60c41de27127515a575' # str | The unique identifier of the company. - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Get Company Documents @@ -319,7 +320,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **company_id** | **str**| The unique identifier of the company. | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -345,6 +346,86 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **get_current_company** +> CompanyResponse get_current_company(accept_language=accept_language) + +Get Current Company + +Retrieves information about the currently authenticated company. This endpoint returns the same data as the standard company endpoint but automatically uses the current company's context. + +### Example + +* Bearer Authentication (bearerAuth): + +```python +import conekta +from conekta.models.company_response import CompanyResponse +from conekta.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.conekta.io +# See configuration.py for a list of all supported configuration parameters. +configuration = conekta.Configuration( + host = "https://api.conekta.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: bearerAuth +configuration = conekta.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with conekta.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = conekta.CompaniesApi(api_client) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') + + try: + # Get Current Company + api_response = api_instance.get_current_company(accept_language=accept_language) + print("The response of CompaniesApi->get_current_company:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CompaniesApi->get_current_company: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] + +### Return type + +[**CompanyResponse**](CompanyResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/vnd.conekta-v2.2.0+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | successful | * Date - The date and time that the response was sent
* Content-Type - The format of the response body
* Content-Length - The length of the response body in bytes
* Connection - The type of connection used to transfer the response
* Conekta-Media-Type -
| +**401** | authentication error | - | +**500** | internal server error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **update_company_document** > CompanyDocumentResponse update_company_document(company_id, company_document_request, accept_language=accept_language) @@ -385,7 +466,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.CompaniesApi(api_client) company_id = '6827206b1ec60400015eb09a' # str | The unique identifier of the company. company_document_request = conekta.CompanyDocumentRequest() # CompanyDocumentRequest | Document information to update. - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Update Company Document @@ -405,7 +486,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **company_id** | **str**| The unique identifier of the company. | **company_document_request** | [**CompanyDocumentRequest**](CompanyDocumentRequest.md)| Document information to update. | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -471,7 +552,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.CompaniesApi(api_client) company_id = '6827206b1ec60400015eb09a' # str | The unique identifier of the company. company_document_request = conekta.CompanyDocumentRequest() # CompanyDocumentRequest | Document information to upload. - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Upload Company Document @@ -491,7 +572,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **company_id** | **str**| The unique identifier of the company. | **company_document_request** | [**CompanyDocumentRequest**](CompanyDocumentRequest.md)| Document information to upload. | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type diff --git a/docs/CompanyDocumentRequest.md b/docs/CompanyDocumentRequest.md index 2234cdb..80c2783 100644 --- a/docs/CompanyDocumentRequest.md +++ b/docs/CompanyDocumentRequest.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **content_type** | **str** | MIME type of the file. Allowed values depend on the `file_classification`. - `image/jpeg` - `image/png` - `application/pdf` | **international** | **bool** | Indicates if the document is international. Defaults to false. | [optional] **file_name** | **str** | Name of the file being uploaded. | -**file_data** | **bytearray** | Base64 encoded content of the file. | +**file_data** | **bytes** | Base64 encoded content of the file. | ## Example diff --git a/docs/CompanyResponse.md b/docs/CompanyResponse.md index a5cfb43..48a8463 100644 --- a/docs/CompanyResponse.md +++ b/docs/CompanyResponse.md @@ -11,9 +11,11 @@ Name | Type | Description | Notes **account_status** | **str** | The current status of the company's account. | **parent_company_id** | **str** | The identifier of the parent company, if any. | [optional] **onboarding_status** | **str** | The current status of the company's onboarding process. | -**documents** | [**List[CompanyResponseDocumentsInner]**](CompanyResponseDocumentsInner.md) | A list of documents related to the company. | +**documents** | [**List[CompanyDocumentResponse]**](CompanyDocumentResponse.md) | A list of documents related to the company. | **created_at** | **int** | Timestamp of when the company was created. | **object** | **str** | The type of object, typically \"company\". | +**three_ds_enabled** | **bool** | Indicates if 3DS authentication is enabled for the company. | [optional] +**three_ds_mode** | **str** | The 3DS mode for the company, either 'smart' or 'strict'. This property is only applicable when three_ds_enabled is true. When three_ds_enabled is false, this field will be null. | [optional] ## Example diff --git a/docs/CompanyResponseDocumentsInner.md b/docs/CompanyResponseDocumentsInner.md deleted file mode 100644 index d15fead..0000000 --- a/docs/CompanyResponseDocumentsInner.md +++ /dev/null @@ -1,31 +0,0 @@ -# CompanyResponseDocumentsInner - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**file_classification** | **str** | Classification of the document. | Tipo de archivo | Descripción | | :--------------------------- | :-------------------------------------------------------- | | `id_legal_representative` | identificación oficial frente | | `id_legal_representative_back` | identificación oficial atrás | | `cfdi` | Prueba de situación fiscal | | `constitutive_act_basic` | Acta constitutiva | | `proof_of_address` | Comprobante de domicilio del negocio | | `power_of_attonery` | Poderes de representación | | `deposit_account_cover` | Carátula de la cuenta de depósito | | `permit_casino` | Permiso ante SEGOB | | `license_sanitation` | Licencia sanitaria de COFEPRIS | | `registration_tourism` | Inscripción ante el Registro Nacional de Turismo (SECTUR) | | [optional] -**status** | **str** | The status of the document. | [optional] -**file_name** | **str** | The name of the file. | [optional] - -## Example - -```python -from conekta.models.company_response_documents_inner import CompanyResponseDocumentsInner - -# TODO update the JSON string below -json = "{}" -# create an instance of CompanyResponseDocumentsInner from a JSON string -company_response_documents_inner_instance = CompanyResponseDocumentsInner.from_json(json) -# print the JSON string representation of the object -print(CompanyResponseDocumentsInner.to_json()) - -# convert the object into a dict -company_response_documents_inner_dict = company_response_documents_inner_instance.to_dict() -# create an instance of CompanyResponseDocumentsInner from a dict -company_response_documents_inner_from_dict = CompanyResponseDocumentsInner.from_dict(company_response_documents_inner_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CreateCustomerFiscalEntitiesResponse.md b/docs/CreateCustomerFiscalEntitiesResponse.md index 3002b7c..3dae5cb 100644 --- a/docs/CreateCustomerFiscalEntitiesResponse.md +++ b/docs/CreateCustomerFiscalEntitiesResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**address** | [**CustomerAddress**](CustomerAddress.md) | | +**address** | [**FiscalEntityRequestAddress**](FiscalEntityRequestAddress.md) | | **tax_id** | **str** | | [optional] **email** | **str** | | [optional] **phone** | **str** | | [optional] diff --git a/docs/CreateCustomerPaymentMethodsResponse.md b/docs/CreateCustomerPaymentMethodsResponse.md index 6e93d1e..40ce53b 100644 --- a/docs/CreateCustomerPaymentMethodsResponse.md +++ b/docs/CreateCustomerPaymentMethodsResponse.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **object** | **str** | | **created_at** | **int** | | **parent_id** | **str** | | [optional] -**agreements** | [**List[PaymentMethodCashResponseAllOfAgreements]**](PaymentMethodCashResponseAllOfAgreements.md) | | [optional] +**agreements** | [**List[CashAgreementsResponse]**](CashAgreementsResponse.md) | | [optional] **reference** | **str** | | [optional] **barcode** | **str** | | [optional] **barcode_url** | **str** | URL to the barcode image, reference is the same as barcode | [optional] @@ -22,6 +22,7 @@ Name | Type | Description | Notes **exp_month** | **str** | | [optional] **exp_year** | **str** | | [optional] **brand** | **str** | | [optional] +**issuer** | **str** | Name of the institution that issued the card | [optional] **name** | **str** | | [optional] **default** | **bool** | | [optional] **visible_on_checkout** | **bool** | | [optional] diff --git a/docs/CreateRiskRulesData.md b/docs/CreateRuleWhitelistRequest.md similarity index 51% rename from docs/CreateRiskRulesData.md rename to docs/CreateRuleWhitelistRequest.md index 7279f8c..b310e1a 100644 --- a/docs/CreateRiskRulesData.md +++ b/docs/CreateRuleWhitelistRequest.md @@ -1,4 +1,4 @@ -# CreateRiskRulesData +# CreateRuleWhitelistRequest ## Properties @@ -12,19 +12,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.create_risk_rules_data import CreateRiskRulesData +from conekta.models.create_rule_whitelist_request import CreateRuleWhitelistRequest # TODO update the JSON string below json = "{}" -# create an instance of CreateRiskRulesData from a JSON string -create_risk_rules_data_instance = CreateRiskRulesData.from_json(json) +# create an instance of CreateRuleWhitelistRequest from a JSON string +create_rule_whitelist_request_instance = CreateRuleWhitelistRequest.from_json(json) # print the JSON string representation of the object -print(CreateRiskRulesData.to_json()) +print(CreateRuleWhitelistRequest.to_json()) # convert the object into a dict -create_risk_rules_data_dict = create_risk_rules_data_instance.to_dict() -# create an instance of CreateRiskRulesData from a dict -create_risk_rules_data_from_dict = CreateRiskRulesData.from_dict(create_risk_rules_data_dict) +create_rule_whitelist_request_dict = create_rule_whitelist_request_instance.to_dict() +# create an instance of CreateRuleWhitelistRequest from a dict +create_rule_whitelist_request_from_dict = CreateRuleWhitelistRequest.from_dict(create_rule_whitelist_request_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Customer.md b/docs/Customer.md index e97c6c5..220cfe0 100644 --- a/docs/Customer.md +++ b/docs/Customer.md @@ -13,14 +13,14 @@ Name | Type | Description | Notes **email** | **str** | 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** | **str** | 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** | **str** | It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact) | [optional] -**fiscal_entities** | [**List[CustomerFiscalEntitiesRequest]**](CustomerFiscalEntitiesRequest.md) | | [optional] +**fiscal_entities** | [**List[FiscalEntityRequest]**](FiscalEntityRequest.md) | | [optional] **metadata** | **Dict[str, object]** | | [optional] **name** | **str** | Client's name | **national_id** | **str** | It is a parameter that allows to identify the national identification number of the client. | [optional] **payment_sources** | [**List[CustomerPaymentMethodsRequest]**](CustomerPaymentMethodsRequest.md) | Contains details of the payment methods that the customer has active or has used in Conekta | [optional] **phone** | **str** | Is the customer's phone number | **plan_id** | **str** | Contains the ID of a plan, which could together with name, email and phone create a client directly to a subscription | [optional] -**shipping_contacts** | [**List[CustomerShippingContacts]**](CustomerShippingContacts.md) | Contains the detail of the shipping addresses that the client has active or has used in Conekta | [optional] +**shipping_contacts** | [**List[CustomerShippingContactsRequest]**](CustomerShippingContactsRequest.md) | Contains the detail of the shipping addresses that the client has active or has used in Conekta | [optional] **subscription** | [**SubscriptionRequest**](SubscriptionRequest.md) | | [optional] ## Example diff --git a/docs/CustomerDetails.md b/docs/CustomerDetails.md new file mode 100644 index 0000000..39eb201 --- /dev/null +++ b/docs/CustomerDetails.md @@ -0,0 +1,33 @@ +# CustomerDetails + +Customer details for customer portal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**object** | **str** | | [optional] +**name** | **str** | | [optional] +**email** | **str** | | [optional] + +## Example + +```python +from conekta.models.customer_details import CustomerDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomerDetails from a JSON string +customer_details_instance = CustomerDetails.from_json(json) +# print the JSON string representation of the object +print(CustomerDetails.to_json()) + +# convert the object into a dict +customer_details_dict = customer_details_instance.to_dict() +# create an instance of CustomerDetails from a dict +customer_details_from_dict = CustomerDetails.from_dict(customer_details_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CustomerFiscalEntitiesDataResponse.md b/docs/CustomerFiscalEntitiesDataResponse.md index 6859c7f..c973f3b 100644 --- a/docs/CustomerFiscalEntitiesDataResponse.md +++ b/docs/CustomerFiscalEntitiesDataResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**address** | [**CustomerAddress**](CustomerAddress.md) | | +**address** | [**FiscalEntityRequestAddress**](FiscalEntityRequestAddress.md) | | **tax_id** | **str** | | [optional] **email** | **str** | | [optional] **phone** | **str** | | [optional] diff --git a/docs/CustomerFiscalEntitiesRequest.md b/docs/CustomerFiscalEntitiesRequest.md deleted file mode 100644 index 3038527..0000000 --- a/docs/CustomerFiscalEntitiesRequest.md +++ /dev/null @@ -1,34 +0,0 @@ -# CustomerFiscalEntitiesRequest - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**address** | [**CustomerAddress**](CustomerAddress.md) | | -**tax_id** | **str** | | [optional] -**email** | **str** | | [optional] -**phone** | **str** | | [optional] -**metadata** | **Dict[str, object]** | | [optional] -**company_name** | **str** | | [optional] - -## Example - -```python -from conekta.models.customer_fiscal_entities_request import CustomerFiscalEntitiesRequest - -# TODO update the JSON string below -json = "{}" -# create an instance of CustomerFiscalEntitiesRequest from a JSON string -customer_fiscal_entities_request_instance = CustomerFiscalEntitiesRequest.from_json(json) -# print the JSON string representation of the object -print(CustomerFiscalEntitiesRequest.to_json()) - -# convert the object into a dict -customer_fiscal_entities_request_dict = customer_fiscal_entities_request_instance.to_dict() -# create an instance of CustomerFiscalEntitiesRequest from a dict -customer_fiscal_entities_request_from_dict = CustomerFiscalEntitiesRequest.from_dict(customer_fiscal_entities_request_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CustomerInfoCustomerId.md b/docs/CustomerInfoCustomerId.md new file mode 100644 index 0000000..5907ab2 --- /dev/null +++ b/docs/CustomerInfoCustomerId.md @@ -0,0 +1,29 @@ +# CustomerInfoCustomerId + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer_id** | **str** | | + +## Example + +```python +from conekta.models.customer_info_customer_id import CustomerInfoCustomerId + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomerInfoCustomerId from a JSON string +customer_info_customer_id_instance = CustomerInfoCustomerId.from_json(json) +# print the JSON string representation of the object +print(CustomerInfoCustomerId.to_json()) + +# convert the object into a dict +customer_info_customer_id_dict = customer_info_customer_id_instance.to_dict() +# create an instance of CustomerInfoCustomerId from a dict +customer_info_customer_id_from_dict = CustomerInfoCustomerId.from_dict(customer_info_customer_id_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CustomerInfoJustCustomerId.md b/docs/CustomerInfoJustCustomerId.md deleted file mode 100644 index cfd0f3d..0000000 --- a/docs/CustomerInfoJustCustomerId.md +++ /dev/null @@ -1,29 +0,0 @@ -# CustomerInfoJustCustomerId - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**customer_id** | **str** | | - -## Example - -```python -from conekta.models.customer_info_just_customer_id import CustomerInfoJustCustomerId - -# TODO update the JSON string below -json = "{}" -# create an instance of CustomerInfoJustCustomerId from a JSON string -customer_info_just_customer_id_instance = CustomerInfoJustCustomerId.from_json(json) -# print the JSON string representation of the object -print(CustomerInfoJustCustomerId.to_json()) - -# convert the object into a dict -customer_info_just_customer_id_dict = customer_info_just_customer_id_instance.to_dict() -# create an instance of CustomerInfoJustCustomerId from a dict -customer_info_just_customer_id_from_dict = CustomerInfoJustCustomerId.from_dict(customer_info_just_customer_id_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CustomerInfoJustCustomerIdResponse.md b/docs/CustomerInfoJustCustomerIdResponse.md deleted file mode 100644 index 6e80560..0000000 --- a/docs/CustomerInfoJustCustomerIdResponse.md +++ /dev/null @@ -1,29 +0,0 @@ -# CustomerInfoJustCustomerIdResponse - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**customer_id** | **str** | | [optional] - -## Example - -```python -from conekta.models.customer_info_just_customer_id_response import CustomerInfoJustCustomerIdResponse - -# TODO update the JSON string below -json = "{}" -# create an instance of CustomerInfoJustCustomerIdResponse from a JSON string -customer_info_just_customer_id_response_instance = CustomerInfoJustCustomerIdResponse.from_json(json) -# print the JSON string representation of the object -print(CustomerInfoJustCustomerIdResponse.to_json()) - -# convert the object into a dict -customer_info_just_customer_id_response_dict = customer_info_just_customer_id_response_instance.to_dict() -# create an instance of CustomerInfoJustCustomerIdResponse from a dict -customer_info_just_customer_id_response_from_dict = CustomerInfoJustCustomerIdResponse.from_dict(customer_info_just_customer_id_response_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CustomerPaymentMethodRequest.md b/docs/CustomerPaymentMethodRequest.md deleted file mode 100644 index 5b56dda..0000000 --- a/docs/CustomerPaymentMethodRequest.md +++ /dev/null @@ -1,30 +0,0 @@ -# CustomerPaymentMethodRequest - -Contains details of the payment methods that the customer has active or has used in Conekta - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **str** | Type of payment method | - -## Example - -```python -from conekta.models.customer_payment_method_request import CustomerPaymentMethodRequest - -# TODO update the JSON string below -json = "{}" -# create an instance of CustomerPaymentMethodRequest from a JSON string -customer_payment_method_request_instance = CustomerPaymentMethodRequest.from_json(json) -# print the JSON string representation of the object -print(CustomerPaymentMethodRequest.to_json()) - -# convert the object into a dict -customer_payment_method_request_dict = customer_payment_method_request_instance.to_dict() -# create an instance of CustomerPaymentMethodRequest from a dict -customer_payment_method_request_from_dict = CustomerPaymentMethodRequest.from_dict(customer_payment_method_request_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CustomerPaymentMethodsData.md b/docs/CustomerPaymentMethodsData.md index f64d063..d24876c 100644 --- a/docs/CustomerPaymentMethodsData.md +++ b/docs/CustomerPaymentMethodsData.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **object** | **str** | | **created_at** | **int** | | **parent_id** | **str** | | [optional] -**agreements** | [**List[PaymentMethodCashResponseAllOfAgreements]**](PaymentMethodCashResponseAllOfAgreements.md) | | [optional] +**agreements** | [**List[CashAgreementsResponse]**](CashAgreementsResponse.md) | | [optional] **reference** | **str** | | [optional] **barcode** | **str** | | [optional] **barcode_url** | **str** | URL to the barcode image, reference is the same as barcode | [optional] @@ -22,6 +22,7 @@ Name | Type | Description | Notes **exp_month** | **str** | | [optional] **exp_year** | **str** | | [optional] **brand** | **str** | | [optional] +**issuer** | **str** | Name of the institution that issued the card | [optional] **name** | **str** | | [optional] **default** | **bool** | | [optional] **visible_on_checkout** | **bool** | | [optional] diff --git a/docs/CustomerPortalResponse.md b/docs/CustomerPortalResponse.md new file mode 100644 index 0000000..3230979 --- /dev/null +++ b/docs/CustomerPortalResponse.md @@ -0,0 +1,41 @@ +# CustomerPortalResponse + +Customer portal model + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**slug** | **str** | Unique slug identifier for the portal | [optional] +**subscription_id** | **str** | Associated subscription ID | [optional] +**customer_id** | **str** | Associated customer ID | [optional] +**livemode** | **bool** | Whether this is a live or test mode portal | [optional] +**subscription** | [**SubscriptionDetails**](SubscriptionDetails.md) | | [optional] +**customer** | [**CustomerDetails**](CustomerDetails.md) | | [optional] +**id** | **str** | Customer portal ID | [optional] +**company_id** | **str** | Associated company ID | [optional] +**object** | **str** | | [optional] +**created_at** | **int** | Unix timestamp of creation | [optional] +**updated_at** | **int** | Unix timestamp of last update | [optional] +**portal_url** | **str** | URL to access the customer portal | [optional] + +## Example + +```python +from conekta.models.customer_portal_response import CustomerPortalResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomerPortalResponse from a JSON string +customer_portal_response_instance = CustomerPortalResponse.from_json(json) +# print the JSON string representation of the object +print(CustomerPortalResponse.to_json()) + +# convert the object into a dict +customer_portal_response_dict = customer_portal_response_instance.to_dict() +# create an instance of CustomerPortalResponse from a dict +customer_portal_response_from_dict = CustomerPortalResponse.from_dict(customer_portal_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CustomerResponse.md b/docs/CustomerResponse.md index 7a56066..4f284a0 100644 --- a/docs/CustomerResponse.md +++ b/docs/CustomerResponse.md @@ -25,7 +25,7 @@ Name | Type | Description | Notes **payment_sources** | [**CustomerPaymentMethodsResponse**](CustomerPaymentMethodsResponse.md) | | [optional] **phone** | **str** | Customer's phone number | [optional] **shipping_contacts** | [**CustomerResponseShippingContacts**](CustomerResponseShippingContacts.md) | | [optional] -**subscription** | [**SubscriptionResponse**](SubscriptionResponse.md) | | [optional] +**subscription** | [**CustomerSubscriptionResponse**](CustomerSubscriptionResponse.md) | | [optional] ## Example diff --git a/docs/CustomerShippingContactsAddress.md b/docs/CustomerShippingContactsAddress.md index f8d3f50..22ebb26 100644 --- a/docs/CustomerShippingContactsAddress.md +++ b/docs/CustomerShippingContactsAddress.md @@ -1,17 +1,17 @@ # CustomerShippingContactsAddress -Address of the person who will receive the order ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**object** | **str** | | [optional] **street1** | **str** | | [optional] **street2** | **str** | | [optional] **postal_code** | **str** | | [optional] **city** | **str** | | [optional] **state** | **str** | | [optional] -**country** | **str** | this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) | [optional] +**country** | **str** | | [optional] **residential** | **bool** | | [optional] ## Example diff --git a/docs/CustomerShippingContactsDataResponse.md b/docs/CustomerShippingContactsDataResponse.md index 46d285d..a36bae8 100644 --- a/docs/CustomerShippingContactsDataResponse.md +++ b/docs/CustomerShippingContactsDataResponse.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **phone** | **str** | Phone contact | [optional] **receiver** | **str** | Name of the person who will receive the order | [optional] **between_streets** | **str** | The street names between which the order will be delivered. | [optional] -**address** | [**CustomerShippingContactsAddress**](CustomerShippingContactsAddress.md) | | +**address** | [**CustomerShippingContactsRequestAddress**](CustomerShippingContactsRequestAddress.md) | | **parent_id** | **str** | | [optional] **default** | **bool** | | [optional] **deleted** | **bool** | | [optional] diff --git a/docs/CustomerShippingContacts.md b/docs/CustomerShippingContactsRequest.md similarity index 60% rename from docs/CustomerShippingContacts.md rename to docs/CustomerShippingContactsRequest.md index 54fe45d..bd02974 100644 --- a/docs/CustomerShippingContacts.md +++ b/docs/CustomerShippingContactsRequest.md @@ -1,4 +1,4 @@ -# CustomerShippingContacts +# CustomerShippingContactsRequest [Shipping](https://developers.conekta.com/v2.2.0/reference/createcustomershippingcontacts) details, required in case of sending a shipping. If we do not receive a shipping_contact on the order, the default shipping_contact of the customer will be used. @@ -9,7 +9,7 @@ Name | Type | Description | Notes **phone** | **str** | Phone contact | [optional] **receiver** | **str** | Name of the person who will receive the order | [optional] **between_streets** | **str** | The street names between which the order will be delivered. | [optional] -**address** | [**CustomerShippingContactsAddress**](CustomerShippingContactsAddress.md) | | +**address** | [**CustomerShippingContactsRequestAddress**](CustomerShippingContactsRequestAddress.md) | | **parent_id** | **str** | | [optional] **default** | **bool** | | [optional] **deleted** | **bool** | | [optional] @@ -18,19 +18,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.customer_shipping_contacts import CustomerShippingContacts +from conekta.models.customer_shipping_contacts_request import CustomerShippingContactsRequest # TODO update the JSON string below json = "{}" -# create an instance of CustomerShippingContacts from a JSON string -customer_shipping_contacts_instance = CustomerShippingContacts.from_json(json) +# create an instance of CustomerShippingContactsRequest from a JSON string +customer_shipping_contacts_request_instance = CustomerShippingContactsRequest.from_json(json) # print the JSON string representation of the object -print(CustomerShippingContacts.to_json()) +print(CustomerShippingContactsRequest.to_json()) # convert the object into a dict -customer_shipping_contacts_dict = customer_shipping_contacts_instance.to_dict() -# create an instance of CustomerShippingContacts from a dict -customer_shipping_contacts_from_dict = CustomerShippingContacts.from_dict(customer_shipping_contacts_dict) +customer_shipping_contacts_request_dict = customer_shipping_contacts_request_instance.to_dict() +# create an instance of CustomerShippingContactsRequest from a dict +customer_shipping_contacts_request_from_dict = CustomerShippingContactsRequest.from_dict(customer_shipping_contacts_request_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CustomerShippingContactsRequestAddress.md b/docs/CustomerShippingContactsRequestAddress.md new file mode 100644 index 0000000..a11415d --- /dev/null +++ b/docs/CustomerShippingContactsRequestAddress.md @@ -0,0 +1,36 @@ +# CustomerShippingContactsRequestAddress + +Address of the person who will receive the order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**street1** | **str** | | [optional] +**street2** | **str** | | [optional] +**postal_code** | **str** | | [optional] +**city** | **str** | | [optional] +**state** | **str** | | [optional] +**country** | **str** | this field follows the [ISO 3166-1 alpha-2 standard](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) | [optional] +**residential** | **bool** | | [optional] + +## Example + +```python +from conekta.models.customer_shipping_contacts_request_address import CustomerShippingContactsRequestAddress + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomerShippingContactsRequestAddress from a JSON string +customer_shipping_contacts_request_address_instance = CustomerShippingContactsRequestAddress.from_json(json) +# print the JSON string representation of the object +print(CustomerShippingContactsRequestAddress.to_json()) + +# convert the object into a dict +customer_shipping_contacts_request_address_dict = customer_shipping_contacts_request_address_instance.to_dict() +# create an instance of CustomerShippingContactsRequestAddress from a dict +customer_shipping_contacts_request_address_from_dict = CustomerShippingContactsRequestAddress.from_dict(customer_shipping_contacts_request_address_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CustomerShippingContactsResponse.md b/docs/CustomerShippingContactsResponse.md index 69a4c95..4d152d5 100644 --- a/docs/CustomerShippingContactsResponse.md +++ b/docs/CustomerShippingContactsResponse.md @@ -9,7 +9,7 @@ Name | Type | Description | Notes **phone** | **str** | | [optional] **receiver** | **str** | | [optional] **between_streets** | **str** | | [optional] -**address** | [**CustomerShippingContactsResponseAddress**](CustomerShippingContactsResponseAddress.md) | | [optional] +**address** | [**CustomerShippingContactsAddress**](CustomerShippingContactsAddress.md) | | [optional] **parent_id** | **str** | | [optional] **default** | **bool** | | [optional] **id** | **str** | | [optional] diff --git a/docs/CustomerShippingContactsResponseAddress.md b/docs/CustomerShippingContactsResponseAddress.md deleted file mode 100644 index 7b7d6ab..0000000 --- a/docs/CustomerShippingContactsResponseAddress.md +++ /dev/null @@ -1,36 +0,0 @@ -# CustomerShippingContactsResponseAddress - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**object** | **str** | | [optional] -**street1** | **str** | | [optional] -**street2** | **str** | | [optional] -**postal_code** | **str** | | [optional] -**city** | **str** | | [optional] -**state** | **str** | | [optional] -**country** | **str** | | [optional] -**residential** | **bool** | | [optional] - -## Example - -```python -from conekta.models.customer_shipping_contacts_response_address import CustomerShippingContactsResponseAddress - -# TODO update the JSON string below -json = "{}" -# create an instance of CustomerShippingContactsResponseAddress from a JSON string -customer_shipping_contacts_response_address_instance = CustomerShippingContactsResponseAddress.from_json(json) -# print the JSON string representation of the object -print(CustomerShippingContactsResponseAddress.to_json()) - -# convert the object into a dict -customer_shipping_contacts_response_address_dict = customer_shipping_contacts_response_address_instance.to_dict() -# create an instance of CustomerShippingContactsResponseAddress from a dict -customer_shipping_contacts_response_address_from_dict = CustomerShippingContactsResponseAddress.from_dict(customer_shipping_contacts_response_address_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CustomerSubscriptionResponse.md b/docs/CustomerSubscriptionResponse.md new file mode 100644 index 0000000..0af1341 --- /dev/null +++ b/docs/CustomerSubscriptionResponse.md @@ -0,0 +1,47 @@ +# CustomerSubscriptionResponse + +subscription model + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**billing_cycle_start** | **int** | | [optional] +**billing_cycle_end** | **int** | | [optional] +**canceled_at** | **int** | | [optional] +**canceled_reason** | **str** | Reason for cancellation. This field appears when the subscription status is 'canceled'. | [optional] +**card_id** | **str** | | [optional] +**charge_id** | **str** | | [optional] +**created_at** | **int** | | [optional] +**customer_custom_reference** | **str** | | [optional] +**customer_id** | **str** | | [optional] +**id** | **str** | | [optional] +**last_billing_cycle_order_id** | **str** | | [optional] +**object** | **str** | | [optional] +**paused_at** | **int** | | [optional] +**plan_id** | **str** | | [optional] +**status** | **str** | | [optional] +**subscription_start** | **int** | | [optional] +**trial_start** | **int** | | [optional] +**trial_end** | **int** | | [optional] + +## Example + +```python +from conekta.models.customer_subscription_response import CustomerSubscriptionResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of CustomerSubscriptionResponse from a JSON string +customer_subscription_response_instance = CustomerSubscriptionResponse.from_json(json) +# print the JSON string representation of the object +print(CustomerSubscriptionResponse.to_json()) + +# convert the object into a dict +customer_subscription_response_dict = customer_subscription_response_instance.to_dict() +# create an instance of CustomerSubscriptionResponse from a dict +customer_subscription_response_from_dict = CustomerSubscriptionResponse.from_dict(customer_subscription_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CustomerUpdateFiscalEntitiesRequest.md b/docs/CustomerUpdateFiscalEntitiesRequest.md deleted file mode 100644 index fe44cc8..0000000 --- a/docs/CustomerUpdateFiscalEntitiesRequest.md +++ /dev/null @@ -1,34 +0,0 @@ -# CustomerUpdateFiscalEntitiesRequest - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**address** | [**CustomerAddress**](CustomerAddress.md) | | [optional] -**tax_id** | **str** | | [optional] -**email** | **str** | | [optional] -**phone** | **str** | | [optional] -**metadata** | **Dict[str, object]** | | [optional] -**company_name** | **str** | | [optional] - -## Example - -```python -from conekta.models.customer_update_fiscal_entities_request import CustomerUpdateFiscalEntitiesRequest - -# TODO update the JSON string below -json = "{}" -# create an instance of CustomerUpdateFiscalEntitiesRequest from a JSON string -customer_update_fiscal_entities_request_instance = CustomerUpdateFiscalEntitiesRequest.from_json(json) -# print the JSON string representation of the object -print(CustomerUpdateFiscalEntitiesRequest.to_json()) - -# convert the object into a dict -customer_update_fiscal_entities_request_dict = customer_update_fiscal_entities_request_instance.to_dict() -# create an instance of CustomerUpdateFiscalEntitiesRequest from a dict -customer_update_fiscal_entities_request_from_dict = CustomerUpdateFiscalEntitiesRequest.from_dict(customer_update_fiscal_entities_request_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/CustomerUpdateShippingContacts.md b/docs/CustomerUpdateShippingContactsRequest.md similarity index 55% rename from docs/CustomerUpdateShippingContacts.md rename to docs/CustomerUpdateShippingContactsRequest.md index bd5f707..cbd6618 100644 --- a/docs/CustomerUpdateShippingContacts.md +++ b/docs/CustomerUpdateShippingContactsRequest.md @@ -1,4 +1,4 @@ -# CustomerUpdateShippingContacts +# CustomerUpdateShippingContactsRequest [Shipping](https://developers.conekta.com/v2.2.0/reference/createcustomershippingcontacts) details, required in case of sending a shipping. If we do not receive a shipping_contact on the order, the default shipping_contact of the customer will be used. @@ -9,7 +9,7 @@ Name | Type | Description | Notes **phone** | **str** | Phone contact | [optional] **receiver** | **str** | Name of the person who will receive the order | [optional] **between_streets** | **str** | The street names between which the order will be delivered. | [optional] -**address** | [**CustomerShippingContactsAddress**](CustomerShippingContactsAddress.md) | | [optional] +**address** | [**CustomerShippingContactsRequestAddress**](CustomerShippingContactsRequestAddress.md) | | [optional] **parent_id** | **str** | | [optional] **default** | **bool** | | [optional] **deleted** | **bool** | | [optional] @@ -17,19 +17,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.customer_update_shipping_contacts import CustomerUpdateShippingContacts +from conekta.models.customer_update_shipping_contacts_request import CustomerUpdateShippingContactsRequest # TODO update the JSON string below json = "{}" -# create an instance of CustomerUpdateShippingContacts from a JSON string -customer_update_shipping_contacts_instance = CustomerUpdateShippingContacts.from_json(json) +# create an instance of CustomerUpdateShippingContactsRequest from a JSON string +customer_update_shipping_contacts_request_instance = CustomerUpdateShippingContactsRequest.from_json(json) # print the JSON string representation of the object -print(CustomerUpdateShippingContacts.to_json()) +print(CustomerUpdateShippingContactsRequest.to_json()) # convert the object into a dict -customer_update_shipping_contacts_dict = customer_update_shipping_contacts_instance.to_dict() -# create an instance of CustomerUpdateShippingContacts from a dict -customer_update_shipping_contacts_from_dict = CustomerUpdateShippingContacts.from_dict(customer_update_shipping_contacts_dict) +customer_update_shipping_contacts_request_dict = customer_update_shipping_contacts_request_instance.to_dict() +# create an instance of CustomerUpdateShippingContactsRequest from a dict +customer_update_shipping_contacts_request_from_dict = CustomerUpdateShippingContactsRequest.from_dict(customer_update_shipping_contacts_request_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/CustomersApi.md b/docs/CustomersApi.md index ef4c14a..f507366 100644 --- a/docs/CustomersApi.md +++ b/docs/CustomersApi.md @@ -18,7 +18,9 @@ Method | HTTP request | Description Create customer -The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer) +The purpose of business is to create and keep a customer, you will learn what elements you need to create a customer. +Remember the credit and debit card tokenization process: [https://developers.conekta.com/page/web-checkout-tokenizer](https://developers.conekta.com/page/web-checkout-tokenizer) + ### Example @@ -52,7 +54,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.CustomersApi(api_client) customer = conekta.Customer() # Customer | requested field for customer - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -72,7 +74,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer** | [**Customer**](Customer.md)| requested field for customer | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -101,7 +103,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **create_customer_fiscal_entities** -> CreateCustomerFiscalEntitiesResponse create_customer_fiscal_entities(id, customer_fiscal_entities_request, accept_language=accept_language, x_child_company_id=x_child_company_id) +> CreateCustomerFiscalEntitiesResponse create_customer_fiscal_entities(id, fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id) Create Fiscal Entity @@ -114,7 +116,7 @@ Create Fiscal entity resource that corresponds to a customer ID. ```python import conekta from conekta.models.create_customer_fiscal_entities_response import CreateCustomerFiscalEntitiesResponse -from conekta.models.customer_fiscal_entities_request import CustomerFiscalEntitiesRequest +from conekta.models.fiscal_entity_request import FiscalEntityRequest from conekta.rest import ApiException from pprint import pprint @@ -139,13 +141,13 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.CustomersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - customer_fiscal_entities_request = conekta.CustomerFiscalEntitiesRequest() # CustomerFiscalEntitiesRequest | requested field for customer fiscal entities - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + fiscal_entity_request = conekta.FiscalEntityRequest() # FiscalEntityRequest | requested field for customer fiscal entities + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Create Fiscal Entity - api_response = api_instance.create_customer_fiscal_entities(id, customer_fiscal_entities_request, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.create_customer_fiscal_entities(id, fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of CustomersApi->create_customer_fiscal_entities:\n") pprint(api_response) except Exception as e: @@ -160,8 +162,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **customer_fiscal_entities_request** | [**CustomerFiscalEntitiesRequest**](CustomerFiscalEntitiesRequest.md)| requested field for customer fiscal entities | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **fiscal_entity_request** | [**FiscalEntityRequest**](FiscalEntityRequest.md)| requested field for customer fiscal entities | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -227,7 +229,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.CustomersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -247,7 +249,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -313,7 +315,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.CustomersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -333,7 +335,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -397,7 +399,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.CustomersApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -420,7 +422,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -490,7 +492,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.CustomersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource update_customer = conekta.UpdateCustomer() # UpdateCustomer | requested field for customer - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -511,7 +513,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **update_customer** | [**UpdateCustomer**](UpdateCustomer.md)| requested field for customer | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -540,7 +542,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_customer_fiscal_entities** -> UpdateCustomerFiscalEntitiesResponse update_customer_fiscal_entities(id, fiscal_entities_id, customer_update_fiscal_entities_request, accept_language=accept_language, x_child_company_id=x_child_company_id) +> UpdateCustomerFiscalEntitiesResponse update_customer_fiscal_entities(id, fiscal_entities_id, update_fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id) Update Fiscal Entity @@ -552,8 +554,8 @@ Update Fiscal Entity resource that corresponds to a customer ID. ```python import conekta -from conekta.models.customer_update_fiscal_entities_request import CustomerUpdateFiscalEntitiesRequest from conekta.models.update_customer_fiscal_entities_response import UpdateCustomerFiscalEntitiesResponse +from conekta.models.update_fiscal_entity_request import UpdateFiscalEntityRequest from conekta.rest import ApiException from pprint import pprint @@ -579,13 +581,13 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.CustomersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource fiscal_entities_id = 'fis_ent_2tQ8HkkfbauaKP9Ho' # str | identifier - customer_update_fiscal_entities_request = conekta.CustomerUpdateFiscalEntitiesRequest() # CustomerUpdateFiscalEntitiesRequest | requested field for customer update fiscal entities - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + update_fiscal_entity_request = conekta.UpdateFiscalEntityRequest() # UpdateFiscalEntityRequest | requested field for customer update fiscal entities + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Update Fiscal Entity - api_response = api_instance.update_customer_fiscal_entities(id, fiscal_entities_id, customer_update_fiscal_entities_request, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.update_customer_fiscal_entities(id, fiscal_entities_id, update_fiscal_entity_request, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of CustomersApi->update_customer_fiscal_entities:\n") pprint(api_response) except Exception as e: @@ -601,8 +603,8 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **fiscal_entities_id** | **str**| identifier | - **customer_update_fiscal_entities_request** | [**CustomerUpdateFiscalEntitiesRequest**](CustomerUpdateFiscalEntitiesRequest.md)| requested field for customer update fiscal entities | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **update_fiscal_entity_request** | [**UpdateFiscalEntityRequest**](UpdateFiscalEntityRequest.md)| requested field for customer update fiscal entities | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/CustomersResponse.md b/docs/CustomersResponse.md index 28d82af..994e514 100644 --- a/docs/CustomersResponse.md +++ b/docs/CustomersResponse.md @@ -5,11 +5,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**data** | [**List[CustomerResponse]**](CustomerResponse.md) | | [optional] **has_more** | **bool** | Indicates if there are more pages to be requested | **object** | **str** | Object type, in this case is list | **next_page_url** | **str** | URL of the next page. | [optional] **previous_page_url** | **str** | Url of the previous page. | [optional] -**data** | [**List[CustomerResponse]**](CustomerResponse.md) | | [optional] ## Example diff --git a/docs/Details.md b/docs/Details.md deleted file mode 100644 index ad57267..0000000 --- a/docs/Details.md +++ /dev/null @@ -1,29 +0,0 @@ -# Details - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**details** | [**List[DetailsError]**](DetailsError.md) | | [optional] - -## Example - -```python -from conekta.models.details import Details - -# TODO update the JSON string below -json = "{}" -# create an instance of Details from a JSON string -details_instance = Details.from_json(json) -# print the JSON string representation of the object -print(Details.to_json()) - -# convert the object into a dict -details_dict = details_instance.to_dict() -# create an instance of Details from a dict -details_from_dict = Details.from_dict(details_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/DiscountsApi.md b/docs/DiscountsApi.md index 0fa08de..b9d475d 100644 --- a/docs/DiscountsApi.md +++ b/docs/DiscountsApi.md @@ -51,7 +51,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.DiscountsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource order_discount_lines_request = conekta.OrderDiscountLinesRequest() # OrderDiscountLinesRequest | requested field for a discount lines - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -72,7 +72,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **order_discount_lines_request** | [**OrderDiscountLinesRequest**](OrderDiscountLinesRequest.md)| requested field for a discount lines | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -138,7 +138,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.DiscountsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource discount_lines_id = 'dis_lin_2tQ974hSHcsdeSZHG' # str | discount line id identifier - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -159,7 +159,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **discount_lines_id** | **str**| discount line id identifier | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -226,7 +226,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.DiscountsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource discount_lines_id = 'dis_lin_2tQ974hSHcsdeSZHG' # str | discount line id identifier - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -247,7 +247,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **discount_lines_id** | **str**| discount line id identifier | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -313,7 +313,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.DiscountsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -337,7 +337,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -408,7 +408,7 @@ with conekta.ApiClient(configuration) as api_client: id = '6307a60c41de27127515a575' # str | Identifier of the resource discount_lines_id = 'dis_lin_2tQ974hSHcsdeSZHG' # str | discount line id identifier update_order_discount_lines_request = conekta.UpdateOrderDiscountLinesRequest() # UpdateOrderDiscountLinesRequest | requested field for a discount lines - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -430,7 +430,7 @@ Name | Type | Description | Notes **id** | **str**| Identifier of the resource | **discount_lines_id** | **str**| discount line id identifier | **update_order_discount_lines_request** | [**UpdateOrderDiscountLinesRequest**](UpdateOrderDiscountLinesRequest.md)| requested field for a discount lines | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/EventsApi.md b/docs/EventsApi.md index 484823d..dd42182 100644 --- a/docs/EventsApi.md +++ b/docs/EventsApi.md @@ -47,7 +47,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.EventsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -67,7 +67,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -129,7 +129,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.EventsApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -152,7 +152,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -183,7 +183,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **resend_event** -> EventsResendResponse resend_event(event_id, resend_request, accept_language=accept_language) +> EventsResendResponse resend_event(event_id, resend_event_request, accept_language=accept_language) Resend Event @@ -196,7 +196,7 @@ Resend event to selected webhooks ```python import conekta from conekta.models.events_resend_response import EventsResendResponse -from conekta.models.resend_request import ResendRequest +from conekta.models.resend_event_request import ResendEventRequest from conekta.rest import ApiException from pprint import pprint @@ -221,12 +221,12 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.EventsApi(api_client) event_id = '6463d6e35a4c3e001819e760' # str | event identifier - resend_request = conekta.ResendRequest() # ResendRequest | requested fields for resend an event - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + resend_event_request = conekta.ResendEventRequest() # ResendEventRequest | requested fields for resend an event + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Resend Event - api_response = api_instance.resend_event(event_id, resend_request, accept_language=accept_language) + api_response = api_instance.resend_event(event_id, resend_event_request, accept_language=accept_language) print("The response of EventsApi->resend_event:\n") pprint(api_response) except Exception as e: @@ -241,8 +241,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **event_id** | **str**| event identifier | - **resend_request** | [**ResendRequest**](ResendRequest.md)| requested fields for resend an event | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **resend_event_request** | [**ResendEventRequest**](ResendEventRequest.md)| requested fields for resend an event | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type diff --git a/docs/FiscalEntityRequest.md b/docs/FiscalEntityRequest.md new file mode 100644 index 0000000..fa3a392 --- /dev/null +++ b/docs/FiscalEntityRequest.md @@ -0,0 +1,34 @@ +# FiscalEntityRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | [**FiscalEntityRequestAddress**](FiscalEntityRequestAddress.md) | | +**tax_id** | **str** | | [optional] +**email** | **str** | | [optional] +**phone** | **str** | | [optional] +**metadata** | **Dict[str, object]** | | [optional] +**company_name** | **str** | | [optional] + +## Example + +```python +from conekta.models.fiscal_entity_request import FiscalEntityRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of FiscalEntityRequest from a JSON string +fiscal_entity_request_instance = FiscalEntityRequest.from_json(json) +# print the JSON string representation of the object +print(FiscalEntityRequest.to_json()) + +# convert the object into a dict +fiscal_entity_request_dict = fiscal_entity_request_instance.to_dict() +# create an instance of FiscalEntityRequest from a dict +fiscal_entity_request_from_dict = FiscalEntityRequest.from_dict(fiscal_entity_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/CustomerAddress.md b/docs/FiscalEntityRequestAddress.md similarity index 59% rename from docs/CustomerAddress.md rename to docs/FiscalEntityRequestAddress.md index cf7aec8..bf9bf20 100644 --- a/docs/CustomerAddress.md +++ b/docs/FiscalEntityRequestAddress.md @@ -1,4 +1,4 @@ -# CustomerAddress +# FiscalEntityRequestAddress ## Properties @@ -17,19 +17,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.customer_address import CustomerAddress +from conekta.models.fiscal_entity_request_address import FiscalEntityRequestAddress # TODO update the JSON string below json = "{}" -# create an instance of CustomerAddress from a JSON string -customer_address_instance = CustomerAddress.from_json(json) +# create an instance of FiscalEntityRequestAddress from a JSON string +fiscal_entity_request_address_instance = FiscalEntityRequestAddress.from_json(json) # print the JSON string representation of the object -print(CustomerAddress.to_json()) +print(FiscalEntityRequestAddress.to_json()) # convert the object into a dict -customer_address_dict = customer_address_instance.to_dict() -# create an instance of CustomerAddress from a dict -customer_address_from_dict = CustomerAddress.from_dict(customer_address_dict) +fiscal_entity_request_address_dict = fiscal_entity_request_address_instance.to_dict() +# create an instance of FiscalEntityRequestAddress from a dict +fiscal_entity_request_address_from_dict = FiscalEntityRequestAddress.from_dict(fiscal_entity_request_address_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/GetCustomerPaymentMethodDataResponse.md b/docs/GetCustomerPaymentMethodDataResponse.md index ef03375..3a18673 100644 --- a/docs/GetCustomerPaymentMethodDataResponse.md +++ b/docs/GetCustomerPaymentMethodDataResponse.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **object** | **str** | | **created_at** | **int** | | **parent_id** | **str** | | [optional] -**agreements** | [**List[PaymentMethodCashResponseAllOfAgreements]**](PaymentMethodCashResponseAllOfAgreements.md) | | [optional] +**agreements** | [**List[CashAgreementsResponse]**](CashAgreementsResponse.md) | | [optional] **reference** | **str** | | [optional] **barcode** | **str** | | [optional] **barcode_url** | **str** | URL to the barcode image, reference is the same as barcode | [optional] @@ -22,6 +22,7 @@ Name | Type | Description | Notes **exp_month** | **str** | | [optional] **exp_year** | **str** | | [optional] **brand** | **str** | | [optional] +**issuer** | **str** | Name of the institution that issued the card | [optional] **name** | **str** | | [optional] **default** | **bool** | | [optional] **visible_on_checkout** | **bool** | | [optional] diff --git a/docs/LogResponse.md b/docs/LogResponseForRequest.md similarity index 71% rename from docs/LogResponse.md rename to docs/LogResponseForRequest.md index cb432a2..e9c4d47 100644 --- a/docs/LogResponse.md +++ b/docs/LogResponseForRequest.md @@ -1,4 +1,4 @@ -# LogResponse +# LogResponseForRequest log model @@ -30,19 +30,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.log_response import LogResponse +from conekta.models.log_response_for_request import LogResponseForRequest # TODO update the JSON string below json = "{}" -# create an instance of LogResponse from a JSON string -log_response_instance = LogResponse.from_json(json) +# create an instance of LogResponseForRequest from a JSON string +log_response_for_request_instance = LogResponseForRequest.from_json(json) # print the JSON string representation of the object -print(LogResponse.to_json()) +print(LogResponseForRequest.to_json()) # convert the object into a dict -log_response_dict = log_response_instance.to_dict() -# create an instance of LogResponse from a dict -log_response_from_dict = LogResponse.from_dict(log_response_dict) +log_response_for_request_dict = log_response_for_request_instance.to_dict() +# create an instance of LogResponseForRequest from a dict +log_response_for_request_from_dict = LogResponseForRequest.from_dict(log_response_for_request_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/LogsApi.md b/docs/LogsApi.md index 7e5e71a..65fd104 100644 --- a/docs/LogsApi.md +++ b/docs/LogsApi.md @@ -9,7 +9,7 @@ Method | HTTP request | Description # **get_log_by_id** -> LogResponse get_log_by_id(id, accept_language=accept_language, x_child_company_id=x_child_company_id) +> LogResponseForRequest get_log_by_id(id, accept_language=accept_language, x_child_company_id=x_child_company_id) Get Log @@ -21,7 +21,7 @@ Get the details of a specific log ```python import conekta -from conekta.models.log_response import LogResponse +from conekta.models.log_response_for_request import LogResponseForRequest from conekta.rest import ApiException from pprint import pprint @@ -46,7 +46,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.LogsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -66,12 +66,12 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type -[**LogResponse**](LogResponse.md) +[**LogResponseForRequest**](LogResponseForRequest.md) ### Authorization @@ -94,7 +94,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_logs** -> LogsResponse get_logs(accept_language=accept_language, x_child_company_id=x_child_company_id, limit=limit, search=search, next=next, previous=previous) +> LogsResponseForRequest get_logs(accept_language=accept_language, x_child_company_id=x_child_company_id, limit=limit, search=search, next=next, previous=previous) Get List Of Logs @@ -106,7 +106,7 @@ Get log details in the form of a list ```python import conekta -from conekta.models.logs_response import LogsResponse +from conekta.models.logs_response_for_request import LogsResponseForRequest from conekta.rest import ApiException from pprint import pprint @@ -130,7 +130,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.LogsApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -153,7 +153,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -162,7 +162,7 @@ Name | Type | Description | Notes ### Return type -[**LogsResponse**](LogsResponse.md) +[**LogsResponseForRequest**](LogsResponseForRequest.md) ### Authorization diff --git a/docs/LogsResponse.md b/docs/LogsResponseForRequest.md similarity index 61% rename from docs/LogsResponse.md rename to docs/LogsResponseForRequest.md index 97f7109..819e3e5 100644 --- a/docs/LogsResponse.md +++ b/docs/LogsResponseForRequest.md @@ -1,4 +1,4 @@ -# LogsResponse +# LogsResponseForRequest logs model @@ -15,19 +15,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.logs_response import LogsResponse +from conekta.models.logs_response_for_request import LogsResponseForRequest # TODO update the JSON string below json = "{}" -# create an instance of LogsResponse from a JSON string -logs_response_instance = LogsResponse.from_json(json) +# create an instance of LogsResponseForRequest from a JSON string +logs_response_for_request_instance = LogsResponseForRequest.from_json(json) # print the JSON string representation of the object -print(LogsResponse.to_json()) +print(LogsResponseForRequest.to_json()) # convert the object into a dict -logs_response_dict = logs_response_instance.to_dict() -# create an instance of LogsResponse from a dict -logs_response_from_dict = LogsResponse.from_dict(logs_response_dict) +logs_response_for_request_dict = logs_response_for_request_instance.to_dict() +# create an instance of LogsResponseForRequest from a dict +logs_response_for_request_from_dict = LogsResponseForRequest.from_dict(logs_response_for_request_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/OrderChargesResponse.md b/docs/OrderChargesResponse.md index 097302b..5a8199f 100644 --- a/docs/OrderChargesResponse.md +++ b/docs/OrderChargesResponse.md @@ -8,6 +8,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **has_more** | **bool** | Indicates if there are more pages to be requested | **object** | **str** | Object type, in this case is list | +**next_page_url** | **str** | URL of the next page. | [optional] +**previous_page_url** | **str** | Url of the previous page. | [optional] **data** | [**List[ChargesDataResponse]**](ChargesDataResponse.md) | | [optional] ## Example diff --git a/docs/CheckoutRequest.md b/docs/OrderCheckoutRequest.md similarity index 52% rename from docs/CheckoutRequest.md rename to docs/OrderCheckoutRequest.md index 046d175..937eb25 100644 --- a/docs/CheckoutRequest.md +++ b/docs/OrderCheckoutRequest.md @@ -1,4 +1,4 @@ -# CheckoutRequest +# OrderCheckoutRequest [Checkout](https://developers.conekta.com/v2.2.0/reference/payment-link) details @@ -7,9 +7,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **allowed_payment_methods** | **List[str]** | Are the payment methods available for this link. For subscriptions, only 'card' is allowed due to the recurring nature of the payments. | +**exclude_card_networks** | **List[str]** | List of card networks to exclude from the checkout. This field is only applicable for card payments. | [optional] **plan_ids** | **List[str]** | List of plan IDs that will be available for subscription. This field is required for subscription payments. | [optional] -**expires_at** | **int** | Unix timestamp of checkout expiration | [optional] +**expires_at** | **int** | It is the time when the link will expire. It is expressed in seconds since the Unix epoch. The valid range is from 5 minutes to 365 days from the creation date. | [optional] **failure_url** | **str** | Redirection url back to the site in case of failed payment, applies only to HostedPayment. | [optional] +**force_save_card** | **bool** | Indicates whether the card used for the payment should be saved for future purchases. This field is only applicable for card payments. | [optional] **monthly_installments_enabled** | **bool** | | [optional] **monthly_installments_options** | **List[int]** | | [optional] **max_failed_retries** | **int** | Number of retries allowed before the checkout is marked as failed | [optional] @@ -17,24 +19,24 @@ Name | Type | Description | Notes **on_demand_enabled** | **bool** | | [optional] **redirection_time** | **int** | number of seconds to wait before redirecting to the success_url | [optional] **success_url** | **str** | Redirection url back to the site in case of successful payment, applies only to HostedPayment | [optional] -**type** | **str** | This field represents the type of checkout | [optional] +**type** | **str** | Required. This field represents the type of checkout, which determines the user experience during the payment process. 'HostedPayment' will redirect the customer to a Conekta-hosted page to complete the payment, while 'Integration' allows the payment process to be handled entirely on your site using Conekta's APIs and SDKs. | [optional] ## Example ```python -from conekta.models.checkout_request import CheckoutRequest +from conekta.models.order_checkout_request import OrderCheckoutRequest # TODO update the JSON string below json = "{}" -# create an instance of CheckoutRequest from a JSON string -checkout_request_instance = CheckoutRequest.from_json(json) +# create an instance of OrderCheckoutRequest from a JSON string +order_checkout_request_instance = OrderCheckoutRequest.from_json(json) # print the JSON string representation of the object -print(CheckoutRequest.to_json()) +print(OrderCheckoutRequest.to_json()) # convert the object into a dict -checkout_request_dict = checkout_request_instance.to_dict() -# create an instance of CheckoutRequest from a dict -checkout_request_from_dict = CheckoutRequest.from_dict(checkout_request_dict) +order_checkout_request_dict = order_checkout_request_instance.to_dict() +# create an instance of OrderCheckoutRequest from a dict +order_checkout_request_from_dict = OrderCheckoutRequest.from_dict(order_checkout_request_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/OrderCustomerInfoResponse.md b/docs/OrderCustomerInfoResponse.md deleted file mode 100644 index c8db7c9..0000000 --- a/docs/OrderCustomerInfoResponse.md +++ /dev/null @@ -1,34 +0,0 @@ -# OrderCustomerInfoResponse - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**customer_custom_reference** | **str** | Custom reference | [optional] -**name** | **str** | | [optional] -**email** | **str** | | [optional] -**phone** | **str** | | [optional] -**corporate** | **bool** | | [optional] [default to False] -**object** | **str** | | [optional] - -## Example - -```python -from conekta.models.order_customer_info_response import OrderCustomerInfoResponse - -# TODO update the JSON string below -json = "{}" -# create an instance of OrderCustomerInfoResponse from a JSON string -order_customer_info_response_instance = OrderCustomerInfoResponse.from_json(json) -# print the JSON string representation of the object -print(OrderCustomerInfoResponse.to_json()) - -# convert the object into a dict -order_customer_info_response_dict = order_customer_info_response_instance.to_dict() -# create an instance of OrderCustomerInfoResponse from a dict -order_customer_info_response_from_dict = OrderCustomerInfoResponse.from_dict(order_customer_info_response_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/OrderDiscountLinesResponse.md b/docs/OrderDiscountLinesResponse.md index 20464ca..e15f950 100644 --- a/docs/OrderDiscountLinesResponse.md +++ b/docs/OrderDiscountLinesResponse.md @@ -1,5 +1,6 @@ # OrderDiscountLinesResponse +List of discounts that are applied to the order ## Properties @@ -7,6 +8,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **has_more** | **bool** | Indicates if there are more pages to be requested | **object** | **str** | Object type, in this case is list | +**next_page_url** | **str** | URL of the next page. | [optional] +**previous_page_url** | **str** | Url of the previous page. | [optional] **data** | [**List[DiscountLinesDataResponse]**](DiscountLinesDataResponse.md) | | [optional] ## Example diff --git a/docs/OrderRequest.md b/docs/OrderRequest.md index f217919..9291dd6 100644 --- a/docs/OrderRequest.md +++ b/docs/OrderRequest.md @@ -7,21 +7,21 @@ a order Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **charges** | [**List[ChargeRequest]**](ChargeRequest.md) | List of [charges](https://developers.conekta.com/v2.2.0/reference/orderscreatecharge) that are applied to the order | [optional] -**checkout** | [**CheckoutRequest**](CheckoutRequest.md) | | [optional] +**checkout** | [**OrderCheckoutRequest**](OrderCheckoutRequest.md) | | [optional] **currency** | **str** | Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) | **customer_info** | [**OrderRequestCustomerInfo**](OrderRequestCustomerInfo.md) | | -**discount_lines** | [**List[OrderDiscountLinesRequest]**](OrderDiscountLinesRequest.md) | List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount. | [optional] +**discount_lines** | [**List[OrderDiscountLinesRequest]**](OrderDiscountLinesRequest.md) | List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order. | [optional] **fiscal_entity** | [**OrderFiscalEntityRequest**](OrderFiscalEntityRequest.md) | | [optional] **line_items** | [**List[Product]**](Product.md) | List of [products](https://developers.conekta.com/v2.2.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product. | **metadata** | **Dict[str, object]** | Metadata associated with the order | [optional] **needs_shipping_contact** | **bool** | Allows you to fill out the shipping information at checkout | [optional] -**pre_authorize** | **bool** | Indicates whether the order charges must be preauthorized | [optional] [default to False] +**pre_authorize** | **bool** | Indicates whether the order charges must be preauthorized | [optional] **processing_mode** | **str** | Indicates the processing mode for the order, either ecommerce, recurrent or validation. | [optional] **return_url** | **str** | Indicates the redirection callback upon completion of the 3DS2 flow. Do not use this parameter if your order has a checkout parameter | [optional] -**shipping_contact** | [**CustomerShippingContacts**](CustomerShippingContacts.md) | | [optional] +**shipping_contact** | [**CustomerShippingContactsRequest**](CustomerShippingContactsRequest.md) | | [optional] **shipping_lines** | [**List[ShippingRequest]**](ShippingRequest.md) | List of [shipping costs](https://developers.conekta.com/v2.2.0/reference/orderscreateshipping). If the online store offers digital products. | [optional] **tax_lines** | [**List[OrderTaxRequest]**](OrderTaxRequest.md) | List of [taxes](https://developers.conekta.com/v2.2.0/reference/orderscreatetaxes) that are applied to the order. | [optional] -**three_ds_mode** | **str** | Indicates the 3DS2 mode for the order, either smart or strict. | [optional] +**three_ds_mode** | **str** | Indicates the 3DS2 mode for the order, either smart or strict. This property is only applicable when 3DS is enabled. When 3DS is disabled, this field should be null. | [optional] ## Example diff --git a/docs/OrderResponse.md b/docs/OrderResponse.md index 1aa0600..3c4d572 100644 --- a/docs/OrderResponse.md +++ b/docs/OrderResponse.md @@ -15,6 +15,8 @@ Name | Type | Description | Notes **currency** | **str** | The three-letter ISO 4217 currency code. The currency of the order. | [optional] **customer_info** | [**OrderResponseCustomerInfo**](OrderResponseCustomerInfo.md) | | [optional] **discount_lines** | [**OrderDiscountLinesResponse**](OrderDiscountLinesResponse.md) | | [optional] +**tax_lines** | [**OrderTaxLinesResponse**](OrderTaxLinesResponse.md) | | [optional] +**shipping_lines** | [**OrderShippingLinesResponse**](OrderShippingLinesResponse.md) | | [optional] **fiscal_entity** | [**OrderFiscalEntityResponse**](OrderFiscalEntityResponse.md) | | [optional] **id** | **str** | | [optional] **is_refundable** | **bool** | | [optional] diff --git a/docs/OrderResponseCheckout.md b/docs/OrderResponseCheckout.md index 58e7e20..1a0d400 100644 --- a/docs/OrderResponseCheckout.md +++ b/docs/OrderResponseCheckout.md @@ -5,34 +5,35 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**allowed_payment_methods** | **List[str]** | Are the payment methods available for this link | [optional] +**allowed_payment_methods** | **List[str]** | Are the payment methods available for this link | **can_not_expire** | **bool** | | [optional] **emails_sent** | **int** | | [optional] -**exclude_card_networks** | **List[object]** | | [optional] +**exclude_card_networks** | **List[str]** | | [optional] **expires_at** | **int** | | [optional] **failure_url** | **str** | | [optional] **force_3ds_flow** | **bool** | | [optional] -**id** | **str** | | [optional] +**force_save_card** | **bool** | Indicates whether the card used for the payment should be saved for future purchases. This field is only applicable for card payments. | [optional] +**id** | **str** | | **is_redirect_on_failure** | **bool** | | [optional] **livemode** | **bool** | | [optional] **max_failed_retries** | **int** | Number of retries allowed before the checkout is marked as failed | [optional] **metadata** | **Dict[str, object]** | | [optional] **monthly_installments_enabled** | **bool** | | [optional] **monthly_installments_options** | **List[int]** | | [optional] -**name** | **str** | | [optional] +**name** | **str** | | **needs_shipping_contact** | **bool** | | [optional] -**object** | **str** | | [optional] +**object** | **str** | | **on_demand_enabled** | **bool** | | [optional] **paid_payments_count** | **int** | | [optional] **recurrent** | **bool** | | [optional] **redirection_time** | **int** | number of seconds to wait before redirecting to the success_url | [optional] **slug** | **str** | | [optional] **sms_sent** | **int** | | [optional] -**success_url** | **str** | | [optional] +**success_url** | **str** | Redirection url back to the site in case of successful payment, applies only to HostedPayment | [optional] **starts_at** | **int** | | [optional] **status** | **str** | | [optional] -**type** | **str** | | [optional] -**url** | **str** | | [optional] +**type** | **str** | This field represents the type of checkout, which determines the user experience during the payment process. 'HostedPayment' will redirect the customer to a Conekta-hosted page to complete the payment, while 'Integration' allows the payment process to be handled entirely on your site using Conekta's APIs and SDKs. | +**url** | **str** | Indicate the url of the Conekta component to complete the payment. For HostedPayment, this will be a Conekta-hosted page | [optional] ## Example diff --git a/docs/OrderResponseCustomerInfo.md b/docs/OrderResponseCustomerInfo.md index 9b55801..c89b9c7 100644 --- a/docs/OrderResponseCustomerInfo.md +++ b/docs/OrderResponseCustomerInfo.md @@ -5,12 +5,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**object** | **str** | | [optional] **customer_custom_reference** | **str** | Custom reference | [optional] **name** | **str** | | [optional] **email** | **str** | | [optional] **phone** | **str** | | [optional] **corporate** | **bool** | | [optional] [default to False] -**object** | **str** | | [optional] **customer_id** | **str** | | [optional] ## Example diff --git a/docs/OrderResponseShippingContact.md b/docs/OrderResponseShippingContact.md index ae6b352..99acf90 100644 --- a/docs/OrderResponseShippingContact.md +++ b/docs/OrderResponseShippingContact.md @@ -5,16 +5,16 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**created_at** | **int** | | [optional] +**id** | **str** | | [optional] +**object** | **str** | | [optional] **phone** | **str** | | [optional] **receiver** | **str** | | [optional] **between_streets** | **str** | | [optional] -**address** | [**CustomerShippingContactsResponseAddress**](CustomerShippingContactsResponseAddress.md) | | [optional] +**address** | [**CustomerShippingContactsAddress**](CustomerShippingContactsAddress.md) | | [optional] **parent_id** | **str** | | [optional] **default** | **bool** | | [optional] -**id** | **str** | | [optional] -**created_at** | **int** | | [optional] **metadata** | **Dict[str, object]** | Metadata associated with the shipping contact | [optional] -**object** | **str** | | [optional] **deleted** | **bool** | | [optional] ## Example diff --git a/docs/OrderShippingLinesResponse.md b/docs/OrderShippingLinesResponse.md new file mode 100644 index 0000000..c7af514 --- /dev/null +++ b/docs/OrderShippingLinesResponse.md @@ -0,0 +1,34 @@ +# OrderShippingLinesResponse + +List of shipping costs applied to the order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**has_more** | **bool** | Indicates if there are more pages to be requested | +**object** | **str** | Object type, in this case is list | +**next_page_url** | **str** | URL of the next page. | [optional] +**previous_page_url** | **str** | Url of the previous page. | [optional] +**data** | [**List[ShippingLinesDataResponse]**](ShippingLinesDataResponse.md) | | [optional] + +## Example + +```python +from conekta.models.order_shipping_lines_response import OrderShippingLinesResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderShippingLinesResponse from a JSON string +order_shipping_lines_response_instance = OrderShippingLinesResponse.from_json(json) +# print the JSON string representation of the object +print(OrderShippingLinesResponse.to_json()) + +# convert the object into a dict +order_shipping_lines_response_dict = order_shipping_lines_response_instance.to_dict() +# create an instance of OrderShippingLinesResponse from a dict +order_shipping_lines_response_from_dict = OrderShippingLinesResponse.from_dict(order_shipping_lines_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderTaxLinesResponse.md b/docs/OrderTaxLinesResponse.md new file mode 100644 index 0000000..c27e885 --- /dev/null +++ b/docs/OrderTaxLinesResponse.md @@ -0,0 +1,34 @@ +# OrderTaxLinesResponse + +List of taxes that are applied to the order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**has_more** | **bool** | Indicates if there are more pages to be requested | +**object** | **str** | Object type, in this case is list | +**next_page_url** | **str** | URL of the next page. | [optional] +**previous_page_url** | **str** | Url of the previous page. | [optional] +**data** | [**List[TaxLinesDataResponse]**](TaxLinesDataResponse.md) | | [optional] + +## Example + +```python +from conekta.models.order_tax_lines_response import OrderTaxLinesResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderTaxLinesResponse from a JSON string +order_tax_lines_response_instance = OrderTaxLinesResponse.from_json(json) +# print the JSON string representation of the object +print(OrderTaxLinesResponse.to_json()) + +# convert the object into a dict +order_tax_lines_response_dict = order_tax_lines_response_instance.to_dict() +# create an instance of OrderTaxLinesResponse from a dict +order_tax_lines_response_from_dict = OrderTaxLinesResponse.from_dict(order_tax_lines_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdateOrderTaxResponse.md b/docs/OrderTaxResponse.md similarity index 59% rename from docs/UpdateOrderTaxResponse.md rename to docs/OrderTaxResponse.md index 98a373f..c1fb730 100644 --- a/docs/UpdateOrderTaxResponse.md +++ b/docs/OrderTaxResponse.md @@ -1,4 +1,4 @@ -# UpdateOrderTaxResponse +# OrderTaxResponse create new taxes for an existing order response @@ -16,19 +16,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.update_order_tax_response import UpdateOrderTaxResponse +from conekta.models.order_tax_response import OrderTaxResponse # TODO update the JSON string below json = "{}" -# create an instance of UpdateOrderTaxResponse from a JSON string -update_order_tax_response_instance = UpdateOrderTaxResponse.from_json(json) +# create an instance of OrderTaxResponse from a JSON string +order_tax_response_instance = OrderTaxResponse.from_json(json) # print the JSON string representation of the object -print(UpdateOrderTaxResponse.to_json()) +print(OrderTaxResponse.to_json()) # convert the object into a dict -update_order_tax_response_dict = update_order_tax_response_instance.to_dict() -# create an instance of UpdateOrderTaxResponse from a dict -update_order_tax_response_from_dict = UpdateOrderTaxResponse.from_dict(update_order_tax_response_dict) +order_tax_response_dict = order_tax_response_instance.to_dict() +# create an instance of OrderTaxResponse from a dict +order_tax_response_from_dict = OrderTaxResponse.from_dict(order_tax_response_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/OrderUpdateRequest.md b/docs/OrderUpdate.md similarity index 65% rename from docs/OrderUpdateRequest.md rename to docs/OrderUpdate.md index e976d6b..722d4c5 100644 --- a/docs/OrderUpdateRequest.md +++ b/docs/OrderUpdate.md @@ -1,4 +1,4 @@ -# OrderUpdateRequest +# OrderUpdate a order @@ -7,34 +7,34 @@ a order Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **charges** | [**List[ChargeRequest]**](ChargeRequest.md) | | [optional] -**checkout** | [**CheckoutRequest**](CheckoutRequest.md) | | [optional] +**checkout** | [**OrderCheckoutRequest**](OrderCheckoutRequest.md) | | [optional] **currency** | **str** | Currency with which the payment will be made. It uses the 3-letter code of the [International Standard ISO 4217.](https://es.wikipedia.org/wiki/ISO_4217) | [optional] -**customer_info** | [**OrderUpdateRequestCustomerInfo**](OrderUpdateRequestCustomerInfo.md) | | [optional] -**discount_lines** | [**List[OrderDiscountLinesRequest]**](OrderDiscountLinesRequest.md) | List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order. You must have at least one discount. | [optional] +**customer_info** | [**OrderUpdateCustomerInfo**](OrderUpdateCustomerInfo.md) | | [optional] +**discount_lines** | [**List[OrderDiscountLinesRequest]**](OrderDiscountLinesRequest.md) | List of [discounts](https://developers.conekta.com/v2.2.0/reference/orderscreatediscountline) that are applied to the order. | [optional] **fiscal_entity** | [**OrderUpdateFiscalEntityRequest**](OrderUpdateFiscalEntityRequest.md) | | [optional] **line_items** | [**List[Product]**](Product.md) | List of [products](https://developers.conekta.com/v2.2.0/reference/orderscreateproduct) that are sold in the order. You must have at least one product. | [optional] **metadata** | **Dict[str, str]** | | [optional] -**pre_authorize** | **bool** | Indicates whether the order charges must be preauthorized | [optional] [default to False] -**shipping_contact** | [**CustomerShippingContacts**](CustomerShippingContacts.md) | | [optional] +**pre_authorize** | **bool** | Indicates whether the order charges must be preauthorized | [optional] +**shipping_contact** | [**CustomerShippingContactsRequest**](CustomerShippingContactsRequest.md) | | [optional] **shipping_lines** | [**List[ShippingRequest]**](ShippingRequest.md) | List of [shipping costs](https://developers.conekta.com/v2.2.0/reference/orderscreateshipping). If the online store offers digital products. | [optional] **tax_lines** | [**List[OrderTaxRequest]**](OrderTaxRequest.md) | | [optional] ## Example ```python -from conekta.models.order_update_request import OrderUpdateRequest +from conekta.models.order_update import OrderUpdate # TODO update the JSON string below json = "{}" -# create an instance of OrderUpdateRequest from a JSON string -order_update_request_instance = OrderUpdateRequest.from_json(json) +# create an instance of OrderUpdate from a JSON string +order_update_instance = OrderUpdate.from_json(json) # print the JSON string representation of the object -print(OrderUpdateRequest.to_json()) +print(OrderUpdate.to_json()) # convert the object into a dict -order_update_request_dict = order_update_request_instance.to_dict() -# create an instance of OrderUpdateRequest from a dict -order_update_request_from_dict = OrderUpdateRequest.from_dict(order_update_request_dict) +order_update_dict = order_update_instance.to_dict() +# create an instance of OrderUpdate from a dict +order_update_from_dict = OrderUpdate.from_dict(order_update_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/OrderUpdateCustomerInfo.md b/docs/OrderUpdateCustomerInfo.md new file mode 100644 index 0000000..540ac3b --- /dev/null +++ b/docs/OrderUpdateCustomerInfo.md @@ -0,0 +1,34 @@ +# OrderUpdateCustomerInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**email** | **str** | | +**phone** | **str** | | +**corporate** | **bool** | | [optional] +**object** | **str** | | [optional] +**customer_id** | **str** | | + +## Example + +```python +from conekta.models.order_update_customer_info import OrderUpdateCustomerInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderUpdateCustomerInfo from a JSON string +order_update_customer_info_instance = OrderUpdateCustomerInfo.from_json(json) +# print the JSON string representation of the object +print(OrderUpdateCustomerInfo.to_json()) + +# convert the object into a dict +order_update_customer_info_dict = order_update_customer_info_instance.to_dict() +# create an instance of OrderUpdateCustomerInfo from a dict +order_update_customer_info_from_dict = OrderUpdateCustomerInfo.from_dict(order_update_customer_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderUpdateRequestCustomerInfo.md b/docs/OrderUpdateRequestCustomerInfo.md deleted file mode 100644 index 7dad0d8..0000000 --- a/docs/OrderUpdateRequestCustomerInfo.md +++ /dev/null @@ -1,34 +0,0 @@ -# OrderUpdateRequestCustomerInfo - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**name** | **str** | | -**email** | **str** | | -**phone** | **str** | | -**corporate** | **bool** | | [optional] -**object** | **str** | | [optional] -**customer_id** | **str** | | - -## Example - -```python -from conekta.models.order_update_request_customer_info import OrderUpdateRequestCustomerInfo - -# TODO update the JSON string below -json = "{}" -# create an instance of OrderUpdateRequestCustomerInfo from a JSON string -order_update_request_customer_info_instance = OrderUpdateRequestCustomerInfo.from_json(json) -# print the JSON string representation of the object -print(OrderUpdateRequestCustomerInfo.to_json()) - -# convert the object into a dict -order_update_request_customer_info_dict = order_update_request_customer_info_instance.to_dict() -# create an instance of OrderUpdateRequestCustomerInfo from a dict -order_update_request_customer_info_from_dict = OrderUpdateRequestCustomerInfo.from_dict(order_update_request_customer_info_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/OrdersApi.md b/docs/OrdersApi.md index 9ca14d6..26506d8 100644 --- a/docs/OrdersApi.md +++ b/docs/OrdersApi.md @@ -52,7 +52,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.OrdersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -72,7 +72,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -139,8 +139,8 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.OrdersApi(api_client) - order_request = conekta.OrderRequest() # OrderRequest | requested field for order - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + order_request = {"charges":[{"amount":40000,"expires_at":1677196303,"monthly_installments":0,"payment_method":{"type":"card","token_id":"tok_2897348234","payment_source_id":"src_2tLkkyfMPh6v7pFry","customer_ip_address":"0.0.0.0"},"reference_id":"string"}],"currency":"MXN","customer_info":{"name":"DevTest","email":"test@conekta.com","phone":"5522997233","corporate":false,"object":"customer_info"},"fiscal_entity":{"tax_id":"1234567890","name":"Conekta Inc","email":"test@gmail.com","phone":"525511223344","metadata":{"test":true,"company_id":"123"},"address":{"street1":"Nuevo Leon 254","street2":"Departamento 404","postal_code":"06100","city":"Ciudad de Mexico","state":"Ciudad de Mexico","country":"MX","external_number":"123"}},"discount_lines":[{"amount":500,"code":"123","type":"loyalty"}],"line_items":[{"antifraud_info":{"additionalProp1":{},"additionalProp2":{},"additionalProp3":{}},"description":"string","sku":"string","name":"Box of Cohiba S1s","unit_price":20000,"quantity":1,"tags":["string"],"brand":"string","metadata":{"additionalProp1":"string","additionalProp2":"string","additionalProp3":"string"}}],"metadata":{"test":true,"company_id":"123"},"pre_authorize":false,"shipping_contact":{"phone":"525511223344","receiver":"Marvin Fuller","between_streets":"Ackerman Crescent","metadata":{"test":true,"company_id":"123"},"address":{"street1":"Nuevo Leon 254","street2":"Departamento 404","postal_code":"06100","city":"Ciudad de Mexico","state":"Ciudad de Mexico","country":"MX","residential":true},"parent_id":"string","default":true,"deleted":true},"shipping_lines":[{"amount":100,"carrier":"FEDEX","tracking_number":"TRACK123","method":"TRAING","metadata":{"key":"value"}}],"tax_lines":[{"amount":100,"description":"testing","metadata":{"additionalProp1":{},"additionalProp2":{},"additionalProp3":{}}}]} # OrderRequest | requested field for order + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -160,7 +160,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **order_request** | [**OrderRequest**](OrderRequest.md)| requested field for order | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -189,7 +189,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_order_by_id** -> OrderResponse get_order_by_id(id, accept_language=accept_language, x_child_company_id=x_child_company_id) +> OrderResponse get_order_by_id(id, accept_language=accept_language, x_child_company_id=x_child_company_id, client=client) Get Order @@ -226,12 +226,13 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.OrdersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) + client = 'checkout' # str | client of the object to be retrieved (optional) try: # Get Order - api_response = api_instance.get_order_by_id(id, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.get_order_by_id(id, accept_language=accept_language, x_child_company_id=x_child_company_id, client=client) print("The response of OrdersApi->get_order_by_id:\n") pprint(api_response) except Exception as e: @@ -246,8 +247,9 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] + **client** | **str**| client of the object to be retrieved | [optional] ### Return type @@ -310,7 +312,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.OrdersApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -340,7 +342,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -416,7 +418,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.OrdersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource refund_id = '6407b5bee1329a000175ba11' # str | refund identifier - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -437,7 +439,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **refund_id** | **str**| refund identifier | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -506,7 +508,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.OrdersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource order_refund_request = conekta.OrderRefundRequest() # OrderRefundRequest | requested field for a refund - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -527,7 +529,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **order_refund_request** | [**OrderRefundRequest**](OrderRefundRequest.md)| requested field for a refund | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -595,7 +597,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.OrdersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) order_capture_request = conekta.OrderCaptureRequest() # OrderCaptureRequest | requested fields for capture order (optional) @@ -616,7 +618,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **order_capture_request** | [**OrderCaptureRequest**](OrderCaptureRequest.md)| requested fields for capture order | [optional] @@ -646,7 +648,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_order** -> OrderResponse update_order(id, order_update_request, accept_language=accept_language) +> OrderResponse update_order(id, order_update, accept_language=accept_language) Update Order @@ -659,7 +661,7 @@ Update an existing Order. ```python import conekta from conekta.models.order_response import OrderResponse -from conekta.models.order_update_request import OrderUpdateRequest +from conekta.models.order_update import OrderUpdate from conekta.rest import ApiException from pprint import pprint @@ -684,12 +686,12 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.OrdersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - order_update_request = conekta.OrderUpdateRequest() # OrderUpdateRequest | requested field for an order - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + order_update = conekta.OrderUpdate() # OrderUpdate | requested field for an order + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Update Order - api_response = api_instance.update_order(id, order_update_request, accept_language=accept_language) + api_response = api_instance.update_order(id, order_update, accept_language=accept_language) print("The response of OrdersApi->update_order:\n") pprint(api_response) except Exception as e: @@ -704,8 +706,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **order_update_request** | [**OrderUpdateRequest**](OrderUpdateRequest.md)| requested field for an order | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **order_update** | [**OrderUpdate**](OrderUpdate.md)| requested field for an order | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type diff --git a/docs/OrdersResponse.md b/docs/OrdersResponse.md deleted file mode 100644 index f7cb021..0000000 --- a/docs/OrdersResponse.md +++ /dev/null @@ -1,29 +0,0 @@ -# OrdersResponse - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**List[OrderResponse]**](OrderResponse.md) | | - -## Example - -```python -from conekta.models.orders_response import OrdersResponse - -# TODO update the JSON string below -json = "{}" -# create an instance of OrdersResponse from a JSON string -orders_response_instance = OrdersResponse.from_json(json) -# print the JSON string representation of the object -print(OrdersResponse.to_json()) - -# convert the object into a dict -orders_response_dict = orders_response_instance.to_dict() -# create an instance of OrdersResponse from a dict -orders_response_from_dict = OrdersResponse.from_dict(orders_response_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/UpdateOrderTaxRequest.md b/docs/OrdersUpdateTaxesRequest.md similarity index 55% rename from docs/UpdateOrderTaxRequest.md rename to docs/OrdersUpdateTaxesRequest.md index 72a2db5..e411b12 100644 --- a/docs/UpdateOrderTaxRequest.md +++ b/docs/OrdersUpdateTaxesRequest.md @@ -1,4 +1,4 @@ -# UpdateOrderTaxRequest +# OrdersUpdateTaxesRequest create new taxes for an existing order @@ -13,19 +13,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.update_order_tax_request import UpdateOrderTaxRequest +from conekta.models.orders_update_taxes_request import OrdersUpdateTaxesRequest # TODO update the JSON string below json = "{}" -# create an instance of UpdateOrderTaxRequest from a JSON string -update_order_tax_request_instance = UpdateOrderTaxRequest.from_json(json) +# create an instance of OrdersUpdateTaxesRequest from a JSON string +orders_update_taxes_request_instance = OrdersUpdateTaxesRequest.from_json(json) # print the JSON string representation of the object -print(UpdateOrderTaxRequest.to_json()) +print(OrdersUpdateTaxesRequest.to_json()) # convert the object into a dict -update_order_tax_request_dict = update_order_tax_request_instance.to_dict() -# create an instance of UpdateOrderTaxRequest from a dict -update_order_tax_request_from_dict = UpdateOrderTaxRequest.from_dict(update_order_tax_request_dict) +orders_update_taxes_request_dict = orders_update_taxes_request_instance.to_dict() +# create an instance of OrdersUpdateTaxesRequest from a dict +orders_update_taxes_request_from_dict = OrdersUpdateTaxesRequest.from_dict(orders_update_taxes_request_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/Page.md b/docs/Page.md deleted file mode 100644 index 7cbaf9b..0000000 --- a/docs/Page.md +++ /dev/null @@ -1,31 +0,0 @@ -# Page - -page metadata - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**next_page_url** | **str** | URL of the next page. | [optional] -**previous_page_url** | **str** | Url of the previous page. | [optional] - -## Example - -```python -from conekta.models.page import Page - -# TODO update the JSON string below -json = "{}" -# create an instance of Page from a JSON string -page_instance = Page.from_json(json) -# print the JSON string representation of the object -print(Page.to_json()) - -# convert the object into a dict -page_dict = page_instance.to_dict() -# create an instance of Page from a dict -page_from_dict = Page.from_dict(page_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/Pagination.md b/docs/Pagination.md deleted file mode 100644 index 9c25ef7..0000000 --- a/docs/Pagination.md +++ /dev/null @@ -1,31 +0,0 @@ -# Pagination - -pagination metadata - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**has_more** | **bool** | Indicates if there are more pages to be requested | -**object** | **str** | Object type, in this case is list | - -## Example - -```python -from conekta.models.pagination import Pagination - -# TODO update the JSON string below -json = "{}" -# create an instance of Pagination from a JSON string -pagination_instance = Pagination.from_json(json) -# print the JSON string representation of the object -print(Pagination.to_json()) - -# convert the object into a dict -pagination_dict = pagination_instance.to_dict() -# create an instance of Pagination from a dict -pagination_from_dict = Pagination.from_dict(pagination_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/PaymentLinkApi.md b/docs/PaymentLinkApi.md index 8c57b6a..9d69261 100644 --- a/docs/PaymentLinkApi.md +++ b/docs/PaymentLinkApi.md @@ -48,7 +48,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PaymentLinkApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -68,7 +68,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -133,8 +133,8 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PaymentLinkApi(api_client) - checkout = conekta.Checkout() # Checkout | requested field for checkout - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + checkout = {"name":"Payment Link con Plan","type":"PaymentLink","recurrent":false,"expires_at":1745331574,"allowed_payment_methods":["card"],"needs_shipping_contact":false,"plan_ids":["plan_ejemplo_1","plan_ejemplo_2"],"order_template":{"line_items":[{"name":"Producto de Ejemplo","unit_price":15000,"quantity":1}],"currency":"MXN","customer_info":{"name":"Cliente Ejemplo","email":"ejemplo@conekta.com","phone":"5555555555"},"metadata":{"reference":"mi_referencia_123","more_info":"datos_adicionales"}}} # Checkout | requested field for checkout + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -154,7 +154,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **checkout** | [**Checkout**](Checkout.md)| requested field for checkout | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -220,7 +220,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.PaymentLinkApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource email_checkout_request = conekta.EmailCheckoutRequest() # EmailCheckoutRequest | requested field for sms checkout - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -241,7 +241,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **email_checkout_request** | [**EmailCheckoutRequest**](EmailCheckoutRequest.md)| requested field for sms checkout | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -306,7 +306,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PaymentLinkApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -326,7 +326,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -392,7 +392,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PaymentLinkApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -415,7 +415,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -485,7 +485,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.PaymentLinkApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource sms_checkout_request = conekta.SmsCheckoutRequest() # SmsCheckoutRequest | requested field for sms checkout - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -506,7 +506,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **sms_checkout_request** | [**SmsCheckoutRequest**](SmsCheckoutRequest.md)| requested field for sms checkout | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/PaymentMethod.md b/docs/PaymentMethod.md deleted file mode 100644 index 2dabd91..0000000 --- a/docs/PaymentMethod.md +++ /dev/null @@ -1,30 +0,0 @@ -# PaymentMethod - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **str** | | [optional] -**object** | **str** | | - -## Example - -```python -from conekta.models.payment_method import PaymentMethod - -# TODO update the JSON string below -json = "{}" -# create an instance of PaymentMethod from a JSON string -payment_method_instance = PaymentMethod.from_json(json) -# print the JSON string representation of the object -print(PaymentMethod.to_json()) - -# convert the object into a dict -payment_method_dict = payment_method_instance.to_dict() -# create an instance of PaymentMethod from a dict -payment_method_from_dict = PaymentMethod.from_dict(payment_method_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/PaymentMethodCardResponse.md b/docs/PaymentMethodCardResponse.md index a1ec5e3..08f399b 100644 --- a/docs/PaymentMethodCardResponse.md +++ b/docs/PaymentMethodCardResponse.md @@ -16,6 +16,7 @@ Name | Type | Description | Notes **exp_month** | **str** | | [optional] **exp_year** | **str** | | [optional] **brand** | **str** | | [optional] +**issuer** | **str** | Name of the institution that issued the card | [optional] **name** | **str** | | [optional] **default** | **bool** | | [optional] **visible_on_checkout** | **bool** | | [optional] diff --git a/docs/PaymentMethodCashRecurrentResponse.md b/docs/PaymentMethodCashRecurrentResponse.md index 58e1e16..a9f8218 100644 --- a/docs/PaymentMethodCashRecurrentResponse.md +++ b/docs/PaymentMethodCashRecurrentResponse.md @@ -11,7 +11,7 @@ Name | Type | Description | Notes **object** | **str** | | **created_at** | **int** | | **parent_id** | **str** | | [optional] -**agreements** | [**List[PaymentMethodCashResponseAllOfAgreements]**](PaymentMethodCashResponseAllOfAgreements.md) | | [optional] +**agreements** | [**List[CashAgreementsResponse]**](CashAgreementsResponse.md) | | [optional] **reference** | **str** | | [optional] **barcode** | **str** | | [optional] **barcode_url** | **str** | URL to the barcode image, reference is the same as barcode | [optional] diff --git a/docs/PaymentMethodCashResponse.md b/docs/PaymentMethodCashResponse.md index 53412db..7eed2ba 100644 --- a/docs/PaymentMethodCashResponse.md +++ b/docs/PaymentMethodCashResponse.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **object** | **str** | | **created_at** | **int** | | **parent_id** | **str** | | [optional] -**agreements** | [**List[PaymentMethodCashResponseAllOfAgreements]**](PaymentMethodCashResponseAllOfAgreements.md) | | [optional] +**agreements** | [**List[CashAgreementsResponse]**](CashAgreementsResponse.md) | | [optional] **reference** | **str** | | [optional] **barcode** | **str** | | [optional] **barcode_url** | **str** | URL to the barcode image, reference is the same as barcode | [optional] diff --git a/docs/PaymentMethodCashResponseAllOfAgreements.md b/docs/PaymentMethodCashResponseAllOfAgreements.md deleted file mode 100644 index a971f54..0000000 --- a/docs/PaymentMethodCashResponseAllOfAgreements.md +++ /dev/null @@ -1,30 +0,0 @@ -# PaymentMethodCashResponseAllOfAgreements - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**agreement** | **str** | Agreement number, you can use this number to pay in the store/bbva | [optional] -**provider** | **str** | Provider name, you can use this to know where to pay | [optional] - -## Example - -```python -from conekta.models.payment_method_cash_response_all_of_agreements import PaymentMethodCashResponseAllOfAgreements - -# TODO update the JSON string below -json = "{}" -# create an instance of PaymentMethodCashResponseAllOfAgreements from a JSON string -payment_method_cash_response_all_of_agreements_instance = PaymentMethodCashResponseAllOfAgreements.from_json(json) -# print the JSON string representation of the object -print(PaymentMethodCashResponseAllOfAgreements.to_json()) - -# convert the object into a dict -payment_method_cash_response_all_of_agreements_dict = payment_method_cash_response_all_of_agreements_instance.to_dict() -# create an instance of PaymentMethodCashResponseAllOfAgreements from a dict -payment_method_cash_response_all_of_agreements_from_dict = PaymentMethodCashResponseAllOfAgreements.from_dict(payment_method_cash_response_all_of_agreements_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/PaymentMethodResponse.md b/docs/PaymentMethodResponse.md deleted file mode 100644 index b1c6a74..0000000 --- a/docs/PaymentMethodResponse.md +++ /dev/null @@ -1,33 +0,0 @@ -# PaymentMethodResponse - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**type** | **str** | | -**id** | **str** | | -**object** | **str** | | -**created_at** | **int** | | -**parent_id** | **str** | | [optional] - -## Example - -```python -from conekta.models.payment_method_response import PaymentMethodResponse - -# TODO update the JSON string below -json = "{}" -# create an instance of PaymentMethodResponse from a JSON string -payment_method_response_instance = PaymentMethodResponse.from_json(json) -# print the JSON string representation of the object -print(PaymentMethodResponse.to_json()) - -# convert the object into a dict -payment_method_response_dict = payment_method_response_instance.to_dict() -# create an instance of PaymentMethodResponse from a dict -payment_method_response_from_dict = PaymentMethodResponse.from_dict(payment_method_response_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/PaymentMethodSpeiRecurrent.md b/docs/PaymentMethodSpeiRecurrentResponse.md similarity index 51% rename from docs/PaymentMethodSpeiRecurrent.md rename to docs/PaymentMethodSpeiRecurrentResponse.md index 88301bf..05c6ed0 100644 --- a/docs/PaymentMethodSpeiRecurrent.md +++ b/docs/PaymentMethodSpeiRecurrentResponse.md @@ -1,4 +1,4 @@ -# PaymentMethodSpeiRecurrent +# PaymentMethodSpeiRecurrentResponse ## Properties @@ -17,19 +17,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.payment_method_spei_recurrent import PaymentMethodSpeiRecurrent +from conekta.models.payment_method_spei_recurrent_response import PaymentMethodSpeiRecurrentResponse # TODO update the JSON string below json = "{}" -# create an instance of PaymentMethodSpeiRecurrent from a JSON string -payment_method_spei_recurrent_instance = PaymentMethodSpeiRecurrent.from_json(json) +# create an instance of PaymentMethodSpeiRecurrentResponse from a JSON string +payment_method_spei_recurrent_response_instance = PaymentMethodSpeiRecurrentResponse.from_json(json) # print the JSON string representation of the object -print(PaymentMethodSpeiRecurrent.to_json()) +print(PaymentMethodSpeiRecurrentResponse.to_json()) # convert the object into a dict -payment_method_spei_recurrent_dict = payment_method_spei_recurrent_instance.to_dict() -# create an instance of PaymentMethodSpeiRecurrent from a dict -payment_method_spei_recurrent_from_dict = PaymentMethodSpeiRecurrent.from_dict(payment_method_spei_recurrent_dict) +payment_method_spei_recurrent_response_dict = payment_method_spei_recurrent_response_instance.to_dict() +# create an instance of PaymentMethodSpeiRecurrentResponse from a dict +payment_method_spei_recurrent_response_from_dict = PaymentMethodSpeiRecurrentResponse.from_dict(payment_method_spei_recurrent_response_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PaymentMethodsApi.md b/docs/PaymentMethodsApi.md index e6195ba..b35dbe6 100644 --- a/docs/PaymentMethodsApi.md +++ b/docs/PaymentMethodsApi.md @@ -50,7 +50,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.PaymentMethodsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource create_customer_payment_methods_request = {"type":"card","token_id":"tok_test_visa_4242"} # CreateCustomerPaymentMethodsRequest | requested field for customer payment methods - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -71,7 +71,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **create_customer_payment_methods_request** | [**CreateCustomerPaymentMethodsRequest**](CreateCustomerPaymentMethodsRequest.md)| requested field for customer payment methods | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -138,7 +138,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.PaymentMethodsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource payment_method_id = 'src_2tQ974hSHcsdeSZHG' # str | Identifier of the payment method - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -159,7 +159,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **payment_method_id** | **str**| Identifier of the payment method | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -225,7 +225,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PaymentMethodsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) next = 'next_example' # str | next page (optional) @@ -249,7 +249,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **next** | **str**| next page | [optional] @@ -281,7 +281,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_customer_payment_methods** -> UpdateCustomerPaymentMethodsResponse update_customer_payment_methods(id, payment_method_id, update_payment_methods, accept_language=accept_language, x_child_company_id=x_child_company_id) +> UpdateCustomerPaymentMethodsResponse update_customer_payment_methods(id, payment_method_id, update_payment_methods_card, accept_language=accept_language, x_child_company_id=x_child_company_id) Update Payment Method @@ -294,7 +294,7 @@ Gets a payment Method that corresponds to a customer ID. ```python import conekta from conekta.models.update_customer_payment_methods_response import UpdateCustomerPaymentMethodsResponse -from conekta.models.update_payment_methods import UpdatePaymentMethods +from conekta.models.update_payment_methods_card import UpdatePaymentMethodsCard from conekta.rest import ApiException from pprint import pprint @@ -320,13 +320,13 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.PaymentMethodsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource payment_method_id = 'src_2tQ974hSHcsdeSZHG' # str | Identifier of the payment method - update_payment_methods = conekta.UpdatePaymentMethods() # UpdatePaymentMethods | requested field for customer payment methods - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + update_payment_methods_card = conekta.UpdatePaymentMethodsCard() # UpdatePaymentMethodsCard | requested field for customer payment methods + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Update Payment Method - api_response = api_instance.update_customer_payment_methods(id, payment_method_id, update_payment_methods, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.update_customer_payment_methods(id, payment_method_id, update_payment_methods_card, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of PaymentMethodsApi->update_customer_payment_methods:\n") pprint(api_response) except Exception as e: @@ -342,8 +342,8 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **payment_method_id** | **str**| Identifier of the payment method | - **update_payment_methods** | [**UpdatePaymentMethods**](UpdatePaymentMethods.md)| requested field for customer payment methods | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **update_payment_methods_card** | [**UpdatePaymentMethodsCard**](UpdatePaymentMethodsCard.md)| requested field for customer payment methods | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/PayoutOrder.md b/docs/PayoutOrderRequest.md similarity index 58% rename from docs/PayoutOrder.md rename to docs/PayoutOrderRequest.md index 91ee2ca..e759c4a 100644 --- a/docs/PayoutOrder.md +++ b/docs/PayoutOrderRequest.md @@ -1,4 +1,4 @@ -# PayoutOrder +# PayoutOrderRequest a payout order @@ -9,7 +9,8 @@ Name | Type | Description | Notes **allowed_payout_methods** | **List[str]** | The payout methods that are allowed for the payout order. | **amount** | **int** | The amount of the payout order. | **currency** | **str** | The currency in which the payout order is made. | [default to 'MXN'] -**customer_info** | [**CustomerInfoJustCustomerId**](CustomerInfoJustCustomerId.md) | | +**customer_info** | [**PayoutOrderRequestCustomerInfo**](PayoutOrderRequestCustomerInfo.md) | | +**expires_at** | **int** | The expiration time of the payout order in Unix timestamp. | **metadata** | **Dict[str, object]** | The metadata of the payout order. | [optional] **payout** | [**Payout**](Payout.md) | | **reason** | **str** | The reason for the payout order. | @@ -17,19 +18,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.payout_order import PayoutOrder +from conekta.models.payout_order_request import PayoutOrderRequest # TODO update the JSON string below json = "{}" -# create an instance of PayoutOrder from a JSON string -payout_order_instance = PayoutOrder.from_json(json) +# create an instance of PayoutOrderRequest from a JSON string +payout_order_request_instance = PayoutOrderRequest.from_json(json) # print the JSON string representation of the object -print(PayoutOrder.to_json()) +print(PayoutOrderRequest.to_json()) # convert the object into a dict -payout_order_dict = payout_order_instance.to_dict() -# create an instance of PayoutOrder from a dict -payout_order_from_dict = PayoutOrder.from_dict(payout_order_dict) +payout_order_request_dict = payout_order_request_instance.to_dict() +# create an instance of PayoutOrderRequest from a dict +payout_order_request_from_dict = PayoutOrderRequest.from_dict(payout_order_request_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PayoutOrderRequestCustomerInfo.md b/docs/PayoutOrderRequestCustomerInfo.md new file mode 100644 index 0000000..c575766 --- /dev/null +++ b/docs/PayoutOrderRequestCustomerInfo.md @@ -0,0 +1,30 @@ +# PayoutOrderRequestCustomerInfo + +The customer information to whom the payout order is made. + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**customer_id** | **str** | | + +## Example + +```python +from conekta.models.payout_order_request_customer_info import PayoutOrderRequestCustomerInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of PayoutOrderRequestCustomerInfo from a JSON string +payout_order_request_customer_info_instance = PayoutOrderRequestCustomerInfo.from_json(json) +# print the JSON string representation of the object +print(PayoutOrderRequestCustomerInfo.to_json()) + +# convert the object into a dict +payout_order_request_customer_info_dict = payout_order_request_customer_info_instance.to_dict() +# create an instance of PayoutOrderRequestCustomerInfo from a dict +payout_order_request_customer_info_from_dict = PayoutOrderRequestCustomerInfo.from_dict(payout_order_request_customer_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/PayoutOrderResponse.md b/docs/PayoutOrderResponse.md index 6e45559..8ec4a67 100644 --- a/docs/PayoutOrderResponse.md +++ b/docs/PayoutOrderResponse.md @@ -11,14 +11,14 @@ Name | Type | Description | Notes **created_at** | **int** | The creation date of the payout order. | **currency** | **str** | The currency in which the payout order is made. | [default to 'MXN'] **customer_info** | [**PayoutOrderResponseCustomerInfo**](PayoutOrderResponseCustomerInfo.md) | | -**expires_at** | **int** | The expiration date of the payout order. | [optional] +**expires_at** | **int** | The expiration date of the payout order. | **id** | **str** | The id of the payout order. | **livemode** | **bool** | The live mode of the payout order. | **object** | **str** | The object of the payout order. | **metadata** | **Dict[str, object]** | The metadata of the payout order. | [optional] **payouts** | [**List[PayoutOrderPayoutsItem]**](PayoutOrderPayoutsItem.md) | The payout information of the payout order. | **reason** | **str** | The reason for the payout order. | -**status** | **str** | The status of the payout order. | [optional] +**status** | **str** | The status of the payout order. | **updated_at** | **int** | The update date of the payout order. | ## Example diff --git a/docs/PayoutOrderResponseCustomerInfo.md b/docs/PayoutOrderResponseCustomerInfo.md index adb903f..8d9d470 100644 --- a/docs/PayoutOrderResponseCustomerInfo.md +++ b/docs/PayoutOrderResponseCustomerInfo.md @@ -6,13 +6,13 @@ The customer information of the payout order. Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**id** | **str** | The id of the customer. | **customer_custom_reference** | **str** | Custom reference | [optional] **name** | **str** | | [optional] **email** | **str** | | [optional] **phone** | **str** | | [optional] **corporate** | **bool** | | [optional] [default to False] **object** | **str** | | [optional] -**id** | **str** | The id of the customer. | ## Example diff --git a/docs/PayoutOrdersApi.md b/docs/PayoutOrdersApi.md index 4cc9ba1..bcbde89 100644 --- a/docs/PayoutOrdersApi.md +++ b/docs/PayoutOrdersApi.md @@ -48,7 +48,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PayoutOrdersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Cancel Payout Order @@ -67,7 +67,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -94,7 +94,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **create_payout_order** -> PayoutOrderResponse create_payout_order(payout_order, accept_language=accept_language) +> PayoutOrderResponse create_payout_order(payout_order_request, accept_language=accept_language) Create payout order @@ -106,7 +106,7 @@ Create a new payout order. ```python import conekta -from conekta.models.payout_order import PayoutOrder +from conekta.models.payout_order_request import PayoutOrderRequest from conekta.models.payout_order_response import PayoutOrderResponse from conekta.rest import ApiException from pprint import pprint @@ -131,12 +131,12 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PayoutOrdersApi(api_client) - payout_order = conekta.PayoutOrder() # PayoutOrder | requested field for payout order - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + payout_order_request = conekta.PayoutOrderRequest() # PayoutOrderRequest | requested field for payout order + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Create payout order - api_response = api_instance.create_payout_order(payout_order, accept_language=accept_language) + api_response = api_instance.create_payout_order(payout_order_request, accept_language=accept_language) print("The response of PayoutOrdersApi->create_payout_order:\n") pprint(api_response) except Exception as e: @@ -150,8 +150,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **payout_order** | [**PayoutOrder**](PayoutOrder.md)| requested field for payout order | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **payout_order_request** | [**PayoutOrderRequest**](PayoutOrderRequest.md)| requested field for payout order | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -217,7 +217,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PayoutOrdersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Get Payout Order @@ -236,7 +236,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -299,7 +299,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PayoutOrdersApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) next = 'next_example' # str | next page (optional) @@ -321,7 +321,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] **next** | **str**| next page | [optional] diff --git a/docs/PayoutOrdersResponse.md b/docs/PayoutOrdersResponse.md index 79d902d..982da67 100644 --- a/docs/PayoutOrdersResponse.md +++ b/docs/PayoutOrdersResponse.md @@ -5,11 +5,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- +**data** | [**List[PayoutOrderResponse]**](PayoutOrderResponse.md) | | [optional] **has_more** | **bool** | Indicates if there are more pages to be requested | **object** | **str** | Object type, in this case is list | **next_page_url** | **str** | URL of the next page. | [optional] **previous_page_url** | **str** | Url of the previous page. | [optional] -**data** | [**List[PayoutOrderResponse]**](PayoutOrderResponse.md) | | [optional] ## Example diff --git a/docs/PlansApi.md b/docs/PlansApi.md index 6d632b1..6e1bae0 100644 --- a/docs/PlansApi.md +++ b/docs/PlansApi.md @@ -50,7 +50,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PlansApi(api_client) plan_request = conekta.PlanRequest() # PlanRequest | requested field for plan - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -70,7 +70,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **plan_request** | [**PlanRequest**](PlanRequest.md)| requested field for plan | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -133,7 +133,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PlansApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Delete Plan @@ -152,7 +152,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -215,7 +215,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PlansApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -235,7 +235,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -264,7 +264,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **get_plans** -> GetPlansResponse get_plans(accept_language=accept_language, x_child_company_id=x_child_company_id, limit=limit, search=search, next=next, previous=previous) +> GetPlansResponse get_plans(accept_language=accept_language, x_child_company_id=x_child_company_id, limit=limit, search=search, next=next, previous=previous, currency=currency, frequency=frequency) Get A List of Plans @@ -298,16 +298,18 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PlansApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) next = 'next_example' # str | next page (optional) previous = 'previous_example' # str | previous page (optional) + currency = 'MXN' # str | currency of the object to be retrieved (optional) + frequency = 1 # int | frequency of the object to be retrieved (optional) try: # Get A List of Plans - api_response = api_instance.get_plans(accept_language=accept_language, x_child_company_id=x_child_company_id, limit=limit, search=search, next=next, previous=previous) + api_response = api_instance.get_plans(accept_language=accept_language, x_child_company_id=x_child_company_id, limit=limit, search=search, next=next, previous=previous, currency=currency, frequency=frequency) print("The response of PlansApi->get_plans:\n") pprint(api_response) except Exception as e: @@ -321,12 +323,14 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] **next** | **str**| next page | [optional] **previous** | **str**| previous page | [optional] + **currency** | **str**| currency of the object to be retrieved | [optional] + **frequency** | **int**| frequency of the object to be retrieved | [optional] ### Return type @@ -353,7 +357,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_plan** -> PlanResponse update_plan(id, plan_update_request, accept_language=accept_language, x_child_company_id=x_child_company_id) +> PlanResponse update_plan(id, update_plan, accept_language=accept_language, x_child_company_id=x_child_company_id) Update Plan @@ -364,7 +368,7 @@ Update Plan ```python import conekta from conekta.models.plan_response import PlanResponse -from conekta.models.plan_update_request import PlanUpdateRequest +from conekta.models.update_plan import UpdatePlan from conekta.rest import ApiException from pprint import pprint @@ -389,13 +393,13 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.PlansApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - plan_update_request = conekta.PlanUpdateRequest() # PlanUpdateRequest | requested field for plan - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + update_plan = conekta.UpdatePlan() # UpdatePlan | requested field for plan + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Update Plan - api_response = api_instance.update_plan(id, plan_update_request, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.update_plan(id, update_plan, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of PlansApi->update_plan:\n") pprint(api_response) except Exception as e: @@ -410,8 +414,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **plan_update_request** | [**PlanUpdateRequest**](PlanUpdateRequest.md)| requested field for plan | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **update_plan** | [**UpdatePlan**](UpdatePlan.md)| requested field for plan | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/ProductsApi.md b/docs/ProductsApi.md index d85de80..a2668d3 100644 --- a/docs/ProductsApi.md +++ b/docs/ProductsApi.md @@ -49,7 +49,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.ProductsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource product = conekta.Product() # Product | requested field for a product - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -70,7 +70,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **product** | [**Product**](Product.md)| requested field for a product | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -136,7 +136,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.ProductsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource line_item_id = 'line_item_2tQ8HkkfbauaKP9Ho' # str | identifier - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -157,7 +157,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **line_item_id** | **str**| identifier | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -226,7 +226,7 @@ with conekta.ApiClient(configuration) as api_client: id = '6307a60c41de27127515a575' # str | Identifier of the resource line_item_id = 'line_item_2tQ8HkkfbauaKP9Ho' # str | identifier update_product = conekta.UpdateProduct() # UpdateProduct | requested field for products - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -248,7 +248,7 @@ Name | Type | Description | Notes **id** | **str**| Identifier of the resource | **line_item_id** | **str**| identifier | **update_product** | [**UpdateProduct**](UpdateProduct.md)| requested field for products | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/ResendRequest.md b/docs/ResendEventRequest.md similarity index 52% rename from docs/ResendRequest.md rename to docs/ResendEventRequest.md index 2c4569c..2bb7463 100644 --- a/docs/ResendRequest.md +++ b/docs/ResendEventRequest.md @@ -1,4 +1,4 @@ -# ResendRequest +# ResendEventRequest ## Properties @@ -10,19 +10,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.resend_request import ResendRequest +from conekta.models.resend_event_request import ResendEventRequest # TODO update the JSON string below json = "{}" -# create an instance of ResendRequest from a JSON string -resend_request_instance = ResendRequest.from_json(json) +# create an instance of ResendEventRequest from a JSON string +resend_event_request_instance = ResendEventRequest.from_json(json) # print the JSON string representation of the object -print(ResendRequest.to_json()) +print(ResendEventRequest.to_json()) # convert the object into a dict -resend_request_dict = resend_request_instance.to_dict() -# create an instance of ResendRequest from a dict -resend_request_from_dict = ResendRequest.from_dict(resend_request_dict) +resend_event_request_dict = resend_event_request_instance.to_dict() +# create an instance of ResendEventRequest from a dict +resend_event_request_from_dict = ResendEventRequest.from_dict(resend_event_request_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/ShippingContactsApi.md b/docs/ShippingContactsApi.md index c0f370e..eff8094 100644 --- a/docs/ShippingContactsApi.md +++ b/docs/ShippingContactsApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description # **create_customer_shipping_contacts** -> CustomerShippingContactsResponse create_customer_shipping_contacts(id, customer_shipping_contacts, accept_language=accept_language, x_child_company_id=x_child_company_id) +> CustomerShippingContactsResponse create_customer_shipping_contacts(id, customer_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id) Create a shipping contacts @@ -22,7 +22,7 @@ Create a shipping contacts for a customer. ```python import conekta -from conekta.models.customer_shipping_contacts import CustomerShippingContacts +from conekta.models.customer_shipping_contacts_request import CustomerShippingContactsRequest from conekta.models.customer_shipping_contacts_response import CustomerShippingContactsResponse from conekta.rest import ApiException from pprint import pprint @@ -48,13 +48,13 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.ShippingContactsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - customer_shipping_contacts = conekta.CustomerShippingContacts() # CustomerShippingContacts | requested field for customer shippings contacts - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + customer_shipping_contacts_request = conekta.CustomerShippingContactsRequest() # CustomerShippingContactsRequest | requested field for customer shippings contacts + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Create a shipping contacts - api_response = api_instance.create_customer_shipping_contacts(id, customer_shipping_contacts, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.create_customer_shipping_contacts(id, customer_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of ShippingContactsApi->create_customer_shipping_contacts:\n") pprint(api_response) except Exception as e: @@ -69,8 +69,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **customer_shipping_contacts** | [**CustomerShippingContacts**](CustomerShippingContacts.md)| requested field for customer shippings contacts | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **customer_shipping_contacts_request** | [**CustomerShippingContactsRequest**](CustomerShippingContactsRequest.md)| requested field for customer shippings contacts | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -137,7 +137,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.ShippingContactsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource shipping_contacts_id = '6307a60c41de27127515a575' # str | identifier - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -158,7 +158,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **shipping_contacts_id** | **str**| identifier | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -187,7 +187,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_customer_shipping_contacts** -> CustomerShippingContactsResponse update_customer_shipping_contacts(id, shipping_contacts_id, customer_update_shipping_contacts, accept_language=accept_language, x_child_company_id=x_child_company_id) +> CustomerShippingContactsResponse update_customer_shipping_contacts(id, shipping_contacts_id, customer_update_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id) Update shipping contacts @@ -200,7 +200,7 @@ Update shipping contact that corresponds to a customer ID. ```python import conekta from conekta.models.customer_shipping_contacts_response import CustomerShippingContactsResponse -from conekta.models.customer_update_shipping_contacts import CustomerUpdateShippingContacts +from conekta.models.customer_update_shipping_contacts_request import CustomerUpdateShippingContactsRequest from conekta.rest import ApiException from pprint import pprint @@ -226,13 +226,13 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.ShippingContactsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource shipping_contacts_id = '6307a60c41de27127515a575' # str | identifier - customer_update_shipping_contacts = conekta.CustomerUpdateShippingContacts() # CustomerUpdateShippingContacts | requested field for customer update shippings contacts - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + customer_update_shipping_contacts_request = conekta.CustomerUpdateShippingContactsRequest() # CustomerUpdateShippingContactsRequest | requested field for customer update shippings contacts + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Update shipping contacts - api_response = api_instance.update_customer_shipping_contacts(id, shipping_contacts_id, customer_update_shipping_contacts, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.update_customer_shipping_contacts(id, shipping_contacts_id, customer_update_shipping_contacts_request, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of ShippingContactsApi->update_customer_shipping_contacts:\n") pprint(api_response) except Exception as e: @@ -248,8 +248,8 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **shipping_contacts_id** | **str**| identifier | - **customer_update_shipping_contacts** | [**CustomerUpdateShippingContacts**](CustomerUpdateShippingContacts.md)| requested field for customer update shippings contacts | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **customer_update_shipping_contacts_request** | [**CustomerUpdateShippingContactsRequest**](CustomerUpdateShippingContactsRequest.md)| requested field for customer update shippings contacts | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/ShippingLinesDataResponse.md b/docs/ShippingLinesDataResponse.md new file mode 100644 index 0000000..71214fa --- /dev/null +++ b/docs/ShippingLinesDataResponse.md @@ -0,0 +1,36 @@ +# ShippingLinesDataResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | Shipping amount in cents | +**carrier** | **str** | Carrier name for the shipment | [optional] +**tracking_number** | **str** | Tracking number can be used to track the shipment | [optional] +**method** | **str** | Method of shipment | [optional] +**metadata** | **Dict[str, object]** | Hash where the user can send additional information for each 'shipping'. | [optional] +**id** | **str** | | [optional] +**object** | **str** | | [optional] +**parent_id** | **str** | | [optional] + +## Example + +```python +from conekta.models.shipping_lines_data_response import ShippingLinesDataResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of ShippingLinesDataResponse from a JSON string +shipping_lines_data_response_instance = ShippingLinesDataResponse.from_json(json) +# print the JSON string representation of the object +print(ShippingLinesDataResponse.to_json()) + +# convert the object into a dict +shipping_lines_data_response_dict = shipping_lines_data_response_instance.to_dict() +# create an instance of ShippingLinesDataResponse from a dict +shipping_lines_data_response_from_dict = ShippingLinesDataResponse.from_dict(shipping_lines_data_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ShippingsApi.md b/docs/ShippingsApi.md index 5f8c7ae..5a8c4f7 100644 --- a/docs/ShippingsApi.md +++ b/docs/ShippingsApi.md @@ -49,7 +49,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.ShippingsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource shipping_request = conekta.ShippingRequest() # ShippingRequest | requested field for a shipping - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -70,7 +70,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **shipping_request** | [**ShippingRequest**](ShippingRequest.md)| requested field for a shipping | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -136,7 +136,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.ShippingsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource shipping_id = 'ship_lin_2tQ974hSHcsdeSZHG' # str | identifier - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -157,7 +157,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **shipping_id** | **str**| identifier | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -227,7 +227,7 @@ with conekta.ApiClient(configuration) as api_client: id = '6307a60c41de27127515a575' # str | Identifier of the resource shipping_id = 'ship_lin_2tQ974hSHcsdeSZHG' # str | identifier shipping_request = conekta.ShippingRequest() # ShippingRequest | requested field for a shipping - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -249,7 +249,7 @@ Name | Type | Description | Notes **id** | **str**| Identifier of the resource | **shipping_id** | **str**| identifier | **shipping_request** | [**ShippingRequest**](ShippingRequest.md)| requested field for a shipping | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/SubscriptionDetails.md b/docs/SubscriptionDetails.md new file mode 100644 index 0000000..a95bdba --- /dev/null +++ b/docs/SubscriptionDetails.md @@ -0,0 +1,39 @@ +# SubscriptionDetails + +Subscription details for customer portal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**card** | [**SubscriptionDetailsCard**](SubscriptionDetailsCard.md) | | [optional] +**plan** | [**SubscriptionDetailsPlan**](SubscriptionDetailsPlan.md) | | [optional] +**id** | **str** | | [optional] +**object** | **str** | | [optional] +**status** | **str** | | [optional] +**plan_id** | **str** | | [optional] +**customer_id** | **str** | | [optional] +**next_billing_cycle** | **int** | | [optional] +**created_at** | **int** | | [optional] +**updated_at** | **int** | | [optional] + +## Example + +```python +from conekta.models.subscription_details import SubscriptionDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of SubscriptionDetails from a JSON string +subscription_details_instance = SubscriptionDetails.from_json(json) +# print the JSON string representation of the object +print(SubscriptionDetails.to_json()) + +# convert the object into a dict +subscription_details_dict = subscription_details_instance.to_dict() +# create an instance of SubscriptionDetails from a dict +subscription_details_from_dict = SubscriptionDetails.from_dict(subscription_details_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SubscriptionDetailsCard.md b/docs/SubscriptionDetailsCard.md new file mode 100644 index 0000000..44647dd --- /dev/null +++ b/docs/SubscriptionDetailsCard.md @@ -0,0 +1,40 @@ +# SubscriptionDetailsCard + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**created_at** | **int** | | [optional] +**active** | **bool** | | [optional] +**object** | **str** | | [optional] +**exp_month** | **str** | | [optional] +**exp_year** | **str** | | [optional] +**brand** | **str** | | [optional] +**last4** | **str** | | [optional] +**name** | **str** | | [optional] +**payment_source_status** | **str** | | [optional] +**customer_id** | **str** | | [optional] +**customer_custom_reference** | **str** | | [optional] + +## Example + +```python +from conekta.models.subscription_details_card import SubscriptionDetailsCard + +# TODO update the JSON string below +json = "{}" +# create an instance of SubscriptionDetailsCard from a JSON string +subscription_details_card_instance = SubscriptionDetailsCard.from_json(json) +# print the JSON string representation of the object +print(SubscriptionDetailsCard.to_json()) + +# convert the object into a dict +subscription_details_card_dict = subscription_details_card_instance.to_dict() +# create an instance of SubscriptionDetailsCard from a dict +subscription_details_card_from_dict = SubscriptionDetailsCard.from_dict(subscription_details_card_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SubscriptionDetailsPlan.md b/docs/SubscriptionDetailsPlan.md new file mode 100644 index 0000000..e709114 --- /dev/null +++ b/docs/SubscriptionDetailsPlan.md @@ -0,0 +1,38 @@ +# SubscriptionDetailsPlan + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | [optional] +**object** | **str** | | [optional] +**name** | **str** | | [optional] +**amount** | **int** | | [optional] +**currency** | **str** | | [optional] +**interval** | **str** | | [optional] +**frequency** | **int** | | [optional] +**trial_period_days** | **int** | | [optional] +**expiry_count** | **int** | | [optional] +**created_at** | **int** | | [optional] + +## Example + +```python +from conekta.models.subscription_details_plan import SubscriptionDetailsPlan + +# TODO update the JSON string below +json = "{}" +# create an instance of SubscriptionDetailsPlan from a JSON string +subscription_details_plan_instance = SubscriptionDetailsPlan.from_json(json) +# print the JSON string representation of the object +print(SubscriptionDetailsPlan.to_json()) + +# convert the object into a dict +subscription_details_plan_dict = subscription_details_plan_instance.to_dict() +# create an instance of SubscriptionDetailsPlan from a dict +subscription_details_plan_from_dict = SubscriptionDetailsPlan.from_dict(subscription_details_plan_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SubscriptionsApi.md b/docs/SubscriptionsApi.md index 6e3af92..07fe341 100644 --- a/docs/SubscriptionsApi.md +++ b/docs/SubscriptionsApi.md @@ -60,7 +60,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.SubscriptionsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -80,7 +80,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -147,7 +147,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.SubscriptionsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource subscription_request = conekta.SubscriptionRequest() # SubscriptionRequest | requested field for subscriptions - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -168,7 +168,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **subscription_request** | [**SubscriptionRequest**](SubscriptionRequest.md)| requested field for subscriptions | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -234,7 +234,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.SubscriptionsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Get Subscription [Deprecated] @@ -253,7 +253,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -317,7 +317,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.SubscriptionsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -337,7 +337,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -404,7 +404,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.SubscriptionsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -424,7 +424,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -490,7 +490,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.SubscriptionsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -510,7 +510,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -578,7 +578,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.SubscriptionsApi(api_client) customer_id = 'cus_2tGzG1GxtDAZHEGPH' # str | Identifier of the customer resource id = 'sub_2tGzG1GxtDAZHEGPH' # str | Identifier of the subscription resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -599,7 +599,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer_id** | **str**| Identifier of the customer resource | **id** | **str**| Identifier of the subscription resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -666,7 +666,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.SubscriptionsApi(api_client) customer_id = 'cus_2tGzG1GxtDAZHEGPH' # str | Identifier of the customer resource subscription_request = conekta.SubscriptionRequest() # SubscriptionRequest | requested field for subscriptions - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -687,7 +687,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer_id** | **str**| Identifier of the customer resource | **subscription_request** | [**SubscriptionRequest**](SubscriptionRequest.md)| requested field for subscriptions | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -754,7 +754,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.SubscriptionsApi(api_client) customer_id = 'cus_2tGzG1GxtDAZHEGPH' # str | Identifier of the customer resource id = 'sub_2tGzG1GxtDAZHEGPH' # str | Identifier of the subscription resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -779,7 +779,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer_id** | **str**| Identifier of the customer resource | **id** | **str**| Identifier of the subscription resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -848,7 +848,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.SubscriptionsApi(api_client) customer_id = 'cus_2tGzG1GxtDAZHEGPH' # str | Identifier of the customer resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -872,7 +872,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer_id** | **str**| Identifier of the customer resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -942,7 +942,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.SubscriptionsApi(api_client) customer_id = 'cus_2tGzG1GxtDAZHEGPH' # str | Identifier of the customer resource id = 'sub_2tGzG1GxtDAZHEGPH' # str | Identifier of the subscription resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -963,7 +963,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer_id** | **str**| Identifier of the customer resource | **id** | **str**| Identifier of the subscription resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -1029,7 +1029,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.SubscriptionsApi(api_client) customer_id = 'cus_2tGzG1GxtDAZHEGPH' # str | Identifier of the customer resource id = 'sub_2tGzG1GxtDAZHEGPH' # str | Identifier of the subscription resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -1050,7 +1050,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer_id** | **str**| Identifier of the customer resource | **id** | **str**| Identifier of the subscription resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -1078,7 +1078,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **subscription_update** -> SubscriptionResponse subscription_update(customer_id, id, subscription_update_request, accept_language=accept_language, x_child_company_id=x_child_company_id) +> SubscriptionResponse subscription_update(customer_id, id, updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id) Update Subscription @@ -1091,7 +1091,7 @@ Update a specific subscription ```python import conekta from conekta.models.subscription_response import SubscriptionResponse -from conekta.models.subscription_update_request import SubscriptionUpdateRequest +from conekta.models.updates_a_subscription import UpdatesASubscription from conekta.rest import ApiException from pprint import pprint @@ -1117,13 +1117,13 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.SubscriptionsApi(api_client) customer_id = 'cus_2tGzG1GxtDAZHEGPH' # str | Identifier of the customer resource id = 'sub_2tGzG1GxtDAZHEGPH' # str | Identifier of the subscription resource - subscription_update_request = conekta.SubscriptionUpdateRequest() # SubscriptionUpdateRequest | requested field for update a subscription - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + updates_a_subscription = conekta.UpdatesASubscription() # UpdatesASubscription | requested field for update a subscription + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Update Subscription - api_response = api_instance.subscription_update(customer_id, id, subscription_update_request, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.subscription_update(customer_id, id, updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of SubscriptionsApi->subscription_update:\n") pprint(api_response) except Exception as e: @@ -1139,8 +1139,8 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer_id** | **str**| Identifier of the customer resource | **id** | **str**| Identifier of the subscription resource | - **subscription_update_request** | [**SubscriptionUpdateRequest**](SubscriptionUpdateRequest.md)| requested field for update a subscription | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **updates_a_subscription** | [**UpdatesASubscription**](UpdatesASubscription.md)| requested field for update a subscription | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -1207,7 +1207,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.SubscriptionsApi(api_client) customer_id = 'cus_2tGzG1GxtDAZHEGPH' # str | Identifier of the customer resource id = 'sub_2tGzG1GxtDAZHEGPH' # str | Identifier of the subscription resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -1228,7 +1228,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer_id** | **str**| Identifier of the customer resource | **id** | **str**| Identifier of the subscription resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -1294,7 +1294,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.SubscriptionsApi(api_client) customer_id = 'cus_2tGzG1GxtDAZHEGPH' # str | Identifier of the customer resource id = 'sub_2tGzG1GxtDAZHEGPH' # str | Identifier of the subscription resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -1315,7 +1315,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **customer_id** | **str**| Identifier of the customer resource | **id** | **str**| Identifier of the subscription resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -1336,15 +1336,15 @@ Name | Type | Description | Notes | Status code | Description | Response headers | |-------------|-------------|------------------| **200** | successful | * Date - The date and time that the response was sent
* Content-Type - The format of the response body
* Content-Length - The length of the response body in bytes
* Connection - The type of connection used to transfer the response
* Conekta-Media-Type -
| +**422** | parameter validation error | - | **401** | authentication error | - | **404** | not found entity | - | -**422** | parameter validation error | - | **500** | internal server error | - | [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_subscription** -> SubscriptionResponse update_subscription(id, subscription_update_request, accept_language=accept_language, x_child_company_id=x_child_company_id) +> SubscriptionResponse update_subscription(id, updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id) Update Subscription [Deprecated] @@ -1357,7 +1357,7 @@ DEPRECATED: This endpoint will be removed in version 2.3.0. You can modify the s ```python import conekta from conekta.models.subscription_response import SubscriptionResponse -from conekta.models.subscription_update_request import SubscriptionUpdateRequest +from conekta.models.updates_a_subscription import UpdatesASubscription from conekta.rest import ApiException from pprint import pprint @@ -1382,13 +1382,13 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.SubscriptionsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - subscription_update_request = conekta.SubscriptionUpdateRequest() # SubscriptionUpdateRequest | requested field for update a subscription - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + updates_a_subscription = conekta.UpdatesASubscription() # UpdatesASubscription | requested field for update a subscription + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Update Subscription [Deprecated] - api_response = api_instance.update_subscription(id, subscription_update_request, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.update_subscription(id, updates_a_subscription, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of SubscriptionsApi->update_subscription:\n") pprint(api_response) except Exception as e: @@ -1403,8 +1403,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **subscription_update_request** | [**SubscriptionUpdateRequest**](SubscriptionUpdateRequest.md)| requested field for update a subscription | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **updates_a_subscription** | [**UpdatesASubscription**](UpdatesASubscription.md)| requested field for update a subscription | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/docs/SubscriptionsCustomerPortalApi.md b/docs/SubscriptionsCustomerPortalApi.md new file mode 100644 index 0000000..bee59fb --- /dev/null +++ b/docs/SubscriptionsCustomerPortalApi.md @@ -0,0 +1,179 @@ +# conekta.SubscriptionsCustomerPortalApi + +All URIs are relative to *https://api.conekta.io* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**create_customer_portal**](SubscriptionsCustomerPortalApi.md#create_customer_portal) | **POST** /subscriptions/{subscription_id}/customer_portal | Create customer portal +[**get_customer_portal**](SubscriptionsCustomerPortalApi.md#get_customer_portal) | **GET** /subscriptions/{subscription_id}/customer_portal | Get customer portal + + +# **create_customer_portal** +> CustomerPortalResponse create_customer_portal(subscription_id, accept_language=accept_language, x_child_company_id=x_child_company_id) + +Create customer portal + +Creates a customer portal for a subscription. If a portal already exists, returns the existing one. + +### Example + +* Bearer Authentication (bearerAuth): + +```python +import conekta +from conekta.models.customer_portal_response import CustomerPortalResponse +from conekta.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.conekta.io +# See configuration.py for a list of all supported configuration parameters. +configuration = conekta.Configuration( + host = "https://api.conekta.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: bearerAuth +configuration = conekta.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with conekta.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = conekta.SubscriptionsCustomerPortalApi(api_client) + subscription_id = 'sub_2tGzG1GxtDAZHEGPH' # str | Identifier of the subscription resource + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') + x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) + + try: + # Create customer portal + api_response = api_instance.create_customer_portal(subscription_id, accept_language=accept_language, x_child_company_id=x_child_company_id) + print("The response of SubscriptionsCustomerPortalApi->create_customer_portal:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling SubscriptionsCustomerPortalApi->create_customer_portal: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **subscription_id** | **str**| Identifier of the subscription resource | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] + **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] + +### Return type + +[**CustomerPortalResponse**](CustomerPortalResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/vnd.conekta-v2.2.0+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**201** | Customer portal created successfully | * Date - The date and time that the response was sent
* Content-Type - The format of the response body
* Content-Length - The length of the response body in bytes
* Connection - The type of connection used to transfer the response
* Conekta-Media-Type -
| +**404** | not found entity | - | +**401** | authentication error | - | +**422** | parameter validation error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_customer_portal** +> CustomerPortalResponse get_customer_portal(subscription_id, accept_language=accept_language, x_child_company_id=x_child_company_id) + +Get customer portal + +Retrieves the customer portal for a subscription + +### Example + +* Bearer Authentication (bearerAuth): + +```python +import conekta +from conekta.models.customer_portal_response import CustomerPortalResponse +from conekta.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://api.conekta.io +# See configuration.py for a list of all supported configuration parameters. +configuration = conekta.Configuration( + host = "https://api.conekta.io" +) + +# The client must configure the authentication and authorization parameters +# in accordance with the API server security policy. +# Examples for each auth method are provided below, use the example that +# satisfies your auth use case. + +# Configure Bearer authorization: bearerAuth +configuration = conekta.Configuration( + access_token = os.environ["BEARER_TOKEN"] +) + +# Enter a context with an instance of the API client +with conekta.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = conekta.SubscriptionsCustomerPortalApi(api_client) + subscription_id = 'sub_2tGzG1GxtDAZHEGPH' # str | Identifier of the subscription resource + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') + x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) + + try: + # Get customer portal + api_response = api_instance.get_customer_portal(subscription_id, accept_language=accept_language, x_child_company_id=x_child_company_id) + print("The response of SubscriptionsCustomerPortalApi->get_customer_portal:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling SubscriptionsCustomerPortalApi->get_customer_portal: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **subscription_id** | **str**| Identifier of the subscription resource | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] + **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] + +### Return type + +[**CustomerPortalResponse**](CustomerPortalResponse.md) + +### Authorization + +[bearerAuth](../README.md#bearerAuth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/vnd.conekta-v2.2.0+json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | Customer portal retrieved successfully | * Date - The date and time that the response was sent
* Content-Type - The format of the response body
* Content-Length - The length of the response body in bytes
* Connection - The type of connection used to transfer the response
* Conekta-Media-Type -
| +**404** | not found entity | - | +**401** | authentication error | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/TaxLinesDataResponse.md b/docs/TaxLinesDataResponse.md new file mode 100644 index 0000000..3015add --- /dev/null +++ b/docs/TaxLinesDataResponse.md @@ -0,0 +1,34 @@ +# TaxLinesDataResponse + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**amount** | **int** | The amount to be collected for tax in cents | +**description** | **str** | description or tax's name | +**metadata** | **Dict[str, object]** | | [optional] +**id** | **str** | | +**object** | **str** | | [optional] +**parent_id** | **str** | | [optional] + +## Example + +```python +from conekta.models.tax_lines_data_response import TaxLinesDataResponse + +# TODO update the JSON string below +json = "{}" +# create an instance of TaxLinesDataResponse from a JSON string +tax_lines_data_response_instance = TaxLinesDataResponse.from_json(json) +# print the JSON string representation of the object +print(TaxLinesDataResponse.to_json()) + +# convert the object into a dict +tax_lines_data_response_dict = tax_lines_data_response_instance.to_dict() +# create an instance of TaxLinesDataResponse from a dict +tax_lines_data_response_from_dict = TaxLinesDataResponse.from_dict(tax_lines_data_response_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TaxesApi.md b/docs/TaxesApi.md index 0f802e5..4277e43 100644 --- a/docs/TaxesApi.md +++ b/docs/TaxesApi.md @@ -10,7 +10,7 @@ Method | HTTP request | Description # **orders_create_taxes** -> UpdateOrderTaxResponse orders_create_taxes(id, order_tax_request, accept_language=accept_language, x_child_company_id=x_child_company_id) +> OrderTaxResponse orders_create_taxes(id, order_tax_request, accept_language=accept_language, x_child_company_id=x_child_company_id) Create Tax @@ -23,7 +23,7 @@ Create new taxes for an existing orden ```python import conekta from conekta.models.order_tax_request import OrderTaxRequest -from conekta.models.update_order_tax_response import UpdateOrderTaxResponse +from conekta.models.order_tax_response import OrderTaxResponse from conekta.rest import ApiException from pprint import pprint @@ -49,7 +49,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.TaxesApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource order_tax_request = conekta.OrderTaxRequest() # OrderTaxRequest | requested field for a taxes - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -70,12 +70,12 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **order_tax_request** | [**OrderTaxRequest**](OrderTaxRequest.md)| requested field for a taxes | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type -[**UpdateOrderTaxResponse**](UpdateOrderTaxResponse.md) +[**OrderTaxResponse**](OrderTaxResponse.md) ### Authorization @@ -98,7 +98,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **orders_delete_taxes** -> UpdateOrderTaxResponse orders_delete_taxes(id, tax_id, accept_language=accept_language, x_child_company_id=x_child_company_id) +> OrderTaxResponse orders_delete_taxes(id, tax_id, accept_language=accept_language, x_child_company_id=x_child_company_id) Delete Tax @@ -110,7 +110,7 @@ Delete taxes for an existing orden ```python import conekta -from conekta.models.update_order_tax_response import UpdateOrderTaxResponse +from conekta.models.order_tax_response import OrderTaxResponse from conekta.rest import ApiException from pprint import pprint @@ -136,7 +136,7 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.TaxesApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource tax_id = 'tax_lin_2tQ974hSHcsdeSZHG' # str | identifier - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -157,12 +157,12 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **tax_id** | **str**| identifier | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type -[**UpdateOrderTaxResponse**](UpdateOrderTaxResponse.md) +[**OrderTaxResponse**](OrderTaxResponse.md) ### Authorization @@ -186,7 +186,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **orders_update_taxes** -> UpdateOrderTaxResponse orders_update_taxes(id, tax_id, update_order_tax_request, accept_language=accept_language, x_child_company_id=x_child_company_id) +> OrderTaxResponse orders_update_taxes(id, tax_id, orders_update_taxes_request, accept_language=accept_language, x_child_company_id=x_child_company_id) Update Tax @@ -198,8 +198,8 @@ Update taxes for an existing orden ```python import conekta -from conekta.models.update_order_tax_request import UpdateOrderTaxRequest -from conekta.models.update_order_tax_response import UpdateOrderTaxResponse +from conekta.models.order_tax_response import OrderTaxResponse +from conekta.models.orders_update_taxes_request import OrdersUpdateTaxesRequest from conekta.rest import ApiException from pprint import pprint @@ -225,13 +225,13 @@ with conekta.ApiClient(configuration) as api_client: api_instance = conekta.TaxesApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource tax_id = 'tax_lin_2tQ974hSHcsdeSZHG' # str | identifier - update_order_tax_request = conekta.UpdateOrderTaxRequest() # UpdateOrderTaxRequest | requested field for taxes - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + orders_update_taxes_request = conekta.OrdersUpdateTaxesRequest() # OrdersUpdateTaxesRequest | requested field for taxes + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Update Tax - api_response = api_instance.orders_update_taxes(id, tax_id, update_order_tax_request, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.orders_update_taxes(id, tax_id, orders_update_taxes_request, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of TaxesApi->orders_update_taxes:\n") pprint(api_response) except Exception as e: @@ -247,13 +247,13 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | **tax_id** | **str**| identifier | - **update_order_tax_request** | [**UpdateOrderTaxRequest**](UpdateOrderTaxRequest.md)| requested field for taxes | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **orders_update_taxes_request** | [**OrdersUpdateTaxesRequest**](OrdersUpdateTaxesRequest.md)| requested field for taxes | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type -[**UpdateOrderTaxResponse**](UpdateOrderTaxResponse.md) +[**OrderTaxResponse**](OrderTaxResponse.md) ### Authorization diff --git a/docs/Token.md b/docs/Token.md deleted file mode 100644 index 3d3f416..0000000 --- a/docs/Token.md +++ /dev/null @@ -1,31 +0,0 @@ -# Token - -a token - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**card** | [**TokenCard**](TokenCard.md) | | [optional] -**checkout** | [**TokenCheckout**](TokenCheckout.md) | | [optional] - -## Example - -```python -from conekta.models.token import Token - -# TODO update the JSON string below -json = "{}" -# create an instance of Token from a JSON string -token_instance = Token.from_json(json) -# print the JSON string representation of the object -print(Token.to_json()) - -# convert the object into a dict -token_dict = token_instance.to_dict() -# create an instance of Token from a dict -token_from_dict = Token.from_dict(token_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/TokenRequest.md b/docs/TokenRequest.md new file mode 100644 index 0000000..2c0d769 --- /dev/null +++ b/docs/TokenRequest.md @@ -0,0 +1,31 @@ +# TokenRequest + +a token + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**card** | [**TokenRequestCard**](TokenRequestCard.md) | | [optional] +**checkout** | [**TokenRequestCheckout**](TokenRequestCheckout.md) | | [optional] + +## Example + +```python +from conekta.models.token_request import TokenRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of TokenRequest from a JSON string +token_request_instance = TokenRequest.from_json(json) +# print the JSON string representation of the object +print(TokenRequest.to_json()) + +# convert the object into a dict +token_request_dict = token_request_instance.to_dict() +# create an instance of TokenRequest from a dict +token_request_from_dict = TokenRequest.from_dict(token_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/TokenCard.md b/docs/TokenRequestCard.md similarity index 69% rename from docs/TokenCard.md rename to docs/TokenRequestCard.md index b8615ef..5b1e473 100644 --- a/docs/TokenCard.md +++ b/docs/TokenRequestCard.md @@ -1,4 +1,4 @@ -# TokenCard +# TokenRequestCard ## Properties @@ -15,19 +15,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.token_card import TokenCard +from conekta.models.token_request_card import TokenRequestCard # TODO update the JSON string below json = "{}" -# create an instance of TokenCard from a JSON string -token_card_instance = TokenCard.from_json(json) +# create an instance of TokenRequestCard from a JSON string +token_request_card_instance = TokenRequestCard.from_json(json) # print the JSON string representation of the object -print(TokenCard.to_json()) +print(TokenRequestCard.to_json()) # convert the object into a dict -token_card_dict = token_card_instance.to_dict() -# create an instance of TokenCard from a dict -token_card_from_dict = TokenCard.from_dict(token_card_dict) +token_request_card_dict = token_request_card_instance.to_dict() +# create an instance of TokenRequestCard from a dict +token_request_card_from_dict = TokenRequestCard.from_dict(token_request_card_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/TokenCheckout.md b/docs/TokenRequestCheckout.md similarity index 52% rename from docs/TokenCheckout.md rename to docs/TokenRequestCheckout.md index ed11bea..0209aa4 100644 --- a/docs/TokenCheckout.md +++ b/docs/TokenRequestCheckout.md @@ -1,4 +1,4 @@ -# TokenCheckout +# TokenRequestCheckout ## Properties @@ -10,19 +10,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.token_checkout import TokenCheckout +from conekta.models.token_request_checkout import TokenRequestCheckout # TODO update the JSON string below json = "{}" -# create an instance of TokenCheckout from a JSON string -token_checkout_instance = TokenCheckout.from_json(json) +# create an instance of TokenRequestCheckout from a JSON string +token_request_checkout_instance = TokenRequestCheckout.from_json(json) # print the JSON string representation of the object -print(TokenCheckout.to_json()) +print(TokenRequestCheckout.to_json()) # convert the object into a dict -token_checkout_dict = token_checkout_instance.to_dict() -# create an instance of TokenCheckout from a dict -token_checkout_from_dict = TokenCheckout.from_dict(token_checkout_dict) +token_request_checkout_dict = token_request_checkout_instance.to_dict() +# create an instance of TokenRequestCheckout from a dict +token_request_checkout_from_dict = TokenRequestCheckout.from_dict(token_request_checkout_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/TokensApi.md b/docs/TokensApi.md index 53cece6..bdb41ae 100644 --- a/docs/TokensApi.md +++ b/docs/TokensApi.md @@ -8,11 +8,12 @@ Method | HTTP request | Description # **create_token** -> TokenResponse create_token(token, accept_language=accept_language) +> TokenResponse create_token(token_request, accept_language=accept_language) Create Token -Generate a payment token, to associate it with a card +Generate a payment token, to associate it with a card, Endpoint could be use directly only for PCI compliance account + ### Example @@ -20,7 +21,7 @@ Generate a payment token, to associate it with a card ```python import conekta -from conekta.models.token import Token +from conekta.models.token_request import TokenRequest from conekta.models.token_response import TokenResponse from conekta.rest import ApiException from pprint import pprint @@ -45,12 +46,12 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.TokensApi(api_client) - token = conekta.Token() # Token | requested field for token - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + token_request = conekta.TokenRequest() # TokenRequest | requested field for token + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Create Token - api_response = api_instance.create_token(token, accept_language=accept_language) + api_response = api_instance.create_token(token_request, accept_language=accept_language) print("The response of TokensApi->create_token:\n") pprint(api_response) except Exception as e: @@ -64,8 +65,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **token** | [**Token**](Token.md)| requested field for token | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **token_request** | [**TokenRequest**](TokenRequest.md)| requested field for token | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type diff --git a/docs/TransactionsApi.md b/docs/TransactionsApi.md index 7243f31..9330a31 100644 --- a/docs/TransactionsApi.md +++ b/docs/TransactionsApi.md @@ -46,7 +46,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.TransactionsApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -66,7 +66,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -130,7 +130,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.TransactionsApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) next = 'next_example' # str | next page (optional) @@ -156,7 +156,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **next** | **str**| next page | [optional] diff --git a/docs/TransfersApi.md b/docs/TransfersApi.md index bf03354..ba15e7f 100644 --- a/docs/TransfersApi.md +++ b/docs/TransfersApi.md @@ -46,7 +46,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.TransfersApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -66,7 +66,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -130,7 +130,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.TransfersApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -153,7 +153,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] diff --git a/docs/UpdateCustomer.md b/docs/UpdateCustomer.md index dfd6c9e..b279a72 100644 --- a/docs/UpdateCustomer.md +++ b/docs/UpdateCustomer.md @@ -16,11 +16,11 @@ Name | Type | Description | Notes **default_shipping_contact_id** | **str** | It is a parameter that allows to identify in the response, the Conekta ID of the shipping address (shipping_contact) | [optional] **corporate** | **bool** | It is a value that allows identifying if the email is corporate or not. | [optional] [default to False] **custom_reference** | **str** | It is an undefined value. | [optional] -**fiscal_entities** | [**List[CustomerFiscalEntitiesRequest]**](CustomerFiscalEntitiesRequest.md) | | [optional] +**fiscal_entities** | [**List[FiscalEntityRequest]**](FiscalEntityRequest.md) | | [optional] **metadata** | **Dict[str, object]** | | [optional] **national_id** | **str** | It is a parameter that allows to identify the national identification number of the client. | [optional] **payment_sources** | [**List[CustomerPaymentMethodsRequest]**](CustomerPaymentMethodsRequest.md) | Contains details of the payment methods that the customer has active or has used in Conekta | [optional] -**shipping_contacts** | [**List[CustomerShippingContacts]**](CustomerShippingContacts.md) | Contains the detail of the shipping addresses that the client has active or has used in Conekta | [optional] +**shipping_contacts** | [**List[CustomerShippingContactsRequest]**](CustomerShippingContactsRequest.md) | Contains the detail of the shipping addresses that the client has active or has used in Conekta | [optional] **subscription** | [**SubscriptionRequest**](SubscriptionRequest.md) | | [optional] ## Example diff --git a/docs/UpdateCustomerFiscalEntitiesResponse.md b/docs/UpdateCustomerFiscalEntitiesResponse.md index 226f59b..03c8b7e 100644 --- a/docs/UpdateCustomerFiscalEntitiesResponse.md +++ b/docs/UpdateCustomerFiscalEntitiesResponse.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**address** | [**CustomerAddress**](CustomerAddress.md) | | +**address** | [**FiscalEntityRequestAddress**](FiscalEntityRequestAddress.md) | | **tax_id** | **str** | | [optional] **email** | **str** | | [optional] **phone** | **str** | | [optional] diff --git a/docs/UpdateCustomerPaymentMethodsResponse.md b/docs/UpdateCustomerPaymentMethodsResponse.md index 1dcb43f..ad39e7f 100644 --- a/docs/UpdateCustomerPaymentMethodsResponse.md +++ b/docs/UpdateCustomerPaymentMethodsResponse.md @@ -10,7 +10,7 @@ Name | Type | Description | Notes **object** | **str** | | **created_at** | **int** | | **parent_id** | **str** | | [optional] -**agreements** | [**List[PaymentMethodCashResponseAllOfAgreements]**](PaymentMethodCashResponseAllOfAgreements.md) | | [optional] +**agreements** | [**List[CashAgreementsResponse]**](CashAgreementsResponse.md) | | [optional] **reference** | **str** | | [optional] **barcode** | **str** | | [optional] **barcode_url** | **str** | URL to the barcode image, reference is the same as barcode | [optional] @@ -22,6 +22,7 @@ Name | Type | Description | Notes **exp_month** | **str** | | [optional] **exp_year** | **str** | | [optional] **brand** | **str** | | [optional] +**issuer** | **str** | Name of the institution that issued the card | [optional] **name** | **str** | | [optional] **default** | **bool** | | [optional] **visible_on_checkout** | **bool** | | [optional] diff --git a/docs/UpdateFiscalEntityRequest.md b/docs/UpdateFiscalEntityRequest.md new file mode 100644 index 0000000..96a9381 --- /dev/null +++ b/docs/UpdateFiscalEntityRequest.md @@ -0,0 +1,34 @@ +# UpdateFiscalEntityRequest + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | [**FiscalEntityRequestAddress**](FiscalEntityRequestAddress.md) | | [optional] +**tax_id** | **str** | | [optional] +**email** | **str** | | [optional] +**phone** | **str** | | [optional] +**metadata** | **Dict[str, object]** | | [optional] +**company_name** | **str** | | [optional] + +## Example + +```python +from conekta.models.update_fiscal_entity_request import UpdateFiscalEntityRequest + +# TODO update the JSON string below +json = "{}" +# create an instance of UpdateFiscalEntityRequest from a JSON string +update_fiscal_entity_request_instance = UpdateFiscalEntityRequest.from_json(json) +# print the JSON string representation of the object +print(UpdateFiscalEntityRequest.to_json()) + +# convert the object into a dict +update_fiscal_entity_request_dict = update_fiscal_entity_request_instance.to_dict() +# create an instance of UpdateFiscalEntityRequest from a dict +update_fiscal_entity_request_from_dict = UpdateFiscalEntityRequest.from_dict(update_fiscal_entity_request_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/UpdatePaymentMethods.md b/docs/UpdatePaymentMethodsCard.md similarity index 53% rename from docs/UpdatePaymentMethods.md rename to docs/UpdatePaymentMethodsCard.md index d3e9472..1811813 100644 --- a/docs/UpdatePaymentMethods.md +++ b/docs/UpdatePaymentMethodsCard.md @@ -1,4 +1,4 @@ -# UpdatePaymentMethods +# UpdatePaymentMethodsCard ## Properties @@ -11,19 +11,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.update_payment_methods import UpdatePaymentMethods +from conekta.models.update_payment_methods_card import UpdatePaymentMethodsCard # TODO update the JSON string below json = "{}" -# create an instance of UpdatePaymentMethods from a JSON string -update_payment_methods_instance = UpdatePaymentMethods.from_json(json) +# create an instance of UpdatePaymentMethodsCard from a JSON string +update_payment_methods_card_instance = UpdatePaymentMethodsCard.from_json(json) # print the JSON string representation of the object -print(UpdatePaymentMethods.to_json()) +print(UpdatePaymentMethodsCard.to_json()) # convert the object into a dict -update_payment_methods_dict = update_payment_methods_instance.to_dict() -# create an instance of UpdatePaymentMethods from a dict -update_payment_methods_from_dict = UpdatePaymentMethods.from_dict(update_payment_methods_dict) +update_payment_methods_card_dict = update_payment_methods_card_instance.to_dict() +# create an instance of UpdatePaymentMethodsCard from a dict +update_payment_methods_card_from_dict = UpdatePaymentMethodsCard.from_dict(update_payment_methods_card_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/PlanUpdateRequest.md b/docs/UpdatePlan.md similarity index 67% rename from docs/PlanUpdateRequest.md rename to docs/UpdatePlan.md index 9df7f70..e0a7f73 100644 --- a/docs/PlanUpdateRequest.md +++ b/docs/UpdatePlan.md @@ -1,4 +1,4 @@ -# PlanUpdateRequest +# UpdatePlan a plan @@ -14,19 +14,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.plan_update_request import PlanUpdateRequest +from conekta.models.update_plan import UpdatePlan # TODO update the JSON string below json = "{}" -# create an instance of PlanUpdateRequest from a JSON string -plan_update_request_instance = PlanUpdateRequest.from_json(json) +# create an instance of UpdatePlan from a JSON string +update_plan_instance = UpdatePlan.from_json(json) # print the JSON string representation of the object -print(PlanUpdateRequest.to_json()) +print(UpdatePlan.to_json()) # convert the object into a dict -plan_update_request_dict = plan_update_request_instance.to_dict() -# create an instance of PlanUpdateRequest from a dict -plan_update_request_from_dict = PlanUpdateRequest.from_dict(plan_update_request_dict) +update_plan_dict = update_plan_instance.to_dict() +# create an instance of UpdatePlan from a dict +update_plan_from_dict = UpdatePlan.from_dict(update_plan_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/WebhookUpdateRequest.md b/docs/UpdateWebhook.md similarity index 63% rename from docs/WebhookUpdateRequest.md rename to docs/UpdateWebhook.md index c45541d..0b46c4e 100644 --- a/docs/WebhookUpdateRequest.md +++ b/docs/UpdateWebhook.md @@ -1,4 +1,4 @@ -# WebhookUpdateRequest +# UpdateWebhook an updated webhook @@ -13,19 +13,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.webhook_update_request import WebhookUpdateRequest +from conekta.models.update_webhook import UpdateWebhook # TODO update the JSON string below json = "{}" -# create an instance of WebhookUpdateRequest from a JSON string -webhook_update_request_instance = WebhookUpdateRequest.from_json(json) +# create an instance of UpdateWebhook from a JSON string +update_webhook_instance = UpdateWebhook.from_json(json) # print the JSON string representation of the object -print(WebhookUpdateRequest.to_json()) +print(UpdateWebhook.to_json()) # convert the object into a dict -webhook_update_request_dict = webhook_update_request_instance.to_dict() -# create an instance of WebhookUpdateRequest from a dict -webhook_update_request_from_dict = WebhookUpdateRequest.from_dict(webhook_update_request_dict) +update_webhook_dict = update_webhook_instance.to_dict() +# create an instance of UpdateWebhook from a dict +update_webhook_from_dict = UpdateWebhook.from_dict(update_webhook_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/SubscriptionUpdateRequest.md b/docs/UpdatesASubscription.md similarity index 53% rename from docs/SubscriptionUpdateRequest.md rename to docs/UpdatesASubscription.md index c9617a8..d6a3ad6 100644 --- a/docs/SubscriptionUpdateRequest.md +++ b/docs/UpdatesASubscription.md @@ -1,4 +1,4 @@ -# SubscriptionUpdateRequest +# UpdatesASubscription You can modify the subscription to change the plan used by your customers. @@ -13,19 +13,19 @@ Name | Type | Description | Notes ## Example ```python -from conekta.models.subscription_update_request import SubscriptionUpdateRequest +from conekta.models.updates_a_subscription import UpdatesASubscription # TODO update the JSON string below json = "{}" -# create an instance of SubscriptionUpdateRequest from a JSON string -subscription_update_request_instance = SubscriptionUpdateRequest.from_json(json) +# create an instance of UpdatesASubscription from a JSON string +updates_a_subscription_instance = UpdatesASubscription.from_json(json) # print the JSON string representation of the object -print(SubscriptionUpdateRequest.to_json()) +print(UpdatesASubscription.to_json()) # convert the object into a dict -subscription_update_request_dict = subscription_update_request_instance.to_dict() -# create an instance of SubscriptionUpdateRequest from a dict -subscription_update_request_from_dict = SubscriptionUpdateRequest.from_dict(subscription_update_request_dict) +updates_a_subscription_dict = updates_a_subscription_instance.to_dict() +# create an instance of UpdatesASubscription from a dict +updates_a_subscription_from_dict = UpdatesASubscription.from_dict(updates_a_subscription_dict) ``` [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/WebhookKeysApi.md b/docs/WebhookKeysApi.md index 635ddf6..307726a 100644 --- a/docs/WebhookKeysApi.md +++ b/docs/WebhookKeysApi.md @@ -49,7 +49,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhookKeysApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') webhook_key_request = conekta.WebhookKeyRequest() # WebhookKeyRequest | (optional) try: @@ -68,7 +68,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **webhook_key_request** | [**WebhookKeyRequest**](WebhookKeyRequest.md)| | [optional] ### Return type @@ -130,7 +130,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhookKeysApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Delete Webhook key @@ -149,7 +149,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -211,7 +211,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhookKeysApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -231,7 +231,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -295,7 +295,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhookKeysApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -318,7 +318,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -387,7 +387,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhookKeysApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') webhook_key_update_request = conekta.WebhookKeyUpdateRequest() # WebhookKeyUpdateRequest | (optional) try: @@ -407,7 +407,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **webhook_key_update_request** | [**WebhookKeyUpdateRequest**](WebhookKeyUpdateRequest.md)| | [optional] ### Return type diff --git a/docs/WebhooksApi.md b/docs/WebhooksApi.md index 0ec65c6..a8c3c13 100644 --- a/docs/WebhooksApi.md +++ b/docs/WebhooksApi.md @@ -51,7 +51,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhooksApi(api_client) webhook_request = conekta.WebhookRequest() # WebhookRequest | requested field for webhook - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Create Webhook @@ -70,7 +70,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **webhook_request** | [**WebhookRequest**](WebhookRequest.md)| requested field for webhook | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -131,7 +131,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhooksApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Delete Webhook @@ -150,7 +150,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -212,7 +212,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhooksApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: @@ -232,7 +232,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type @@ -296,7 +296,7 @@ configuration = conekta.Configuration( with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhooksApi(api_client) - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) limit = 20 # int | The numbers of items to return, the maximum value is 250 (optional) (default to 20) search = 'search_example' # str | General order search, e.g. by mail, reference etc. (optional) @@ -320,7 +320,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] **limit** | **int**| The numbers of items to return, the maximum value is 250 | [optional] [default to 20] **search** | **str**| General order search, e.g. by mail, reference etc. | [optional] @@ -389,7 +389,7 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhooksApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') try: # Test Webhook @@ -408,7 +408,7 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] ### Return type @@ -435,7 +435,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_webhook** -> WebhookResponse update_webhook(id, webhook_update_request, accept_language=accept_language, x_child_company_id=x_child_company_id) +> WebhookResponse update_webhook(id, update_webhook, accept_language=accept_language, x_child_company_id=x_child_company_id) Update Webhook @@ -447,8 +447,8 @@ updates an existing webhook ```python import conekta +from conekta.models.update_webhook import UpdateWebhook from conekta.models.webhook_response import WebhookResponse -from conekta.models.webhook_update_request import WebhookUpdateRequest from conekta.rest import ApiException from pprint import pprint @@ -473,13 +473,13 @@ with conekta.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = conekta.WebhooksApi(api_client) id = '6307a60c41de27127515a575' # str | Identifier of the resource - webhook_update_request = conekta.WebhookUpdateRequest() # WebhookUpdateRequest | requested fields in order to update a webhook - accept_language = es # str | Use for knowing which language to use (optional) (default to es) + update_webhook = conekta.UpdateWebhook() # UpdateWebhook | requested fields in order to update a webhook + accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es') x_child_company_id = '6441b6376b60c3a638da80af' # str | In the case of a holding company, the company id of the child company to which will process the request. (optional) try: # Update Webhook - api_response = api_instance.update_webhook(id, webhook_update_request, accept_language=accept_language, x_child_company_id=x_child_company_id) + api_response = api_instance.update_webhook(id, update_webhook, accept_language=accept_language, x_child_company_id=x_child_company_id) print("The response of WebhooksApi->update_webhook:\n") pprint(api_response) except Exception as e: @@ -494,8 +494,8 @@ with conekta.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **id** | **str**| Identifier of the resource | - **webhook_update_request** | [**WebhookUpdateRequest**](WebhookUpdateRequest.md)| requested fields in order to update a webhook | - **accept_language** | **str**| Use for knowing which language to use | [optional] [default to es] + **update_webhook** | [**UpdateWebhook**](UpdateWebhook.md)| requested fields in order to update a webhook | + **accept_language** | **str**| Use for knowing which language to use | [optional] [default to 'es'] **x_child_company_id** | **str**| In the case of a holding company, the company id of the child company to which will process the request. | [optional] ### Return type diff --git a/pyproject.toml b/pyproject.toml index ca7281e..56cddbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,24 +1,30 @@ -[tool.poetry] +[project] name = "conekta" -version = "7.0.3" +version = "7.1.0" description = "Conekta API" -authors = ["Engineering Conekta "] -license = "MIT-LICENSE" +authors = [ + {name = "Engineering Conekta",email = "engineering@conekta.com"}, +] +license = { text = "MIT-LICENSE" } readme = "README.md" -repository = "https://github.com/conekta/conekta-python" keywords = ["OpenAPI", "OpenAPI-Generator", "Conekta API"] -include = ["conekta/py.typed"] +requires-python = ">=3.9" -[tool.poetry.dependencies] -python = "^3.8" +dependencies = [ + "urllib3 (>=2.6.3,<3.0.0)", + "python-dateutil (>=2.8.2)", + "pydantic (>=2.11)", + "typing-extensions (>=4.7.1)", +] -urllib3 = ">= 1.25.3 < 3.0.0" -python-dateutil = ">= 2.8.2" -pydantic = ">= 2" -typing-extensions = ">= 4.7.1" +[project.urls] +Repository = "https://github.com/conekta/conekta-python" -[tool.poetry.dev-dependencies] -pytest = ">= 7.2.1" +[tool.poetry] +requires-poetry = ">=2.0" + +[tool.poetry.group.dev.dependencies] +pytest = ">= 8.4.2" pytest-cov = ">= 2.8.1" tox = ">= 3.9.0" flake8 = ">= 4.0.0" @@ -49,7 +55,7 @@ warn_unused_ignores = true ## Getting these passing should be easy strict_equality = true -strict_concatenate = true +extra_checks = true ## Strongly recommend enabling this one as soon as you can check_untyped_defs = true @@ -70,3 +76,20 @@ disallow_any_generics = true # ### This one can be tricky to get passing if you use a lot of untyped libraries #warn_return_any = true + +[[tool.mypy.overrides]] +module = [ + "conekta.configuration", +] +warn_unused_ignores = true +strict_equality = true +extra_checks = true +check_untyped_defs = true +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_reexport = true +warn_return_any = true diff --git a/requirements.txt b/requirements.txt index 67f7f68..9af8f58 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -urllib3 >= 1.25.3, < 3.0.0 +urllib3 >= 2.6.3, < 3.0.0 python_dateutil >= 2.8.2 -pydantic >= 2 +pydantic >= 2.11 typing-extensions >= 4.7.1 diff --git a/setup.py b/setup.py index ee81d4d..8e9699a 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ Conekta API @@ -22,12 +20,12 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "conekta" -VERSION = "7.0.3" -PYTHON_REQUIRES = ">= 3.8" +VERSION = "7.1.0" +PYTHON_REQUIRES = ">= 3.10" REQUIRES = [ - "urllib3 >= 1.25.3, < 3.0.0", + "urllib3 >= 2.6.3, < 3.0.0", "python-dateutil >= 2.8.2", - "pydantic >= 2", + "pydantic >= 2.11", "typing-extensions >= 4.7.1", ] diff --git a/test-requirements.txt b/test-requirements.txt index e98555c..731ef0e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,4 +1,4 @@ -pytest >= 7.2.1 +pytest >= 8.4.2 pytest-cov >= 2.8.1 tox >= 3.9.0 flake8 >= 4.0.0 diff --git a/test/test_companies_api.py b/test/test_companies_api.py index 6498a78..6f4799e 100644 --- a/test/test_companies_api.py +++ b/test/test_companies_api.py @@ -55,6 +55,13 @@ def test_get_company_documents(self) -> None: """ pass + def test_get_current_company(self) -> None: + """Test case for get_current_company + + Get Current Company + """ + pass + def test_update_company_document(self) -> None: """Test case for update_company_document diff --git a/test/test_subscriptions_customer_portal_api.py b/test/test_subscriptions_customer_portal_api.py new file mode 100644 index 0000000..8fa496b --- /dev/null +++ b/test/test_subscriptions_customer_portal_api.py @@ -0,0 +1,46 @@ +# coding: utf-8 + +""" + Conekta API + + Conekta sdk + + The version of the OpenAPI document: 2.2.0 + Contact: engineering@conekta.com + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from conekta.api.subscriptions_customer_portal_api import SubscriptionsCustomerPortalApi + + +class TestSubscriptionsCustomerPortalApi(unittest.TestCase): + """SubscriptionsCustomerPortalApi unit test stubs""" + + def setUp(self) -> None: + self.api = SubscriptionsCustomerPortalApi() + + def tearDown(self) -> None: + pass + + def test_create_customer_portal(self) -> None: + """Test case for create_customer_portal + + Create customer portal + """ + pass + + def test_get_customer_portal(self) -> None: + """Test case for get_customer_portal + + Get customer portal + """ + pass + + +if __name__ == '__main__': + unittest.main() From fec6fca4f91029f54740c76250bed4a45a24b0f1 Mon Sep 17 00:00:00 2001 From: Franklin Date: Tue, 21 Jul 2026 15:14:16 -0500 Subject: [PATCH 2/2] Update Python version matrix in CI workflow to include 3.14 --- .github/workflows/python.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 041dc34..44a729d 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] + python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ] steps: - uses: actions/checkout@v7 - name: Set up Python ${{ matrix.python-version }} diff --git a/Makefile b/Makefile index 4051dcd..7ed742b 100644 --- a/Makefile +++ b/Makefile @@ -14,4 +14,4 @@ python: -g python \ -o /local \ -c /local/config-python.json \ - --global-property modelTests=false + --global-property modelTests=false