Giter VIP home page Giter VIP logo

openpay-python's People

Contributors

carloshepe avatar darkaz avatar darkness51 avatar igrijalva avatar marcoqrtcpip avatar marcosalvarado avatar marcosvzqopenpay avatar

Stargazers

 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

openpay-python's Issues

3D Secure

Hola. Estaba revisando la librería pero no veo alguna forma de usar 3d Secure. O si la hay cómo sería?, porque tampoco la encuentro en la documentación

Refund method

There is a problem in the refund method, as the parameter "merchant" is optional, the line 439 in resources.py is trying to delete the key even if there is no a parameter with that name.

  • del params['merchant']

So, I had to always sent the "merchant" as a parameter to avoid the error, making the refund always as merchant=True.

Comparing with the function "capture", that line must be inside the previous if

Cheers.
seleccion_170

Create card from client side generated token

Hola!

Estoy haciendo la integración de openpay con una aplicación creada en react en el client side y utilizo django para el back.

Estoy siguiendo la ruta marcada de OpenPay.js; de crear una tarjeta sin que pase por el servidor usando tokens, sin embargo, en ningún lugar de la documentación viene como asignar una tarjeta creada en el cliente side a través del método:

# Uso window porque es React.
window.OpenPay.token.create(
        {
          card_number: card,
          holder_name: state.ccName,
          expiration_year: expYear,
          expiration_month: expMonth,
          cvv2: cvc,
......etc

El token generado lo estoy pasando al back pero a la hora querer ejecutar algo similar a:
customer.cards.create(token)

Me da un error.
Vi que en esta sección había un método con node para crear una tarjeta siguiendo estos pasos:

var cardRequest = {
  'token_id' : 'tokgslwpdcrkhlgxqi9a',
  'device_session_id' : '8VIoXj0hN5dswYHQ9X1mVCiB72M7FY9o'
}

openpay.customers.cards.create('a9pvykxz4g5rg0fplze0', cardRequest, function(error, card)  {
  // ...
});

Sin embargo, no me fue posible crear una tarjeta en un cliente resultadon en el siguiente error:

>>> card_request = {
... 'device_session_id': device,
... 'token_id':token,
... }
>>> openpay.customers.cards.create(customer_id, card_request)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
AttributeError: module 'openpay' has no attribute 'customers'

Ni de esta manera:

>>> customer.cards.create(card_request)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
TypeError: create() takes 1 positional argument but 2 were given

Tambien intenté de esta forma

>>> token = "xxxxxx"
>>> device = "zxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
>>> from django.conf import settings
>>> openpay = settings.OPENPAY
>>> customer = openpay.Customer.retrieve('ayp7zw9xrp1gx05jjvje')
>>> card = {
... 'source_id':token,
... 'device_session_id': device
... }
>>> new_card = customer.cards.create(card=card)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/xxxxxxxxxxxxxxxxx", line 237, in create
    return self.request('post', self['url'], params)
  File "/hxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", line 142, in request
    response, api_key = requestor.request(method, url, params)
  File "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, line 75, in request
    resp = self.interpret_response(rbody, rcode)
  File "xxxxxxxxxxxxxxxxxxxxxxxxxxx", line 181, in interpret_response
    self.handle_api_error(rbody, rcode, resp)
  File "xxxxxxxxxxxxxxxxxxxxxx", line 84, in handle_api_error
    raise error.InvalidRequestError(
openpay.error.InvalidRequestError: holder_name is required, card_number is required, expiration_month is required, error code: 1001

La única manera en la que he podido hacerlo es con un request derecho:

headers = {'Content-type': 'application/json'}
        data = {
            'token_id': token_id,
            'device_session_id': device_session_id
        }
        url = (
            f'https://sandbox-api.openpay.mx/v1/\
                {merchant_id}/customers/{customer.id}/cards'
        )
        new_card = requests.post(
            url, headers=headers, json=data, auth=(api_key, ''))

Como generar device_session_id

Hola, estoy creando un API interno para manejar los cobros usando OpenPay vía Python, pero no queda claro como generar el device_session_id desde un backend.

gracias.

Can't delete bank account

I can't delete bank account, this is my in python code:

account = customer.back_accounts.retrieve("someID")
account.delete()

it gives me this error:

Request method 'DELETE' not supported, error code: 1000

I can delete customers and cards without any problems. Deleting bank accounts is supported by the API:

http://www.openpay.mx/docs/api/?shell#eliminar-una-cuenta-bancaria

but is not working with this python client

thanks in advance

Create charges for stores

Hola, quiero consultar sobre cómo realizar pagos en tiendas. Según el flujo entiendo que primero el cliente debe seleccionar una tienda (cuál es el método o en todo caso endpoint para obtener las tiendas?) y luego crear un "charge" de tipo "store" . Ahora cómo se asocia la tienda seleccionada al store? Gracias.

agregar tarjeta al customer mediante token

hola buen dia , viendo la documentación no veo la manera en la cual se pueda agregar la tarjeta a un customer mediante el token de la tarjeta esto para el registro de tarjeta mediante dispositivos moviles. podrian proporcionarme un ejemplo de como hacerlo, o actualizar su documentación para estos casos en php lo realice mediante un add pero este ejemplo similar no lo veo aqui . Ya que estoy usando python como servicio web para mis aplicaciones.
Captura de Pantalla 2020-12-03 a la(s) 11 34 05

Error en documentación

Al usar la instrucción

subscription = customer.subscriptions.all()[0]
subscription.delete()

arroja un error KeyError 0
Lo cambié a

subscriptions = customer.subscriptions.all()
     subscription = subscriptions['data'][0]
     subscription.delete()

Y funcionó

Bad endpoint when creating charges

Hi.

As official docs refer, you can create a charge on

  1. "/{MERCHANT_ID}/charges"
    or
  2. "/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges"

When you send the "customer" parameter to the create method of the charge resource, the URL must be the first one, not the second one.

Error here:
if params and 'customer' in list(params.keys()):
return "/v1/{0}/customers/{1}/{2}s".format(
merchant_id, params.get('customer'), cls_name)
else:
return "/v1/%s/%ss" % (merchant_id, cls_name)

Fix:
if params and 'customer' in list(params.keys()):
return "/v1/%s/%ss" % (merchant_id, cls_name)
else:
return "/v1/{0}/customers/{1}/{2}s".format(
merchant_id, params.get('customer'), cls_name)

'future' dependency update

Hi,

As far as I can see openpay library specifically requires version 0.15.2 of "future" package that was released back in 2015.
https://pypi.org/project/future/#history

There were several newer version released for this library since that time. Now I'm trying to solve dependency conflict in my project with openpay and several other packages requesting different "future" versions.

Could you please update openpay not to require specific version of "future" but accept 0.15.2, 0.16.0, 0.17.0 and 0.17.1?

Remover use_2to3 de setup.py

use_2to3 fue removido de setuptools hace unas versiones y nuevos buildpacks de python están fallando. La referencia a esta librería debería de ser removida.

charges as customer

Hola @marcosAlvarado,

Gracias por actualizar la documentación. Era muy necesario desde hace tiempo.
Tengo una duda con respecto al ejemplo de charges. Incluiste un ejemplo de cómo generar un charge a nivel merchant (comercio). Si no me equivoco, la única diferencia para crear el charge a nivel de cliente sería que debemos pasar el String customer_id a la hora de crear el charge, correcto?
La sintaxis sería la siguiente?
charge = openpay.Charge.create_as_customer( source_id="k2trvya1nxpcytgww4rt", customer_id="cz4nkhrlcu9k7qd4lwqx", method="card", amount=100, description="Fourth charge", )
Saludos,

Problems detected

Hi there!! I am sorry for bothering you, but I have been using your library for a while and I have detected multiple problems and details. I'll just write you a list of the problems I have detected in hopes that you (or maybe another contributor) can read it and use it.

General

  • There is no method to create a device_session_id to execute some actions. Apparently the concept of device_session_id was introduced thanks to the javascript version of this project and this python library was never updated to use the SJCL library for an antifraud feature.

Charges

  • The create function does not longer work like in the examples. It now requires another parameter: device_session_id.
  • The capture function does not longer work. The API replies with a 1005 code error. I do not know what the real problem is, but if I had to guess, it would be that while in Sandbox mode the API does not search for the transactions as expected. (No documentation text supports this idea)
  • The refund function has an error due to a del out of place (instead of being in line 439 it should be right after the 436 inside the if clause). A work around is to always send the boolean parameter merchant
  • The refund function is having the exact same problem as the capture function (described two bullets up)

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.