Giter Site home page Giter Site logo

conekta-ruby's Introduction

conekta

Conekta sdk

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 2.1.0
  • Package version: 6.0.3
  • Generator version: 7.5.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://github.com/conekta/openapi/issues

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/conekta/conekta-python.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/conekta/conekta-python.git)

Then import the package:

import conekta

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import conekta

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import time
import conekta
from conekta.rest import ApiException
from pprint import pprint

# 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["API_KEY"]
)


# 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.CustomersApi(api_client)
    customer = conekta.Customer(
        email='[email protected]',
        name='Customer Name',
        phone='5534343434'
    ) # Customer | requested field for create Customer
    accept_language = 'es' # str | Use for knowing which language to use (optional) (default to 'es')

    try:
        # Create Customer
        api_response = api_instance.create_customer(customer, accept_language=accept_language)
        print("The response of CustomersApi->create_customer:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling CustomersApi->create_customer: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.conekta.io

Class Method HTTP request Description
AntifraudApi create_rule_blacklist POST /antifraud/blacklists Create blacklisted rule
AntifraudApi create_rule_whitelist POST /antifraud/whitelists Create whitelisted rule
AntifraudApi delete_rule_blacklist DELETE /antifraud/blacklists/{id} Delete blacklisted rule
AntifraudApi delete_rule_whitelist DELETE /antifraud/whitelists/{id} Delete whitelisted rule
AntifraudApi get_rule_blacklist GET /antifraud/blacklists Get list of blacklisted rules
AntifraudApi get_rule_whitelist GET /antifraud/whitelists Get a list of whitelisted rules
ApiKeysApi create_api_key POST /api_keys Create Api Key
ApiKeysApi delete_api_key DELETE /api_keys/{id} Delete Api Key
ApiKeysApi get_api_key GET /api_keys/{id} Get Api Key
ApiKeysApi get_api_keys GET /api_keys Get list of Api Keys
ApiKeysApi update_api_key PUT /api_keys/{id} Update Api Key
BalancesApi get_balance GET /balance Get a company's balance
ChargesApi get_charges GET /charges Get A List of Charges
ChargesApi orders_create_charge POST /orders/{id}/charges Create charge
ChargesApi update_charge PUT /charges/{id} Update a charge
CompaniesApi get_companies GET /companies Get List of Companies
CompaniesApi get_company GET /companies/{id} Get Company
CustomersApi create_customer POST /customers Create customer
CustomersApi create_customer_fiscal_entities POST /customers/{id}/fiscal_entities Create Fiscal Entity
CustomersApi delete_customer_by_id DELETE /customers/{id} Delete Customer
CustomersApi get_customer_by_id GET /customers/{id} Get Customer
CustomersApi get_customers GET /customers Get a list of customers
CustomersApi update_customer PUT /customers/{id} Update customer
CustomersApi update_customer_fiscal_entities PUT /customers/{id}/fiscal_entities/{fiscal_entities_id} Update Fiscal Entity
DiscountsApi orders_create_discount_line POST /orders/{id}/discount_lines Create Discount
DiscountsApi orders_delete_discount_lines DELETE /orders/{id}/discount_lines/{discount_lines_id} Delete Discount
DiscountsApi orders_get_discount_line GET /orders/{id}/discount_lines/{discount_lines_id} Get Discount
DiscountsApi orders_get_discount_lines GET /orders/{id}/discount_lines Get a List of Discount
DiscountsApi orders_update_discount_lines PUT /orders/{id}/discount_lines/{discount_lines_id} Update Discount
EventsApi get_event GET /events/{id} Get Event
EventsApi get_events GET /events Get list of Events
EventsApi resend_event POST /events/{event_id}/webhook_logs/{webhook_log_id}/resend Resend Event
LogsApi get_log_by_id GET /logs/{id} Get Log
LogsApi get_logs GET /logs Get List Of Logs
OrdersApi cancel_order POST /orders/{id}/cancel Cancel Order
OrdersApi create_order POST /orders Create order
OrdersApi get_order_by_id GET /orders/{id} Get Order
OrdersApi get_orders GET /orders Get a list of Orders
OrdersApi order_cancel_refund DELETE /orders/{id}/refunds/{refund_id} Cancel Refund
OrdersApi order_refund POST /orders/{id}/refunds Refund Order
OrdersApi orders_create_capture POST /orders/{id}/capture Capture Order
OrdersApi update_order PUT /orders/{id} Update Order
PaymentLinkApi cancel_checkout PUT /checkouts/{id}/cancel Cancel Payment Link
PaymentLinkApi create_checkout POST /checkouts Create Unique Payment Link
PaymentLinkApi email_checkout POST /checkouts/{id}/email Send an email
PaymentLinkApi get_checkout GET /checkouts/{id} Get a payment link by ID
PaymentLinkApi get_checkouts GET /checkouts Get a list of payment links
PaymentLinkApi sms_checkout POST /checkouts/{id}/sms Send an sms
PaymentMethodsApi create_customer_payment_methods POST /customers/{id}/payment_sources Create Payment Method
PaymentMethodsApi delete_customer_payment_methods DELETE /customers/{id}/payment_sources/{payment_method_id} Delete Payment Method
PaymentMethodsApi get_customer_payment_methods GET /customers/{id}/payment_sources Get Payment Methods
PaymentMethodsApi update_customer_payment_methods PUT /customers/{id}/payment_sources/{payment_method_id} Update Payment Method
PayoutOrdersApi create_payout_order POST /payout_orders Create payout order
PayoutOrdersApi get_payout_order_by_id GET /payout_orders/{id} Get Payout Order
PayoutOrdersApi get_payout_orders GET /payout_orders Get a list of Payout Orders
PlansApi create_plan POST /plans Create Plan
PlansApi delete_plan DELETE /plans/{id} Delete Plan
PlansApi get_plan GET /plans/{id} Get Plan
PlansApi get_plans GET /plans Get A List of Plans
PlansApi update_plan PUT /plans/{id} Update Plan
ProductsApi orders_create_product POST /orders/{id}/line_items Create Product
ProductsApi orders_delete_product DELETE /orders/{id}/line_items/{line_item_id} Delete Product
ProductsApi orders_update_product PUT /orders/{id}/line_items/{line_item_id} Update Product
ShippingContactsApi create_customer_shipping_contacts POST /customers/{id}/shipping_contacts Create a shipping contacts
ShippingContactsApi delete_customer_shipping_contacts DELETE /customers/{id}/shipping_contacts/{shipping_contacts_id} Delete shipping contacts
ShippingContactsApi update_customer_shipping_contacts PUT /customers/{id}/shipping_contacts/{shipping_contacts_id} Update shipping contacts
ShippingsApi orders_create_shipping POST /orders/{id}/shipping_lines Create Shipping
ShippingsApi orders_delete_shipping DELETE /orders/{id}/shipping_lines/{shipping_id} Delete Shipping
ShippingsApi orders_update_shipping PUT /orders/{id}/shipping_lines/{shipping_id} Update Shipping
SubscriptionsApi cancel_subscription POST /customers/{id}/subscription/cancel Cancel Subscription
SubscriptionsApi create_subscription POST /customers/{id}/subscription Create Subscription
SubscriptionsApi get_all_events_from_subscription GET /customers/{id}/subscription/events Get Events By Subscription
SubscriptionsApi get_subscription GET /customers/{id}/subscription Get Subscription
SubscriptionsApi pause_subscription POST /customers/{id}/subscription/pause Pause Subscription
SubscriptionsApi resume_subscription POST /customers/{id}/subscription/resume Resume Subscription
SubscriptionsApi update_subscription PUT /customers/{id}/subscription Update Subscription
TaxesApi orders_create_taxes POST /orders/{id}/tax_lines Create Tax
TaxesApi orders_delete_taxes DELETE /orders/{id}/tax_lines/{tax_id} Delete Tax
TaxesApi orders_update_taxes PUT /orders/{id}/tax_lines/{tax_id} Update Tax
TokensApi create_token POST /tokens Create Token
TransactionsApi get_transaction GET /transactions/{id} Get transaction
TransactionsApi get_transactions GET /transactions Get List transactions
TransfersApi get_transfer GET /transfers/{id} Get Transfer
TransfersApi get_transfers GET /transfers Get a list of transfers
WebhookKeysApi create_webhook_key POST /webhook_keys Create Webhook Key
WebhookKeysApi delete_webhook_key DELETE /webhook_keys/{id} Delete Webhook key
WebhookKeysApi get_webhook_key GET /webhook_keys/{id} Get Webhook Key
WebhookKeysApi get_webhook_keys GET /webhook_keys Get List of Webhook Keys
WebhookKeysApi update_webhook_key PUT /webhook_keys/{id} Update Webhook Key
WebhooksApi create_webhook POST /webhooks Create Webhook
WebhooksApi delete_webhook DELETE /webhooks/{id} Delete Webhook
WebhooksApi get_webhook GET /webhooks/{id} Get Webhook
WebhooksApi get_webhooks GET /webhooks Get List of Webhooks
WebhooksApi test_webhook POST /webhooks/{id}/test Test Webhook
WebhooksApi update_webhook PUT /webhooks/{id} Update Webhook

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

bearerAuth

  • Type: Bearer authentication

Author

[email protected]

conekta-ruby's People

Contributors

acolin avatar andreasantillana avatar antillas21 avatar carmenconekta avatar denisse-dev avatar edenriquez avatar fcarrero avatar gerardoacuna avatar hectorgool avatar javiermurillo avatar jovalo avatar juanolivas avatar karlarobinson avatar leofischer avatar lu1s avatar luiscarlos-gonzalez avatar mackaber avatar mariochavez avatar mauriciomurga avatar nicklloyd avatar nicocedron avatar richpeniche avatar robertomiranda avatar vicentemendoza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

conekta-ruby's Issues

undefined method `create_attr' for nil:NilClass

Hi! I am using method create_payment_source for Conekta::Customer model in my project:

if customer.is_a?(Conekta::Customer) && params[:token].present?
   new_payment_source = customer.create_payment_source({ type: 'card', token_id: params[:token] })
end

but getting this error

undefined method `create_attr' for nil:NilClass 

["/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.3.0/gems/conekta-2.0.0/lib/conekta/resource.rb:39:in `create_member_with_relation'", 

"/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.3.0/gems/conekta-2.0.0/lib/conekta/customer.rb:57:in `create_payment_source'

it seems there is some problem during member(payment_source) creation. May be I should use another method to assign new payment source to existing customer? But I think I found the method in API documentation.

How to use Conekta in tests?

I'm not sure if this is the right place, but I can't seem to find any information on how to use the Conekta API inside the integration tests. Hoped someone can direct me in the right direction.

When sending the attributes to conekta it adds an equals to the json?

Hi how are you? good morning, im having a little problem and i'm hoping to see if you can help me out with this error that appears in my app

This error does not always happen
Message

NoMethodError: undefined method `last4=' for #Conekta::PaymentSource:0x00000000071361e8 Did you mean? last4 last

URL

https://lagrange.rootr.mx/api/v1/app_users/carts

Traceback

NoMethodError: undefined method `last4=' for #<Conekta::PaymentSource:0x00000000071361e8>
Did you mean?  last4
               last
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 73, in create_attr
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 103, in load_from_enumerable
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 36, in block in load_from
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 35, in each
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 35, in load_from
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/util.rb", line 53, in convert_to_conekta_object
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 97, in load_from_enumerable
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 31, in block in load_from
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 30, in each
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 30, in each_with_index
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 30, in load_from
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/list.rb", line 47, in load_from
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/util.rb", line 53, in convert_to_conekta_object
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 97, in load_from_enumerable
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 36, in block in load_from
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 35, in each
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/conekta_object.rb", line 35, in load_from
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/customer.rb", line 25, in load_from
  File "/app/vendor/bundle/ruby/2.5.0/gems/conekta-2.3.0/lib/conekta/operations/find.rb", line 8, in find
  File "/app/app/models/app_user.rb", line 25, in conekta
  File "/app/app/models/cart.rb", line 24, in json_attributes
  File "/app/app/controllers/api/v1/carts_controller.rb", line 11, in index
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_controller/metal/basic_implicit_render.rb", line 4, in send_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb", line 186, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/scout_apm-2.4.3/lib/scout_apm/instruments/action_controller_rails_3_rails4.rb", line 72, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_controller/metal/rendering.rb", line 30, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb", line 20, in block in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb", line 108, in block in run_callbacks
  File "/app/vendor/bundle/ruby/2.5.0/gems/audited-4.6.0/lib/audited/sweeper.rb", line 14, in around
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb", line 117, in block in run_callbacks
  File "/app/vendor/bundle/ruby/2.5.0/gems/audited-4.6.0/lib/audited/sweeper.rb", line 14, in around
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb", line 117, in block in run_callbacks
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb", line 135, in run_callbacks
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/abstract_controller/callbacks.rb", line 19, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_controller/metal/rescue.rb", line 20, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb", line 32, in block in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb", line 166, in block in instrument
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/notifications/instrumenter.rb", line 21, in instrument
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/notifications.rb", line 166, in instrument
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_controller/metal/instrumentation.rb", line 30, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_controller/metal/params_wrapper.rb", line 252, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.1.4/lib/active_record/railties/controller_runtime.rb", line 22, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/scout_apm-2.4.3/lib/scout_apm/instruments/action_controller_rails_3_rails4.rb", line 83, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/abstract_controller/base.rb", line 124, in process
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb", line 189, in dispatch
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_controller/metal.rb", line 253, in dispatch
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb", line 49, in dispatch
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb", line 31, in serve
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb", line 50, in block in serve
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb", line 33, in each
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/journey/router.rb", line 33, in serve
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/routing/route_set.rb", line 834, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/scout_apm-2.4.3/lib/scout_apm/instruments/rails_router.rb", line 29, in call_with_scout_instruments
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/scout_apm-2.4.3/lib/scout_apm/middleware.rb", line 17, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/rack/agent_hooks.rb", line 30, in traced_call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/rack/browser_monitoring.rb", line 32, in traced_call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/warden-1.2.7/lib/warden/manager.rb", line 36, in block in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/warden-1.2.7/lib/warden/manager.rb", line 35, in catch
  File "/app/vendor/bundle/ruby/2.5.0/gems/warden-1.2.7/lib/warden/manager.rb", line 35, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/apartment-2.1.0/lib/apartment/elevators/generic.rb", line 21, in block in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/apartment-2.1.0/lib/apartment/adapters/abstract_adapter.rb", line 85, in switch
  File "/app/vendor/bundle/ruby/2.5.0/gems/apartment-2.1.0/lib/apartment/elevators/generic.rb", line 21, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/etag.rb", line 25, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/conditional_get.rb", line 25, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/head.rb", line 12, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb", line 232, in context
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/session/abstract/id.rb", line 226, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/cookies.rb", line 613, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb", line 26, in block in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/callbacks.rb", line 97, in run_callbacks
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/callbacks.rb", line 24, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rollbar-2.15.5/lib/rollbar/middleware/rails/rollbar.rb", line 24, in block in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rollbar-2.15.5/lib/rollbar.rb", line 145, in scoped
  File "/app/vendor/bundle/ruby/2.5.0/gems/rollbar-2.15.5/lib/rollbar/middleware/rails/rollbar.rb", line 22, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/debug_exceptions.rb", line 59, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rollbar-2.15.5/lib/rollbar/middleware/rails/show_exceptions.rb", line 22, in call_with_rollbar
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/show_exceptions.rb", line 31, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/rack/logger.rb", line 36, in call_app
  File "/app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/rack/logger.rb", line 24, in block in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/tagged_logging.rb", line 69, in block in tagged
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/tagged_logging.rb", line 26, in tagged
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/tagged_logging.rb", line 69, in tagged
  File "/app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/rack/logger.rb", line 24, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/remote_ip.rb", line 79, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/request_id.rb", line 25, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/method_override.rb", line 22, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/runtime.rb", line 22, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.1.4/lib/active_support/cache/strategy/local_cache_middleware.rb", line 27, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/executor.rb", line 12, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.1.4/lib/action_dispatch/middleware/static.rb", line 125, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.3/lib/rack/sendfile.rb", line 111, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/scout_apm-2.4.3/lib/scout_apm/instruments/middleware_summary.rb", line 58, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/railties-5.1.4/lib/rails/engine.rb", line 522, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/newrelic_rpm-4.7.1.340/lib/new_relic/agent/instrumentation/middleware_tracing.rb", line 92, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.11.2/lib/puma/configuration.rb", line 225, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.11.2/lib/puma/server.rb", line 624, in handle_request
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.11.2/lib/puma/server.rb", line 438, in process_client
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.11.2/lib/puma/server.rb", line 302, in block in run
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.11.2/lib/puma/thread_pool.rb", line 120, in block in spawn_thread

THANK YOU

Empty `shipping_lines` raises exception

Docs say that order's shipping_lines are optional here:
image
but, when I try to create an order without shipping_lines lib raises an exception:

image

Is there something I'm missing?

Can't Reproduce some errors

I can't reproduce this errors:

Numer | Token Id | Algo

| 4000000000000002 | tok_test_card_declined | card_declined, la tarjeta ha sido declinada
| 4000000000000127 | tok_test_insufficient_funds | insufficient_funds, el límite de crédito de la tarjeta ha sido excedido |

I'm getting this:

    Failure/Error: charge[:errors].should == "El límite de crédito de la tarjeta ha sido excedido"
       expected: "El límite de crédito de la tarjeta ha sido excedido"
            got: "Object tok_test_insufficient_funds could not be found." (using ==)
     # ./spec/models/payment.rb:74:in `block (2 levels) in <top (required)>'


     Failure/Error: charge[:errors].should == "La tarjeta ha sido declinada"
       expected: "La tarjeta ha sido declinada"
            got: "There was a runtime error and Conekta engineers have been notified." (using ==)

conekta_object.inspect is missing data

It seems that @values.inspect is not exhaustive.
If you do
customer.inspect

"{\"id\"=>\"cus_zNtuDyNVWAu6FqoKu\", \"email\"=>\"[email protected]\", \"name\"=>\"Juan\", \"phone\"=>\"12345\", \"livemode\"=>false, \"default_card_id\"=>\"card_G3sdsddsds\", \"object\"=>\"customer\", \"created_at\"=>1423507954, \"cards\"=>[{\"id\"=>\"card_G3sdsddsds\", \"created_at\"=>1423507954, \"active\"=>true, \"last4\"=>\"4242\", \"object\"=>\"card\", \"exp_month\"=>\"12\", \"exp_year\"=>\"19\", \"brand\"=>\"VISA\", \"name\"=>\"Jorge Lopez\", \"customer_id\"=>\"cus_zNtuDyNVWAu6FqoKu\"}], \"subscription\"=>nil}"

As shown by the docs. Please notice the last part, it has the card information.
But if you do
customer.values

{"id"=>"cus_zNtuDyNVWAu6FqoKu",
"email"=>"[email protected]",
"name"=>"Juan",
"phone"=>"12345",
"livemode"=>false,
"default_card_id"=>"card_G3jFzdh2rSupP2Do",
"object"=>"customer",
"created_at"=>1423507954,
"cards"=>{0=>{}},
"subscription"=>nil}

The cards information is missing, and looking at the implementation

https://github.com/conekta/conekta-ruby/blob/afce2f479ed1ccec74fe3e6e8c0a2a3a046c8e88/lib/conekta/conekta_object.rb#L34

It seems that

 @values.inspect 

Is the culprit.

This 'bug' forces me to do

eval customer.inspect

To access the card info, which is nasty.

Método de pago vacío.

Estoy siguiendo el tutorial que tienen en RUBY y solamente obtengo el error: "Método de pago vacío."

Después de declarar mi variable de instancia @charge, aparece el error de 'nil' para los valores @charge.amount y @charge.status. ¿que estoy haciendo mal?

Saludos.

NameError (uninitialized constant Conekta::ValidationError)

Hello i have a this error:
def action
require "conekta"
Conekta.locale = :es
Conekta.api_key = "ENV['PRIVATE_KEY_KONECTA']"

pago=OnlinePayment.create!(:empresa_id => current_empresa.id,:cantidad => params[:card][:cantidad],:active => true,:token_card => params[:token_pago],:pagado => false,:nombre => params[:card][:name])

pago.token_card="tok_test_visa_4242"

            charge = Conekta::Charge.create({
                amount: pago.cantidad,
                currency: "MXN",
                description: "Recompensa",
                reference_id: pago.id,
                card: pago.token_card, 
                details: {
                  email: "[email protected]"
                }
            })

            puts charge.to_s

    rescue Conekta::ValidationError => e
      puts e.message_to_purchaser 
    #some of the parameters were invalid
    rescue Conekta::ProcessingError => e
      puts e.message_to_purchaser 
    #the card could not be processed
    rescue Conekta::Error
      puts e.message_to_purchaser 

    rescue Exception => e
        puts e
        render :json => {:success => 0,:message => e.message}, :callback => params[:callback]
    end

end

Metodo de pago vacio on pago de tarjeta Conekta

Que tal tengo mi applicación Rails corriendo con Spree e integré las gemas de conekta, funciona todo bien excepto el pago con tarjeta, cualquier número que ponga de prueba me retorna, ¨Método de pago vació¨, y en los logs lo siguiente:

Error en la pasarela
--- !ruby/object:Spree::Conekta::Response
success: false
message: Empty payment method data.
params:
object: error
type: parameter_validation_error
message: Método de pago vacío.
message_to_purchaser: Método de pago vacío.
param: payment_method
code: invalid_payment_type
validation_error:
status:
source_method: !ruby/module 'Spree::Conekta::PaymentSource::Card'

Ayuda por fa vor.

Empty response... A JSON text must at least contain two octets!

Hi, we have some problems during Oxxo Conekta order create, it happens only sometimes it seems.
Here our request:

request_params = { "line_items": [ { "name": "Shipment ECOEXPRESS", "unit_price": 7334, "quantity": 1 } ], "shipping_lines": [ { "amount": 0, "carrier": "Redpack", "tracking_number": "U5UT96B1" } ], "currency": "MXN", "customer_info": { "name": "Client Name", "email": "[email protected]", "phone": "1122334455" }, "shipping_contact": { "phone": "1122334455", "receiver": "Receiver Name", "address": { "street1": "Kepler 195", "city": "Mexico", "state": "DF", "country": "MX", "postal_code": "11590", "residential": true } }, "charges": [ { "payment_method": { "type": "oxxo_cash" } } ], "metadata": { "enviaya_payment_id": 89854, "target_model": "Shipment", "target_id": 1359361, "model_amount": 69.95, "order_id": 81717 } }

conekta_order = Conekta::Order.create(request_params)

Then we get this error:

A JSON text must at least contain two octets!
"/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/gems/json-1.8.6/lib/json/common.rb:155:in initialize'", "/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/gems/json-1.8.6/lib/json/common.rb:155:in new'",
"/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/gems/json-1.8.6/lib/json/common.rb:155:in parse'", "/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/bundler/gems/conekta-ruby-f6028bc9800b/lib/conekta/requestor.rb:33:in request'", "/home/ubuntu/apps/enviaya/shared/bundle/ruby/2.4.0/bundler/gems/conekta-ruby-f6028bc9800b/lib/conekta/operations/create.rb:7:in create'"

So it seems response body is empty string, and we receive the error in JSON parse...

Conekta::ResourceNotFoundError while creating a customer

Hi.

I'm looking forward to implementing the gem into my project. I've been reading the tutorials at Conekta's page, and certainly I'm having a bad time trying to create objects (like customer or charges).

Here's the detail: I've installed the gem via Bundler, and I've already imported "conekta.js" into my view. In my controller, when I try to keep on doing the tutorial, I'm getting the error stated when it comes to create a customer... But it does not complain about the line "Conekta.api_key '' ".

Thanks in advance and sorry for the inconvenients. If you precise for more detailed info, let me know

Forma de especificar tipos de producto

A la hora de generar un cargo, ejemplo:

  def charge
    begin
      @charge = Conekta::Charge.create({
        amount: params['chargeInCents'],
        currency: "MXN",
        description: "Pizza Delivery at test",
        reference_id: "001-id-test",
        details:
        {
          email: params['emailBuyer'],
          line_items: [
            { name: 'Pizza at test',
              description: 'A pizza test description',
              unit_price: params['chargeInCents'],
              quantity: 1,
              sku: 'pizza-test',
              type: 'pizza'
            }
          ]
        },
        card: params['conektaTokenId']
      })
    rescue Conekta::ParameterValidationError => e
      puts e.message_to_purchaser
      #alguno de los parámetros fueron inválidos
    rescue Conekta::ProcessingError => e
      puts e.message_to_purchaser
      #la tarjeta no pudo ser procesada
    rescue Conekta::Error
      puts e.message_to_purchaser
      #un error ocurrió que no sucede en el flujo normal de cobros como por ejemplo un auth_key incorrecto
    end
  end

Tal y cómo esta especificado en la API de Conekta y en éste ejemplo.

El cargo es nil y no se crea.

En los mensajes (rescue) de Conekta, tira los siguientes errores en la consola:

  El campo de shipment es obligatorio para productos físicos.

Como si se estuviera generando un cargo de un producto físico por defecto.

¿Habrá manera de especificar en el objecto charge el tipo de producto a crear (productos físicos o digitales) de tal manera que ignore los parámetros cómo shipment para productos digitales?

NoMethodError while trying to find a charge that has a chargeback

When I try to find a charge that has a chargeback it throws this error:

Conekta::Charge.find payment.gateway_reference NoMethodError: undefined methodload_from' for #Chargeback:0x0055a5576c7cb0
from /home/deploy/chopeo/chopeo-store/shared/bundle/ruby/2.3.0/gems/activemodel-4.2.5/lib/active_model/attribute_methods.rb:433:in method_missing' from /home/deploy/chopeo/chopeo-store/shared/bundle/ruby/2.3.0/gems/conekta-0.5.6/lib/conekta/util.rb:37:in convert_to_conekta_object'
from /home/deploy/chopeo/chopeo-store/shared/bundle/ruby/2.3.0/gems/conekta-0.5.6/lib/conekta/conekta_object.rb:81:in load_from_enumerable' from /home/deploy/chopeo/chopeo-store/shared/bundle/ruby/2.3.0/gems/conekta-0.5.6/lib/conekta/conekta_object.rb:31:in block in load_from'
from /home/deploy/chopeo/chopeo-store/shared/bundle/ruby/2.3.0/gems/conekta-0.5.6/lib/conekta/conekta_object.rb:30:in each' from /home/deploy/chopeo/chopeo-store/shared/bundle/ruby/2.3.0/gems/conekta-0.5.6/lib/conekta/conekta_object.rb:30:in load_from'
from /home/deploy/chopeo/chopeo-store/shared/bundle/ruby/2.3.0/gems/conekta-0.5.6/lib/conekta/operations/find.rb:8:in find'

Looks like it tries to create a chargeback object which doesn't exist on conekta library

error in the documentation info

hiyas im trying to use the gem in the documentation say

# Set your configuration variables

# This change the Accept-Language Header to the locale specified
Conekta.locale = :es

Conekta.api_key = '1tv5yJp3xnVZ7eK67m4h'

# Or via an initializer in config/initializers/conekta.rb
Conekta.config do |c|
  c.locale = :es
  c.api_key = '1tv5yJp3xnVZ7eK67m4h'
  c.api_version = '1.0.0'
end

but it give this error

config/initializers/conekta.rb:6:in `<top (required)>': undefined method `config' for main:Object (NoMethodError)

i have already add the gem in my Gemfile and make bundle im using rails 4.1.5

What does amount_refunded field means?

Hi there, i am working on an implementation using your gem and i am testing refunds but i do not understand the meaning/behavior of the field amount_refunded.

Before to this refunds logs i created a new charge of 5000 MXN first. I used the latest 2.4.2 version.

2.6.3 :054 > order = Conekta::Order.find "ord_2nPKyqEbpdpNFQktQ"
 => {"livemode"=>false, "amount"=>5000, "currency"=>"MXN", "payment_status"=>"paid", "amount_refunded"=>0, "customer_info"=>{"email"=>"[email protected]", "name"=>"Jane Doe", "corporate"=>false, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "object"=>"customer_info"}, "object"=>"order", "id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{"reference"=>"cf568c12-a90c-41a9-bc7c-c4d04fad55a5"}, "created_at"=>1584738150, "updated_at"=>1584738150, "line_items"=>{0=>{"name"=>"A Test Payment", "unit_price"=>5000, "quantity"=>1, "object"=>"line_item", "id"=>"line_item_2nPKyqEbpdpNFQktN", "parent_id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{}, "antifraud_info"=>{}}}, "charges"=>{0=>{"id"=>"5e752f66431e7249b10eee0c", "livemode"=>false, "created_at"=>1584738150, "currency"=>"MXN", "payment_method"=>{"name"=>"Jane Doe", "exp_month"=>"10", "exp_year"=>"25", "auth_code"=>"882769", "object"=>"card_payment", "type"=>"credit", "last4"=>"5100", "brand"=>"mastercard", "issuer"=>"banorte", "account_type"=>"BANORTE", "country"=>"MX", "fraud_indicators"=>[]}, "object"=>"charge", "description"=>"Payment from order", "status"=>"paid", "amount"=>5000, "paid_at"=>1584738150, "fee"=>458, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "order_id"=>"ord_2nPKyqEbpdpNFQktQ"}}}

