SDK de integracion para generador de ligas
Project description
SDK Pagos Online
SDK Pagos Online es un modulo python para facilitar la integracion al generador de ligas.
Instalación
Para compilar y dar mantenimiento al proyecto
pip install mitWppSdk
Uso
El modulo esta implementado para trabajar con Python 3.9 o superior.
Es importante observar que este modulo debe implementarse dentro de un ambiente seguro en donde la llave de cifrado no quede expuesta a terceros.
Se debe utilizar una instancia de la clase PaymentBuilder para capturar los datos proporcionados por MIT. Posteriormente, se crea una instancia de WppClient proporcionando el endpoint, identificador de pagos y llave de cifrado en hexadecimal
import mitWppSdk.builders as builders
from mitWppSdk.WppClient import WppClient
from datetime import date
from decimal import Decimal
def urlIsCreated(self):
bb = builders.PaymentBuilder().withBusiness().idBranch("BRNH").idCompany(
"CMPY").pwd("pwd").user("user1234").andParent().withUrl().reference("PYREF0001").amount(
Decimal(10.50)).clientEmail("mail@mail.com").expirationDate(date(2022, 9, 13)).moneda(
builders.MonedaType.MXN).promotions("C", "3").andParent().build()
client = WppClient( "https://sandboxpo.mit.com.mx/gen", "SNDBX123", "5DCC67393750523CD165F17E1EFADD21")
url = client.getUrlPayment(bb)
print(url)
urlIsCreated()
Webhook o Http Callback
El comercio debe exponer un http callback o URI endpoint que le permita conocer si el pago del cliente fue aprobado o declinado y aplicar la lógica correspondiente a su negocio.
Para descifrar el mensaje, se puede utilizar el método processAfterPaymentResponse de la clase WppClient
def afterPayment():
response = "otB4VyAtYh5bW4IeVhM30125kqfmzVxxDlFQRZHCUroq6e1MSISChhDstN1gKKnA%0D%0AOs%2Bdgr...";
payResponse = client.processAfterPaymentResponse(response);
print(payResponse["reference"])
afterPayment();
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mitWppSdk-0.0.3.tar.gz.
File metadata
- Download URL: mitWppSdk-0.0.3.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
537289f422f188d6489b8a34e2219af5ddaf56bf83dc75493811a8bb2c034a91
|
|
| MD5 |
1058bc34e7cc376854882214233d7b6f
|
|
| BLAKE2b-256 |
a67591571034022a3fabf4dcb306159590b38f481b2e250964cbe8a891d60986
|
File details
Details for the file mitWppSdk-0.0.3-py3-none-any.whl.
File metadata
- Download URL: mitWppSdk-0.0.3-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4efc47a315ef52212162698f4ba82234b01d1cbe21d2a085f03dcabb6aef539
|
|
| MD5 |
64008fac367daeaeaa9e4117b8ef0850
|
|
| BLAKE2b-256 |
c873733a7299027348ef13e68c8c4d6a9fdb2fd2a68f7cffca70b5f69675a9fc
|