Skip to main content

An Azul Webservices light wrapper for Python.

Project description

Build & publish

pyazul

Consulta esta wiki para saber más sobre AZUL Webservices.

Instalación

  1. Instala pypi.
  2. $ 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


Download files

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

Source Distribution

pyazul-1.1.0.tar.gz (47.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyazul-1.1.0-py3-none-any.whl (41.7 kB view details)

Uploaded Python 3

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

Hashes for pyazul-1.1.0.tar.gz
Algorithm Hash digest
SHA256 c1b5b02da5a6acb983d9b042c195086c14731e3fe5518956cad3756713e06145
MD5 74e69f7a415feaa37e2e905c8e8bdea2
BLAKE2b-256 f57669cecf723a68ae7d85596ed25a82e9c96402ce23fb4a5a4d1efa4c337d89

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyazul-1.1.0.tar.gz:

Publisher: cd.yaml on indexa-git/pyazul

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for pyazul-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e1f89d6e07eb79fd9c76781711cad5a319578822f93aec120271c0c025365d07
MD5 cdb0e43cbd657ebb27426a6275e49298
BLAKE2b-256 98b37c9184fda3e3f5a729142c92da216ee532198461360d39f2c2062bf8cb8c

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyazul-1.1.0-py3-none-any.whl:

Publisher: cd.yaml on indexa-git/pyazul

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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