At this point we have a paid order of 5000MXN!


2.6.3 :055 > order.refund(reason: :requested_by_client, amount: "1000")
 => {"livemode"=>false, "amount"=>5000, "currency"=>"MXN", "payment_status"=>"partially_refunded", "amount_refunded"=>0, "customer_info"=>{"email"=>"[email protected]", "name"=>"Jane Doe", "corporate"=>false, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "object"=>"customer_info"}, "object"=>"order", "id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{"reference"=>"cf568c12-a90c-41a9-bc7c-c4d04fad55a5"}, "created_at"=>1584738150, "updated_at"=>1584738205, "line_items"=>{0=>{"name"=>"A Test Payment", "unit_price"=>5000, "quantity"=>1, "object"=>"line_item", "id"=>"line_item_2nPKyqEbpdpNFQktN", "parent_id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{}, "antifraud_info"=>{}}}, "charges"=>{0=>{"id"=>"5e752f66431e7249b10eee0c", "livemode"=>false, "created_at"=>1584738150, "currency"=>"MXN", "payment_method"=>{"name"=>"Jane Doe", "exp_month"=>"10", "exp_year"=>"25", "auth_code"=>"882769", "object"=>"card_payment", "type"=>"credit", "last4"=>"5100", "brand"=>"mastercard", "issuer"=>"banorte", "account_type"=>"BANORTE", "country"=>"MX", "fraud_indicators"=>[]}, "object"=>"charge", "description"=>"Payment from order", "status"=>"partially_refunded", "amount"=>5000, "paid_at"=>1584738150, "fee"=>458, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "order_id"=>"ord_2nPKyqEbpdpNFQktQ", "refunds"=>{0=>{"object"=>"refund", "amount"=>-1000, "auth_code"=>"882769", "id"=>"5e752f9d431e7256d50dd650", "created_at"=>1584738205}}}}}

At this point i refunded 1000 of 5000 MXN but amount_refunded is zero!

2.6.3 :056 > order = Conekta::Order.find "ord_2nPKyqEbpdpNFQktQ"
 => {"livemode"=>false, "amount"=>5000, "currency"=>"MXN", "payment_status"=>"partially_refunded", "amount_refunded"=>0, "customer_info"=>{"email"=>"[email protected]", "name"=>"Jane Doe", "corporate"=>false, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "object"=>"customer_info"}, "object"=>"order", "id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{"reference"=>"cf568c12-a90c-41a9-bc7c-c4d04fad55a5"}, "created_at"=>1584738150, "updated_at"=>1584738205, "line_items"=>{0=>{"name"=>"A Test Payment", "unit_price"=>5000, "quantity"=>1, "object"=>"line_item", "id"=>"line_item_2nPKyqEbpdpNFQktN", "parent_id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{}, "antifraud_info"=>{}}}, "charges"=>{0=>{"id"=>"5e752f66431e7249b10eee0c", "livemode"=>false, "created_at"=>1584738150, "currency"=>"MXN", "payment_method"=>{"name"=>"Jane Doe", "exp_month"=>"10", "exp_year"=>"25", "auth_code"=>"882769", "object"=>"card_payment", "type"=>"credit", "last4"=>"5100", "brand"=>"mastercard", "issuer"=>"banorte", "account_type"=>"BANORTE", "country"=>"MX", "fraud_indicators"=>[]}, "object"=>"charge", "description"=>"Payment from order", "status"=>"partially_refunded", "amount"=>5000, "paid_at"=>1584738150, "fee"=>458, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "order_id"=>"ord_2nPKyqEbpdpNFQktQ", "refunds"=>{0=>{"object"=>"refund", "amount"=>-1000, "auth_code"=>"882769", "id"=>"5e752f9d431e7256d50dd650", "created_at"=>1584738205}}}}} 

