Skip to content

Python upgrade#1

Merged
srugano merged 3 commits into
developfrom
feature/pythonupgrade
Jul 23, 2026
Merged

Python upgrade#1
srugano merged 3 commits into
developfrom
feature/pythonupgrade

Conversation

@srugano

@srugano srugano commented Jul 23, 2026

Copy link
Copy Markdown
Owner

PayDunya Python Client — Complete Modernization

Complete modernization of the PayDunya Python client: new packaging, tooling, and full coverage of the officially documented APIs (PAR, PER, DMP, IPN), with Pydantic v2 validation.


Changes

🏗️ Packaging & Tooling

  • Migrated to src/ layout with hatchling build backend (PEP 621)
  • Python ≥ 3.10 required; dropped Python 2 legacy
  • Replaced requestshttpx, flake8ruff, Travis CI → GitHub Actions
  • Added uv (lockfile), tox (py310–py313), pre-commit (ruff + standard hooks)
  • MkDocs Material documentation site in docs/

✨ New Features

  • PaydunyaClient(master_key, private_key, token, mode="test"|"live") — typed, explicit client
  • DMP APIDMP.create() / DMP.check_status() for SMS/Email payment requests
  • IPN helperverify_ipn_hash() (SHA-512 master-key comparison)
  • Customer pre-fillInvoice.set_customer(name, email, phone)
  • Pydantic v2 models with boundary validation (EmailStr, amount bounds, required fields)

🔧 Docs Compliance Fixes

  • Items now serialized as keyed item_0, item_1... (was a flat array starting at item_1)
  • Removed OPR class — endpoints no longer exist in official docs (replaced by JS-based PSR flow, now documented in docs/psr.md)

🧪 Testing

  • 50 pytest tests, fully mocked via pytest-httpx — no network or credentials needed
  • 97% coverage, enforced in tox
  • examples/sandbox_e2e.py — interactive sandbox script for manual testing with fictitious customer accounts

💥 Breaking Changes

See CHANGELOG.md:

  • v1 global-state API (paydunya.debug / paydunya.api_keys) replaced by PaydunyaClient
  • OPR removed

@srugano
srugano merged commit b415ebf into develop Jul 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant