Problemas con Integración webpay plus a través de "Transbank's Webpay protocol"

35 views
Skip to first unread message

Miguel Cantillana

unread,
Sep 21, 2015, 4:02:26 PM9/21/15
to PythonChile
Hola, estoy probando la biblioteca https://github.com/pedroburon/tbk para integrar webpay pero no logro hacerla funcionar. 

para levantar webpay realizo lo siguiente 
from tbk.webpay.commerce import Commerce
commerce
= Commerce(testing=True)

from tbk.webpay.logging import configure_logger
from tbk.webpay.logging.official import WebpayOfficialHandler
LOG_BASE_PATH
= '/tmp/'
configure_logger
(WebpayOfficialHandler(LOG_BASE_PATH))


from tbk.webpay.payment import Payment


payment
= Payment(
    request_ip
= request.META.get('REMOTE_ADDR', None), # customer request ip
    commerce
=commerce,
    success_url
='http://127.0.0.1:8080/payment/webpay/success/',
    confirmation_url
='http://127.0.0.1:8080/payment/webpay/callback/', # callback url with IP
    failure_url
='http://127.0.0.1:8080/payment/webpay/fail/',
    session_id
='%s' % str(order.id),
    amount
=10, # could be int, str or Decimal
    order_id
=order.id,
)
url
= payment.redirect_url


Y para confirmar el pago estoy realizando lo siguiente:

from tbk.webpay.commerce import Commerce
from tbk.webpay.confirmation import Confirmation


commerce
= Commerce(testing=True)  


confirmation
= Confirmation(
    commerce
=commerce,
    request_ip
=request.META.get('REMOTE_ADDR', None),
    data
=request.POST
)


if confirmation.is_success() :
   
return http.HttpResponse(commerce.acknowledge)


return http.HttpResponse(commerce.reject)


Para efectos de pruebas no estoy haciendo ninguna validación de monto y order_id. la IP local la cambio por la IP del servidor donde está la aplicación y los log que estoy generando no me dicen mucho. 

Alguien ha realizado esta integración antes? que estaré haciendo de forma incorrecta?

Saludos Cordiales.-

Roberto Moreno P.

unread,
Sep 21, 2015, 4:10:45 PM9/21/15
to pytho...@googlegroups.com
Miguel,

Te recomiendo probar mejor la integración por webservices es mucho mas
limpia que la del CKK

Saludos



Enviado con MailTrack

El día 21 de septiembre de 2015, 17:02, Miguel Cantillana
<mig...@ewok.cl> escribió:
> --
> --
> You received this message because you are subscribed to the Google
> Groups "PythonChile" group.
> To post to this group, send email to chile...@googlegroups.com
> To unsubscribe from this group, send email to
> chilepython...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/chilepython?hl=en?hl=es
> ---------------------------------------
> Web: http://www.pythonchile.cl
> Twitter: http://twitter.com/PythonChile
>
> ---
> Has recibido este mensaje porque estás suscrito al grupo "PythonChile" de
> Grupos de Google.
> Para anular la suscripción a este grupo y dejar de recibir sus mensajes,
> envía un correo electrónico a pythonchile...@googlegroups.com.
> Para acceder a más opciones, visita https://groups.google.com/d/optout.



--
Roberto Andrés Moreno Pérez
Reply all
Reply to author
Forward
0 new messages