Here we did another refund of 1000 MXN but the order shows amount_refunded with 1000 MXN. At this point I already refunded 2000 of 5000 MXN. Do not understand why its returning amount_refunded=1000. 🤔

2.6.3 :057 > order.refund(reason: :requested_by_client, amount: "1000")
 => {"livemode"=>false, "amount"=>5000, "currency"=>"MXN", "payment_status"=>"partially_refunded", "amount_refunded"=>1000, "customer_info"=>{"email"=>"[email protected]", "name"=>"Jane Doe", "corporate"=>false, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "object"=>"customer_info"}, "object"=>"order", "id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{"reference"=>"cf568c12-a90c-41a9-bc7c-c4d04fad55a5"}, "created_at"=>1584738150, "updated_at"=>1584738230, "line_items"=>{0=>{"name"=>"A Test Payment", "unit_price"=>5000, "quantity"=>1, "object"=>"line_item", "id"=>"line_item_2nPKyqEbpdpNFQktN", "parent_id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{}, "antifraud_info"=>{}}}, "charges"=>{0=>{"id"=>"5e752f66431e7249b10eee0c", "livemode"=>false, "created_at"=>1584738150, "currency"=>"MXN", "payment_method"=>{"name"=>"Jane Doe", "exp_month"=>"10", "exp_year"=>"25", "auth_code"=>"882769", "object"=>"card_payment", "type"=>"credit", "last4"=>"5100", "brand"=>"mastercard", "issuer"=>"banorte", "account_type"=>"BANORTE", "country"=>"MX", "fraud_indicators"=>[]}, "object"=>"charge", "description"=>"Payment from order", "status"=>"partially_refunded", "amount"=>5000, "paid_at"=>1584738150, "fee"=>458, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "order_id"=>"ord_2nPKyqEbpdpNFQktQ", "refunds"=>{0=>{"object"=>"refund", "amount"=>-1000, "auth_code"=>"882769", "id"=>"5e752fb682c27237de8fa5c9", "created_at"=>1584738230}, 1=>{"object"=>"refund", "amount"=>-1000, "auth_code"=>"882769", "id"=>"5e752f9d431e7256d50dd650", "created_at"=>1584738205}}}}}

