An Azul Webservices light wrapper for Python.
Project description
pyazul
Consulta esta wiki para saber más sobre AZUL Webservices.
Instalación
- Instala pypi.
$ pip install pyazul
Sale
from pyazul import AzulAPI
def sample_sale():
auth1 = 'testcert2' # primer auth factor (se obtiene de Azul)
auth2 = 'testcert2' # segundo auth factor (se obtiene de Azul)
certificate_path = 'certificate.pem'
environment = 'prod' # defaults 'dev'
pyazul = AzulAPI(auth1, auth2, certificate_path)
params = {
"Channel": "EC",
"Store": "37094649930",
"CardNumber": "",
"Expiration": "",
"CVC": "",
"PosInputMode": "E-Commerce",
"Amount": "12",
"CurrencyPosCode": "$",
"RNN": "null",
"CustomerServicePhone": "809-111-2222",
"OrderNumber": "SO039-2",
"ECommerceUrl": "azul.iterativo.do",
"CustomOrderId": "53",
"DataVaultToken": "74EAA676-FB9A-49E3-82CD-485DF85ECB61",
"ForceNo3DS": "1",
"SaveToDataVault": "0"
}
response = pyazul.sale_transaction(params)
Void
from pyazul import AzulAPI
def sample_void():
auth1 = 'testcert2' # primer auth factor (se obtiene de Azul)
auth2 = 'testcert2' # segundo auth factor (se obtiene de Azul)
certificate_path = 'certificate.pem'
environment = 'prod' # defaults 'dev'
pyazul = AzulAPI(auth1, auth2, certificate_path)
params = {
"Channel":"EC",
"Store":"37094649930",
"AzulOrderId": 27917,
}
response = pyazul.void_transaction(params)
Refund
from pyazul import AzulAPI
def sample_refund():
auth1 = 'testcert2' # primer auth factor (se obtiene de Azul)
auth2 = 'testcert2' # segundo auth factor (se obtiene de Azul)
certificate_path = 'certificate.pem'
environment = 'prod' # defaults 'dev'
pyazul = AzulAPI(auth1, auth2, certificate_path)
params = {
"Channel":"EC",
"Store":"37094649930",
"PosInputMode":"E-Commerce",
"Amount":"30000",
"Itbis":"2800",
"CurrencyPosCode":"$",
"OriginalDate":"20191217",
"OriginalTrxTicketNr":"",
"AuthorizationCode":"",
"ResponseCode":"",
"AcquirerRefData":"",
"RRN":"null",
"AzulOrderId":40208,
"CustomerServicePhone":"",
"OrderNumber":"",
"ECommerceUrl":"www.Google.com",
"CustomOrderId":"",
"DataVaultToken":"",
"SaveToDataVault":"0",
"ForceNo3DS":""
}
response = pyazul.refund_transaction(params)
Async support
Pyazul tambien es compatible con operaciones asíncronas de la siguiente manera:
import asyncio
# Import the Async module
from pyazul import AzulAPIAsync
# Make sure your function is async
async def sample_sale():
auth1 = 'testcert2' # primer auth factor (se obtiene de Azul)
auth2 = 'testcert2' # segundo auth factor (se obtiene de Azul)
certificate_path = 'certificate.pem'
environment = 'prod' # defaults 'dev'
pyazul = AzulAPIAsync(auth1, auth2, certificate_path)
params = {
"Channel": "EC",
"Store": "37094649930",
"CardNumber": "",
"Expiration": "",
"CVC": "",
"PosInputMode": "E-Commerce",
"Amount": "12",
"CurrencyPosCode": "$",
"RNN": "null",
"CustomerServicePhone": "809-111-2222",
"OrderNumber": "SO039-2",
"ECommerceUrl": "azul.iterativo.do",
"CustomOrderId": "53",
"DataVaultToken": "74EAA676-FB9A-49E3-82CD-485DF85ECB61",
"ForceNo3DS": "1",
"SaveToDataVault": "0"
}
response = await pyazul.sale_transaction(params)
# Test with asynccio
if __name__ == "__main__":
asyncio.run(sample_sale())
© LGPL 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 pyazul-1.1.0.tar.gz.
File metadata
- Download URL: pyazul-1.1.0.tar.gz
- Upload date:
- Size: 47.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1b5b02da5a6acb983d9b042c195086c14731e3fe5518956cad3756713e06145
|
|
| MD5 |
74e69f7a415feaa37e2e905c8e8bdea2
|
|
| BLAKE2b-256 |
f57669cecf723a68ae7d85596ed25a82e9c96402ce23fb4a5a4d1efa4c337d89
|
Provenance
The following attestation bundles were made for pyazul-1.1.0.tar.gz:
Publisher:
cd.yaml on indexa-git/pyazul
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyazul-1.1.0.tar.gz -
Subject digest:
c1b5b02da5a6acb983d9b042c195086c14731e3fe5518956cad3756713e06145 - Sigstore transparency entry: 207578651
- Sigstore integration time:
-
Permalink:
indexa-git/pyazul@f2af7600bc460a7ee20b33726e0fbe4801e0fb75 -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/indexa-git
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yaml@f2af7600bc460a7ee20b33726e0fbe4801e0fb75 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pyazul-1.1.0-py3-none-any.whl.
File metadata
- Download URL: pyazul-1.1.0-py3-none-any.whl
- Upload date:
- Size: 41.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1f89d6e07eb79fd9c76781711cad5a319578822f93aec120271c0c025365d07
|
|
| MD5 |
cdb0e43cbd657ebb27426a6275e49298
|
|
| BLAKE2b-256 |
98b37c9184fda3e3f5a729142c92da216ee532198461360d39f2c2062bf8cb8c
|
Provenance
The following attestation bundles were made for pyazul-1.1.0-py3-none-any.whl:
Publisher:
cd.yaml on indexa-git/pyazul
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyazul-1.1.0-py3-none-any.whl -
Subject digest:
e1f89d6e07eb79fd9c76781711cad5a319578822f93aec120271c0c025365d07 - Sigstore transparency entry: 207578656
- Sigstore integration time:
-
Permalink:
indexa-git/pyazul@f2af7600bc460a7ee20b33726e0fbe4801e0fb75 -
Branch / Tag:
refs/tags/1.1.0 - Owner: https://github.com/indexa-git
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yaml@f2af7600bc460a7ee20b33726e0fbe4801e0fb75 -
Trigger Event:
release
-
Statement type: