Skip to main content

Juno Python

Project description

Juno Python Library

PyPI version

The Juno Python library provides integration access to the Juno Gateway.

Installing

This lib can be found on pip. To install it, use:

$ pip install juno-python

Documentation

Quick Start Example

import juno

juno.init(
    client_id="CLIENT_ID_JUNO",
    client_secret="CLIENT_SECRET_JUNO",
    resource_token="RESOURCE_TOKEN_JUNO",
    sandbox=False,
)

result_charge = juno.charge.create(
    {
        "charge": {
            "description": "Description",
            "amount": "100.00",
            "references": [""],
            "payment_types": ["CREDIT_CARD"],
        },
        "billing": {
            "name": "Name Test",
            "document": "00000000000",  # Add a valid CPF
        },
    }
)

if result_charge.is_success:
    result_payment = juno.payment.create(
        {
            "charge_id": result_charge.charge.id,
            "billing": {
                "email": "name@test.com",  # Add a valid email
                "address": {  # Add a valid address
                    "street": "",
                    "number": "",
                    "complement": "",
                    "neighborhood": "",
                    "city": "",
                    "state": "",
                    "post_code": "",
                },
                "delayed": False,  # for capture delayed, use: "delayed": True
            },
            # if card is attached: "credit_card_details": {"credit_card_id": "id"}
            "credit_card_details": {"credit_card_hash": "hash"},
        }
    )

    if result_payment.is_success:
        print(f"Success payment: {result_payment.payment.id}")
    else:
        print(result_payment.errors)
else:
    print(result_charge.errors)

List Charges

response = juno.charge.find_all(
    query_params={
        "created_on_start": "2022-02-13", "created_on_end": "2022-02-14", "order_asc": False
    }
)

# You can pass the argument with keyword or not
# ... charge.find_all({"created_on_start": "2022-02-13", ...})

for charge in response.charges:
    print(charge)

Detail Charge

response = juno.charge.find_by_id("chr_1EECDF55648943D78BDFC6D852E19266")
print(response.charge)

Cancel Charge

response = juno.charge.cancelation("chr_1EECDF55648943D78BDFC6D852E19266")
print(response)

Capture Delayed

# ...
juno.payment.capture(result_payment.payment.id, {"charge_id": result_charge.charge.id})

Partial Capture Delayed

# ...
juno.payment.capture(result_payment.payment.id, {"charge_id": result_charge.charge.id, "amount": "100.00"})

Refund Payment

response = juno.payment.refund("pay_879D6006555C3309E4504C63B743BF59")
print(response)

Partial Refund Payment

response = juno.payment.refund("pay_879D6006555C3309E4504C63B743BF59", {"amount": "10.00"})
print(response)

Support

If you have any problem or suggestion please open an issue here.

License

Check here.

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

juno-python-0.4.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

juno_python-0.4.1-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file juno-python-0.4.1.tar.gz.

File metadata

  • Download URL: juno-python-0.4.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

File hashes

Hashes for juno-python-0.4.1.tar.gz
Algorithm Hash digest
SHA256 1c6d15d11fe30d3b7362f5f718085eeea218d8988ecc65ee37a39ba579a11f15
MD5 7c7831e252ed8b73afbffe9598305495
BLAKE2b-256 c5dfd2a08a1d027683976e8eea8665e691c39dc821fc1b643f4121966c1fa982

See more details on using hashes here.

File details

Details for the file juno_python-0.4.1-py3-none-any.whl.

File metadata

  • Download URL: juno_python-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 18.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

File hashes

Hashes for juno_python-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3b2bbc5d78f8f2f82858a0c368691b936610a28236e1cd03764fa8f5a1ed62ab
MD5 c9974bbff271c589217442e36179222f
BLAKE2b-256 32ab3f614a74392bb0ff55436d3700b555b229428c47dc18a25f516a6e4e4c98

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