Re-fetching the order again to see if something has changed. But keeps the same!


2.6.3 :058 > order = Conekta::Order.find "ord_2nPKyqEbpdpNFQktQ"
 => {"livemode"=>false, "amount"=>5000, "currency"=>"MXN", "payment_status"=>"partially_refunded", "amount_refunded"=>1000, "customer_info"=>{"email"=>"[email protected]", "name"=>"Jane Doe", "corporate"=>false, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "object"=>"customer_info"}, "object"=>"order", "id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{"reference"=>"cf568c12-a90c-41a9-bc7c-c4d04fad55a5"}, "created_at"=>1584738150, "updated_at"=>1584738230, "line_items"=>{0=>{"name"=>"A Test Payment", "unit_price"=>5000, "quantity"=>1, "object"=>"line_item", "id"=>"line_item_2nPKyqEbpdpNFQktN", "parent_id"=>"ord_2nPKyqEbpdpNFQktQ", "metadata"=>{}, "antifraud_info"=>{}}}, "charges"=>{0=>{"id"=>"5e752f66431e7249b10eee0c", "livemode"=>false, "created_at"=>1584738150, "currency"=>"MXN", "payment_method"=>{"name"=>"Jane Doe", "exp_month"=>"10", "exp_year"=>"25", "auth_code"=>"882769", "object"=>"card_payment", "type"=>"credit", "last4"=>"5100", "brand"=>"mastercard", "issuer"=>"banorte", "account_type"=>"BANORTE", "country"=>"MX", "fraud_indicators"=>[]}, "object"=>"charge", "description"=>"Payment from order", "status"=>"partially_refunded", "amount"=>5000, "paid_at"=>1584738150, "fee"=>458, "customer_id"=>"cus_2nPGHDYf44CQYA4pj", "order_id"=>"ord_2nPKyqEbpdpNFQktQ", "refunds"=>{0=>{"object"=>"refund", "amount"=>-1000, "auth_code"=>"882769", "id"=>"5e752fb682c27237de8fa5c9", "created_at"=>1584738230}, 1=>{"object"=>"refund", "amount"=>-1000, "auth_code"=>"882769", "id"=>"5e752f9d431e7256d50dd650", "created_at"=>1584738205}}}}} 

Can you help me?

Thanks in advance!

Conekta does not find Address class

What happened was that I had a class named Address and sometimes after doing a transaction with conekta, conekta tried to use their methods in my ActiveRecord class, which is not possible, so the app breaks down. I had to rename my ActiveRecord class.

Empty hash when I try to assign a ConektaCard

When I execute user.cards, obviously users is an instances of Customer class, it returns:
{0=>{}}

When I execute for instance:
user.cards.each do |card| puts card[1] end
It prints
{"id"=>"card_snbfM58GGte58NWr", "created_at"=>1441068616, "active"=>true, "last4"=>"4242", "object"=>"card", "exp_month"=>"03", "exp_year"=>"19", "brand"=>"VISA", "name"=>"Pedro", "customer_id"=>"cus_im7DqkALerT7isuDR"}

then I try to assign or convert the hash to an array I get empty hash

cards_array = []
user.cards.each do |card| cards_array << card[1] end
cards_array

I get an empty hash for every card.
[{}]
This behaviour is intencional or is a bug?

Customer.find id case sensitive?

Hi!

It seems the Conekta::Customer.find(id) is case sensitive. Is this the expected behavior? If so, I think it should be stated somewhere, whether in the README or the API docs, and displaying the mixed case id in the Dashboard so to not force it to store it locally.

I'm trying to retrieve a Customer using the id from the Dashboard (all caps) and getting a Conekta::ResourceNotFoundError. However, after I create a new Customer and use the generated id (mixed lowercase and uppercase) the user it is correctly retrieved.

[27] pry(main)> customer.class
# => Conekta::Customer
[28] pry(main)> customer.inspect
# => "{\"id\"=>\"cus_dvQwvKokZFn95841d\", ... }"
[30] pry(main)> Conekta::Customer.find(customer.id).inspect
# => "{\"id\"=>\"cus_dvQwvKokZFn95841d\", ...}"
[31] pry(main)> Conekta::Customer.find(customer.id.upcase)
# => Conekta::ResourceNotFoundError: Object CUS_DVQWVKOKZFN95841D could not be found. from /Users/rene/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/conekta-0.4.3/lib/conekta/error.rb:38:in `error_handler'
[32] pry(main)> Conekta::Customer.find(customer.id.downcase)
# => Conekta::ResourceNotFoundError: Object cus_dvqwvkokzfn95841d could not be found. from /Users/rene/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/conekta-0.4.3/lib/conekta/error.rb:38:in `error_handler'

Metodo de pago vacio

Hola buenas tardes, tengo mi aplicacion en ruby on rails, segui el tutorial: https://www.conekta.io/es/docs/tutorial/pagos-con-tarjeta?vertical=productos-fisicos&js-language=coffeescript

pero al momento de llegar al pago me marca este error en consola:
image

y en los HTTPLogs:

{
"object": "error",
"type": "parameter_validation_error",
"message": "Empty payment method data.",
"message_to_purchaser": "Método de pago vacío.",
"param": "payment_method",
"code": "invalid_payment_type"
}

Error when calling Conekta::Charge.create: "Line items están vacíos."

I'm getting the error "Line items están vacíos." when calling Conekta::Charge.create.
The error happened in test and livemode, using version '0.5.7', which was working fine for several months, so I'm assuming it was due to some API changes. I'm using the default API version.

The object passed in test mode was:

{:amount=>150100, 
:currency=>"MXN",
 :description=>"Compra en mendi", 
:reference_id=>"139FD543", 
:details=>{:line_items=>[[{:name=>"Silla Madera", :description=>"Sin variante", :unit_price=>150000, :quantity=>1, :sku=>nil}]], 
:shipment=>{:carrier=>"Chile", :service=>"Chile", :price=>100, :address=>{:street1=>"23322332", :street2=>nil, :street3=>nil, :city=>"Cochrane", :state=>"Aisén del General Carlos Ibáñez del Campo", :zip=>nil, :country=>"Chile"}}, :name=>"Pablo Orellana", :email=>"[email protected]", :phone=>"123123123"}, 
:card=>"tok_2g5SjadcY7tjEYbxC"}

This totally broke our payments integration through Conekta.
Hopefully you can give me a hand with this soon.

undefined method `[]=' for nil:NilClass

Hi i have install conekta 2.0.0 from https://github.com/conekta/conekta-ruby.git (at v.2.1.0@caadd58) not give the 2.1.0 and it give that error using the example and get undefined method `[]=' for nil:NilClass or Conekta::ErrorList

Conekta::Order.create({
  :currency => "MXN",
  :customer_info => {
    :customer_id => "cus_zzmjKsnM9oacyCwV3"
  },
  :line_items => [{
    :name => "Box of Cohiba S1s",
    :unit_price => 35000,
    :quantity => 1
  }],
  :charges => [{
    :payment_method => {
      :type => "default"
    }
  }]
})

`create_payment_source` returns an incorrect payment_source

Issue
The method create_payment_source in Conekta::Customer model does not return the last created payment source.

I tried to create a payment source with this data:

{"card_number"=>"5105105105105100", "exp_month"=>"09", "exp_year"=>"30",  "name"=>"Juan"}

So, it should return:

{"id"=>"src_2tTg2mpQ7ufHk9d76", "object"=>"payment_source", "type"=>"card", "created_at"=>1677857763, "last4"=>"5100", "bin"=>"510510", "card_type"=>"credit", "exp_month"=>"09", "exp_year"=>"30", "brand"=>"mastercard", "name"=>"Juan", "parent_id"=>"cus_2tTQMFrxvgksf8qXw", "default"=>false, "payment_source_status"=>"active", "visible_on_checkout"=>false}

but instead returns:

{"id"=>"src_2tTSYGzyn72Nz6XKN", "object"=>"payment_source", "type"=>"card", "created_at"=>1677796288, "last4"=>"0005", "bin"=>"378282", "card_type"=>"credit", "exp_month"=>"09", "exp_year"=>"30", "brand"=>"american_express", "name"=>"Miguel", "parent_id"=>"cus_2tTQMFrxvgksf8qXw", "default"=>false, "payment_source_status"=>"active", "visible_on_checkout"=>false}

The first occurrence of the error was after upgrading to version 2.6.0

Error: The route requested does not exist on conekta hello-conekta-ruby-subscription

Hola, estoy recibiendo el mensaje Conekta::ResourceNotFoundError in CustomersController#update al utilizar el ejemplo de hello-conekta-ruby-subscription en el controlador Customers en la linea 30 customer.create_card(token: params["conektaTokenId"]), al agregar la tarjeta del customer con el Número de tarjeta: 5555555555554444, CVC 1234, Expiración 09/2022, dando en el botóm agregar tarjeta.

Me pueden ayudar a entender por que recibo ese mensaje?

Saludos!

uninitialized constant Conekta::ErrorList

Hi there,

When calling Conekta::Order.create() from a controller, if there is an error in the call, the rescue part crashes and throws in the following error:

uninitialized constant Conekta::ErrorList

Please help, thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.