Skip to main content

Unofficial TBK Web Services Python SDK

Project description

https://circleci.com/gh/cornershop/python-tbk/tree/master.svg?style=svg https://badge.fury.io/py/python-tbk.svg

Requirements

  • python: ~2.7, ^3.6

  • libxml2 >= 2.9.1

  • libxmlsec1 >= 1.2.14


🇬🇧

Installation

Just run:

$ pip install python-tbk

Usage

As simple as call (snakecased) webpay api methods:

>>> from tbk.services import WebpayService
>>> from tbk.commerce import Commerce
>>> from tbk import INTEGRACION
>>> commerce = Commerce(commerce_code, key_data, cert_data, tbk_cert_data, INTEGRACION)
>>> webpay = WebpayService(commerce)
>>> transaction = webpay.init_transaction(amount, buy_order, return_url, final_url)
>>> print(transaction['token'])
e87df74f7af4dcfdc1d17521b07413ff9a004a7b423dc47ad09f6a8166a73842

Conventions

This library use a snake cased naming convention for webservices and params for a more pythonic implementation. Every camelcased name in the webpay API was transformed to snakecase:

initTransaction(amount, buyOrder, returnURL, finalURL, sessionId)

became:

init_transaction(amount, buy_order, return_url, final_url, session_id)

Documentation

You can refer to http://www.transbankdevelopers.cl/?m=api for official API documentation. This library documentation is on the way.

Loggers

There are two levels of loggers:

tbk.services
tbk.soap

Specific service logger are defined by class name:

tbk.services.WebpayService

Bugs?

Issues are welcome at https://github.com/cornershop/python-tbk/issues

🇪🇸

Instalación

Ejecuta:

$ pip install python-tbk

Uso

Tan simple como llamar los métodos del API de Webpay (pero snakecased):

>>> from tbk.services import WebpayService
>>> from tbk.commerce import Commerce
>>> from tbk import INTEGRACION
>>> commerce = Commerce(commerce_code, key_data, cert_data, tbk_cert_data, INTEGRACION)
>>> webpay = WebpayService(commerce)
>>> transaction = webpay.init_transaction(amount, buy_order, return_url, final_url)
>>> print(transaction['token'])
e87df74f7af4dcfdc1d17521b07413ff9a004a7b423dc47ad09f6a8166a73842

Convenciones

La librería usa una convención de nombres snakecased para ser más pythonica. Cada nombre camelcased en el API de Webpay se transformó a snakecased:

initTransaction(amount, buyOrder, returnURL, finalURL, sessionId)

se traduce en:

init_transaction(amount, buy_order, return_url, final_url, session_id)

Documentación

La documentación oficial se encuentra disponible en http://www.transbankdevelopers.cl/?m=api. La documentación de esta librería está en desarrollo.

Loggers

Se encuentran definidos dos niveles de logger:

tbk.services
tbk.soap

El logger específico de un servicio está definido por su nombre de clase:

tbk.services.WebpayService

Testing cards / Tarjetas de prueba

Credit / Crédito

Marca

VISA

MASTERCARD

No de Tarjeta

4051885600446623

5186059559590568

Año Expiración

Cualquiera

Cualquiera

CVV

123

123

Resultado

APROBADO

RECHAZADO

Debit / Débito

APRUEBA

RECHAZA

TARJETA

4051885600446620

5186059559590560

RUT

11.111.111-1

11.111.111-1

PASSWORD

123

123

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-tbk-0.2.2.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

python_tbk-0.2.2-py2.py3-none-any.whl (15.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-tbk-0.2.2.tar.gz.

File metadata

  • Download URL: python-tbk-0.2.2.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.2 Darwin/18.7.0

File hashes

Hashes for python-tbk-0.2.2.tar.gz
Algorithm Hash digest
SHA256 da236e458696fc00614143bca27529bdf7e538c20d7870c6a9977f0ade4069b5
MD5 a23c18c3f96e623f83baa9fbebc037ff
BLAKE2b-256 29e83af96cf808f80cbd395be9dfde94abc2dbf401bdd76a932e5ef1bbc272a5

See more details on using hashes here.

File details

Details for the file python_tbk-0.2.2-py2.py3-none-any.whl.

File metadata

  • Download URL: python_tbk-0.2.2-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.2 Darwin/18.7.0

File hashes

Hashes for python_tbk-0.2.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6054f0fc5f7d3993083ed074f598b710d730328f93c398d330e6643dc70f9966
MD5 62669b07ec706702ff0846d62c08e95d
BLAKE2b-256 032e6682ac2d088cdf32cb77ff13e4b045e5671e7b85d80b2bc7ef5de4848132

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page