# STP python3.6+ client library
[![test](https://github.com/cuenca-mx/stpmex-python/workflows/test/badge.svg)](https://github.com/cuenca-mx/stpmex-python/actions?query=workflow%3Atest)
[![codecov](https://codecov.io/gh/cuenca-mx/stpmex-python/branch/main/graph/badge.svg)](https://codecov.io/gh/cuenca-mx/stpmex-python)
[![PyPI](https://img.shields.io/pypi/v/stpmex.svg)](https://pypi.org/project/stpmex/)
[![Downloads](https://pepy.tech/badge/stpmex)](https://pepy.tech/project/stpmex)
Cliente para el servicio REST de STP
## Requerimientos
Python v3.6 o superior.
## Documentación de API
[General](https://stpmex.zendesk.com/hc/es) y
[WADL](https://demo.stpmex.com:7024/speiws/rest/application.wadl?metadata=true&detail=true)
## Instalación
```
pip install stpmex
```
## Correr pruebas
```
make venv
source venv/bin/activate
make test
```
## Uso básico
```python
import datetime as dt
from stpmex import Client
from stpmex.types import Pais
client = Client(
empresa='TU_EMPRESA',
priv_key='PKEY_CONTENIDO',
priv_key_passphrase='supersecret',
)
cuenta_persona_fisica = client.cuentas.alta(
nombre='Eduardo',
apellidoPaterno='Salvador',
apellidoMaterno='Hernández',
rfcCurp='SAHE800416HDFABC01',
cuenta='646180110400000007',
paisNacimiento=Pais.MX,
fechaNacimiento=dt.date(1980, 4, 14),
)
cuenta_persona_moral = client.cuentas_morales.alta(
nombre='LA TIENDITA DE LA ESQUINA SA DE CV',
cuenta='646180157036325892',
pais=Pais.MX,
fechaConstitucion=dt.date(2021, 1, 1),
rfcCurp='ABC200101AB0',
)
# Si deseas dar de alta una nueva clabe para la misma
# razón social, haces el mismo request sustituyendo `cuenta`
# con la nueva clabe
cuenta_persona_moral = client.cuentas_morales.alta(
nombre='LA TIENDITA DE LA ESQUINA SA DE CV',
cuenta='646180157036325832',
pais=Pais.MX,
fechaConstitucion=dt.date(2021, 1, 1),
rfcCurp='ABC200101AB0',
)
orden = client.ordenes.registra(
monto=1.2,
cuentaOrdenante=cuenta.cuenta,
nombreBeneficiario='Ricardo Sanchez',
cuentaBeneficiario='072691004495711499',
institucionContraparte='40072',
conceptoPago='Prueba',
)
# Saldo
saldo = client.saldos.consulta(cuenta='646456789123456789')
# Ordenes - enviadas
enviadas = client.ordenes.consulta_enviadas() # fecha_operacion es el día de hoy
# Ordenes - recibidas
recibidas = client.ordenes.consulta_recibidas(
fecha_operacion=dt.date(2020, 4, 20)
)
# Orden - consulta por clave rastreo
orden = client.ordenes.consulta_clave_rastreo(
claveRastreo='CR1234567890',
institucionOperante=90646,
fechaOperacion=dt.date(2020, 4, 20)
)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/cuenca-mx/stpmex-python",
"name": "stpmex",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Cuenca",
"author_email": "dev@cuenca.com",
"download_url": "https://files.pythonhosted.org/packages/8d/09/e1b0b2d3bd4cadb8e384ec3ee58f156f2a25e600ffd8427b06e63f966990/stpmex-3.15.1.tar.gz",
"platform": null,
"description": "# STP python3.6+ client library\n\n\n[![test](https://github.com/cuenca-mx/stpmex-python/workflows/test/badge.svg)](https://github.com/cuenca-mx/stpmex-python/actions?query=workflow%3Atest)\n[![codecov](https://codecov.io/gh/cuenca-mx/stpmex-python/branch/main/graph/badge.svg)](https://codecov.io/gh/cuenca-mx/stpmex-python)\n[![PyPI](https://img.shields.io/pypi/v/stpmex.svg)](https://pypi.org/project/stpmex/)\n[![Downloads](https://pepy.tech/badge/stpmex)](https://pepy.tech/project/stpmex)\n\nCliente para el servicio REST de STP\n\n\n## Requerimientos\n\nPython v3.6 o superior.\n\n## Documentaci\u00f3n de API\n\n[General](https://stpmex.zendesk.com/hc/es) y\n[WADL](https://demo.stpmex.com:7024/speiws/rest/application.wadl?metadata=true&detail=true)\n\n## Instalaci\u00f3n\n\n```\npip install stpmex\n```\n\n## Correr pruebas\n\n```\nmake venv\nsource venv/bin/activate\nmake test\n```\n\n## Uso b\u00e1sico\n\n```python\nimport datetime as dt\n\nfrom stpmex import Client\nfrom stpmex.types import Pais\n\nclient = Client(\n empresa='TU_EMPRESA',\n priv_key='PKEY_CONTENIDO',\n priv_key_passphrase='supersecret',\n)\n\ncuenta_persona_fisica = client.cuentas.alta(\n nombre='Eduardo',\n apellidoPaterno='Salvador',\n apellidoMaterno='Hern\u00e1ndez',\n rfcCurp='SAHE800416HDFABC01',\n cuenta='646180110400000007',\n paisNacimiento=Pais.MX,\n fechaNacimiento=dt.date(1980, 4, 14),\n)\n\n\ncuenta_persona_moral = client.cuentas_morales.alta(\n nombre='LA TIENDITA DE LA ESQUINA SA DE CV',\n cuenta='646180157036325892',\n pais=Pais.MX,\n fechaConstitucion=dt.date(2021, 1, 1),\n rfcCurp='ABC200101AB0',\n)\n\n# Si deseas dar de alta una nueva clabe para la misma \n# raz\u00f3n social, haces el mismo request sustituyendo `cuenta`\n# con la nueva clabe\ncuenta_persona_moral = client.cuentas_morales.alta(\n nombre='LA TIENDITA DE LA ESQUINA SA DE CV',\n cuenta='646180157036325832',\n pais=Pais.MX,\n fechaConstitucion=dt.date(2021, 1, 1),\n rfcCurp='ABC200101AB0',\n)\n\norden = client.ordenes.registra(\n monto=1.2,\n cuentaOrdenante=cuenta.cuenta,\n nombreBeneficiario='Ricardo Sanchez',\n cuentaBeneficiario='072691004495711499',\n institucionContraparte='40072',\n conceptoPago='Prueba',\n)\n\n# Saldo\nsaldo = client.saldos.consulta(cuenta='646456789123456789')\n\n# Ordenes - enviadas\nenviadas = client.ordenes.consulta_enviadas() # fecha_operacion es el d\u00eda de hoy\n\n# Ordenes - recibidas\nrecibidas = client.ordenes.consulta_recibidas(\n fecha_operacion=dt.date(2020, 4, 20)\n)\n\n# Orden - consulta por clave rastreo\norden = client.ordenes.consulta_clave_rastreo(\n claveRastreo='CR1234567890',\n institucionOperante=90646,\n fechaOperacion=dt.date(2020, 4, 20)\n)\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "Client library for stpmex.com",
"version": "3.15.1",
"project_urls": {
"Homepage": "https://github.com/cuenca-mx/stpmex-python"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c76e71066a57a9db2e7d63f030f8bd62c066a7d2424fbb4ef8b12c34afbe8dc5",
"md5": "6f144399b14e3cdf34fbbc41b737d0a3",
"sha256": "e7706456123b725b2d5a3f858a2f2738e006912536ba6980200a0c491cd8fc48"
},
"downloads": -1,
"filename": "stpmex-3.15.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6f144399b14e3cdf34fbbc41b737d0a3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 29196,
"upload_time": "2023-12-27T22:11:44",
"upload_time_iso_8601": "2023-12-27T22:11:44.742463Z",
"url": "https://files.pythonhosted.org/packages/c7/6e/71066a57a9db2e7d63f030f8bd62c066a7d2424fbb4ef8b12c34afbe8dc5/stpmex-3.15.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8d09e1b0b2d3bd4cadb8e384ec3ee58f156f2a25e600ffd8427b06e63f966990",
"md5": "666d0fb05bc7b3cd34e0c068c722766a",
"sha256": "7e974f130ba4860208711d5123d1cc97dd4972650a4a87379ab3410c5712e28e"
},
"downloads": -1,
"filename": "stpmex-3.15.1.tar.gz",
"has_sig": false,
"md5_digest": "666d0fb05bc7b3cd34e0c068c722766a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 25236,
"upload_time": "2023-12-27T22:11:47",
"upload_time_iso_8601": "2023-12-27T22:11:47.273763Z",
"url": "https://files.pythonhosted.org/packages/8d/09/e1b0b2d3bd4cadb8e384ec3ee58f156f2a25e600ffd8427b06e63f966990/stpmex-3.15.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-27 22:11:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cuenca-mx",
"github_project": "stpmex-python",
"github_not_found": true,
"lcname": "stpmex"
}