Metadata-Version: 2.4
Name: epoint-az
Version: 0.1.0
Summary: Small Python client for E-Point payment checkout, callbacks, refunds, and bank response codes.
Author: Sirinlik
License-Expression: MIT
License-File: LICENSE
Keywords: azerbaijan,checkout,epoint,payments
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.10
Requires-Dist: requests>=2.31
Description-Content-Type: text/markdown

# epoint-az

Small Python client for E-Point checkout flows.

It handles:

- E-Point `data` base64 encoding
- SHA1 signature generation and verification
- normal checkout requests
- card registration with pay
- saved card execute-pay
- wallet and token widget payment requests
- reverse/refund requests
- callback verification and decoding
- bank response code lookup

## Install

```bash
pip install epoint-az
```

For local development from this repository:

```bash
cd packages/epoint-az
python -m pip install -e .
```

## Checkout

```python
from epoint_az import EPointClient

client = EPointClient(
    public_key="your-public-key",
    private_key="your-private-key",
)

response = client.checkout(
    order_id="order-1001",
    amount="12.50",
    currency="AZN",
    description="Order #1001",
    success_redirect_url="https://example.com/payment/success",
    error_redirect_url="https://example.com/payment/error",
    result_url="https://api.example.com/payment/result",
)

if response.ok and response.redirect_url:
    print(response.redirect_url)
else:
    print(response.body)
```

## Callback Verification

```python
from epoint_az import EPointClient, EPointSignatureError

client = EPointClient(public_key="public", private_key="private")

try:
    callback = client.parse_callback(
        data=request.POST["data"],
        signature=request.POST["signature"],
    )
except EPointSignatureError:
    return "OK"

if callback.success:
    print(callback.order_id, callback.transaction, callback.bank_code)
else:
    print(callback.order_id, callback.status, callback.bank_message)
```

## Bank Codes

```python
from epoint_az import describe_bank_code, is_approved_bank_code

assert is_approved_bank_code("000")
assert describe_bank_code("116") == "Decline, insufficient funds"
```

## Signed Payload Only

If your framework already owns HTTP calls, use the signer directly:

```python
signed = client.encode_payload({"public_key": "public", "order_id": "1"})
requests.post(url, data=signed.as_form())
```
