Metadata-Version: 2.4
Name: courier-fraud-checker-bd
Version: 0.1.1
Summary: Fraud detection tool for e-commerce platforms to analyze customer order behavior across Bangladeshi couriers (Pathao, Steadfast, RedX).
Project-URL: Homepage, https://github.com/Raju-H/courier-fraud-checker-bd
Author: Raju H
License-Expression: GPL-3.0-only
License-File: LICENSE
Keywords: bangladesh,courier,delivery tracking,e-commerce,fraud detection,fraud prevention,order verification,pathao,redx,steadfast
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: requests>=2.28.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: responses>=0.23.0; extra == 'dev'
Description-Content-Type: text/markdown

# Courier Fraud Checker BD

A fraud detection tool for e-commerce platforms to analyze customer order behavior across Bangladeshi courier services — **Pathao**, **Steadfast**, and **RedX**.

Check a customer's delivery history (successful deliveries vs. cancellations) to identify potential fraud patterns before accepting orders.

## Installation

```bash
pip install courier-fraud-checker-bd
```

## Configuration

Set the following environment variables (or create a `.env` file):

```env
PATHAO_USER=your_pathao_username
PATHAO_PASSWORD=your_pathao_password
STEADFAST_USER=your_steadfast_email
STEADFAST_PASSWORD=your_steadfast_password
REDX_PHONE=your_redx_phone
REDX_PASSWORD=your_redx_password
```

## Usage

### Check all couriers at once

```python
from courier_fraud_checker_bd import CourierFraudChecker

checker = CourierFraudChecker()
result = checker.check("01712345678")
print(result)
# {
#     "steadfast": {"success": 15, "cancel": 2, "total": 17},
#     "pathao": {"success": 8, "cancel": 1, "total": 9},
#     "redx": {"success": 5, "cancel": 0, "total": 5},
# }
```

### Check a single courier

```python
result = checker.check_pathao("01712345678")
result = checker.check_steadfast("01712345678")
result = checker.check_redx("01712345678")
```

### Pass credentials directly

```python
checker = CourierFraudChecker(config={
    "pathao": {"user": "your_username", "password": "your_password"},
    "steadfast": {"user": "your_email", "password": "your_password"},
    "redx": {"phone": "01XXXXXXXXX", "password": "your_password"},
})
```

### Use individual services

```python
from courier_fraud_checker_bd.services import PathaoService, SteadfastService, RedxService

pathao = PathaoService(username="...", password="...")
result = pathao.check("01712345678")

steadfast = SteadfastService(email="...", password="...")
result = steadfast.check("01712345678")

redx = RedxService(phone="01XXXXXXXXX", password="...")
result = redx.check("01712345678")
```

### Quick one-liner

```python
from courier_fraud_checker_bd import check

result = check("01712345678")
```

## Response Format

Each courier returns the same structure:

```python
{
    "success": 15,   # Successful deliveries
    "cancel": 2,     # Cancelled/failed deliveries
    "total": 17      # Total deliveries
}
```

On error, the dict will contain an `"error"` key with a message:

```python
{"error": "Failed to authenticate with Pathao"}
```

## Phone Number Format

Phone numbers must be in local Bangladeshi format: 11 digits starting with `01`.

- Valid: `01712345678`
- Invalid: `+8801712345678`, `1712345678`

## License

GPL-3.0
