Skip to content

Commit 57c9bb0

Browse files
committed
Initial commit
0 parents  commit 57c9bb0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1256
-0
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Set up Python
11+
uses: actions/setup-python@v4
12+
with:
13+
python-version: '3.10'
14+
- name: Install
15+
run: |
16+
python -m pip install --upgrade pip
17+
pip install -r requirements-dev.txt
18+
- name: Run tests
19+
run: |
20+
pytest -q || true
21+
- name: Run mock smoke scripts
22+
run: |
23+
python -c "import os,runpy; os.environ['ZENDFI_RUN_MOCK']='1'; runpy.run_path('tests/test_customers_unit.py')"
24+
python -c "import os,runpy; os.environ['ZENDFI_RUN_MOCK']='1'; runpy.run_path('tests/test_payments_splits.py')"
25+
python -c "import os,runpy; os.environ['ZENDFI_RUN_MOCK']='1'; runpy.run_path('tests/test_invoices_unit.py')"

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
build-and-publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Set up Python
14+
uses: actions/setup-python@v4
15+
with:
16+
python-version: '3.11'
17+
- name: Install build tools
18+
run: |
19+
python -m pip install --upgrade pip build twine
20+
- name: Build
21+
run: python -m build
22+
- name: Publish to PyPI
23+
env:
24+
TWINE_USERNAME: __token__
25+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
26+
run: |
27+
python -m twine upload --non-interactive dist/*

.vscode/settings.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"python.testing.unittestArgs": [
3+
"-v",
4+
"-s",
5+
"./tests",
6+
"-p",
7+
"*test.py"
8+
],
9+
"python.testing.pytestEnabled": false,
10+
"python.testing.unittestEnabled": true
11+
}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [0.1.0] - 2025-12-02
6+
- Initial SDK scaffold: payments, customers, invoices, webhooks
7+
- Added split payments, subscriptions, payment links, installment plans, escrows
8+
- Test scripts (mock and integration guards)
9+
- Retry logic for 5xx responses

LICENSE

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
MIT License
2+
3+
Copyright (c) 2025 ZendFi
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
[...standard MIT text...]

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include README.md
2+
include LICENSE
3+
include CHANGELOG.md
4+
recursive-include zendfi *.py

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# zendfi-python-sdk
2+
3+
This is a Python SDK port of zendfi-toolkit. It provides simple sync clients for Payments, Customers, Invoices and Webhooks verification.
4+
5+
## Quickstart
6+
7+
```py
8+
from zendfi import from_env
9+
client = from_env()
10+
11+
payment = client.payments.create(amount=50.0, currency="USD", description="Test")
12+
print(payment.get("checkout_url"))
13+
```
14+
15+
## Tests
16+
17+
Run:
18+
19+
```
20+
pip install -r requirements-dev.txt
21+
pytest -q
22+
```
23+
24+
Integration tests
25+
26+
To run tests against the real ZendFi API (BE CAREFUL — these perform real requests):
27+
28+
1. Set your API key and enable integration runs:
29+
30+
```powershell
31+
$env:ZENDFI_API_KEY = "sk_live_..."
32+
$env:ZENDFI_RUN_INTEGRATION = "1"
33+
# Optional: override base URL (e.g. staging)
34+
$env:ZENDFI_BASE_URL = "https://api.zendfi.tech/"
35+
pytest -q -k integration
36+
```
37+
38+
The integration test is guarded so it only runs when `ZENDFI_RUN_INTEGRATION` and
39+
`ZENDFI_API_KEY` are present in the environment.
40+
41+
## Publishing
42+
43+
This repository provides a `pyproject.toml` and `MANIFEST.in` ready for building source and wheel distributions. Quick steps to publish:
44+
45+
- Build distributions locally: `python -m build`
46+
- Upload to PyPI (use a PyPI API token): `python -m twine upload dist/*`
47+
48+
A GitHub Actions workflow (`.github/workflows/publish.yml`) is included to publish on tagged releases. Configure the `PYPI_API_TOKEN` secret in the repository settings before pushing a `vX.Y.Z` tag.
49+
50+
Security note: Never commit real API keys or PyPI tokens to the repository. Use environment variables or CI secrets.
10.6 KB
Binary file not shown.

dist/zendfi_sdk-0.1.0.tar.gz

11.3 KB
Binary file not shown.

pyproject.toml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
[project]
2+
name = "zendfi-sdk"
3+
version = "0.1.0"
4+
description = "Python SDK for ZendFi (payments, customers, invoices, webhooks)"
5+
authors = [{name = "ZendFi"}]
6+
readme = "README.md"
7+
license = {text = "MIT"}
8+
keywords = ["payments", "sdk", "zendfi"]
9+
requires-python = ">=3.8"
10+
dependencies = [
11+
"requests>=2.28",
12+
]
13+
classifiers = [
14+
"Programming Language :: Python :: 3",
15+
"Operating System :: OS Independent",
16+
]
17+
18+
[project.optional-dependencies]
19+
retry = ["tenacity>=8.0"]
20+
21+
[build-system]
22+
requires = ["setuptools", "wheel"]
23+
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)