clickpesa-python-sdk 0.1.3__tar.gz → 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/PKG-INFO +1 -1
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/pyproject.toml +1 -1
- clickpesa_python_sdk-0.1.4/src/clickpesa/_version.py +1 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/security.py +1 -7
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa_python_sdk.egg-info/PKG-INFO +1 -1
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/tests/test_webhook.py +19 -6
- clickpesa_python_sdk-0.1.3/src/clickpesa/_version.py +0 -1
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/LICENSE +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/README.md +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/setup.cfg +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/__init__.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/async_client.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/client.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/exceptions.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/py.typed +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/__init__.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/account.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/billpay.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/exchange.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/links.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/payments.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/payouts.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/webhooks.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa_python_sdk.egg-info/SOURCES.txt +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa_python_sdk.egg-info/dependency_links.txt +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa_python_sdk.egg-info/requires.txt +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa_python_sdk.egg-info/top_level.txt +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/tests/test_async_client.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/tests/test_billpay.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/tests/test_client.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/tests/test_links.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/tests/test_payments.py +0 -0
- {clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/tests/test_payouts.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clickpesa-python-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Production-grade Python SDK for the ClickPesa API — sync & async, collections, payouts, BillPay and more
|
|
5
5
|
Author-email: Jackson Linus <jacksonlinus95@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.4"
|
|
@@ -63,11 +63,6 @@ class SecurityManager:
|
|
|
63
63
|
Uses ``hmac.compare_digest`` for constant-time comparison to prevent
|
|
64
64
|
timing-based side-channel attacks.
|
|
65
65
|
|
|
66
|
-
ClickPesa only signs top-level scalar fields in webhook payloads —
|
|
67
|
-
nested dicts and lists are excluded from the signature. This mirrors
|
|
68
|
-
their signing algorithm so extra envelope fields (e.g. ``customer``,
|
|
69
|
-
``metadata``) don't cause verification to fail.
|
|
70
|
-
|
|
71
66
|
Args:
|
|
72
67
|
checksum_key: Your application's checksum secret key.
|
|
73
68
|
payload: The parsed webhook body dict.
|
|
@@ -79,8 +74,7 @@ class SecurityManager:
|
|
|
79
74
|
if not signature:
|
|
80
75
|
return False
|
|
81
76
|
|
|
82
|
-
|
|
83
|
-
computed = SecurityManager.create_checksum(checksum_key, flat_payload)
|
|
77
|
+
computed = SecurityManager.create_checksum(checksum_key, payload)
|
|
84
78
|
return hmac.compare_digest(computed, signature)
|
|
85
79
|
|
|
86
80
|
|
{clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa_python_sdk.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clickpesa-python-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: Production-grade Python SDK for the ClickPesa API — sync & async, collections, payouts, BillPay and more
|
|
5
5
|
Author-email: Jackson Linus <jacksonlinus95@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -48,12 +48,25 @@ def test_verify_empty_signature_returns_false():
|
|
|
48
48
|
assert WebhookValidator.verify(PAYLOAD, "", CHECKSUM_KEY) is False
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
def
|
|
52
|
-
"""
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
def test_verify_real_webhook_structure():
|
|
52
|
+
"""Signature covers the full payload including nested data — mirrors ClickPesa's
|
|
53
|
+
actual webhook shape: {"event": "...", "data": {...nested...}}."""
|
|
54
|
+
webhook = {
|
|
55
|
+
"event": "PAYMENT RECEIVED",
|
|
56
|
+
"data": {
|
|
57
|
+
"id": "ORD123LCP456",
|
|
58
|
+
"status": "SUCCESS",
|
|
59
|
+
"orderReference": "ORD123",
|
|
60
|
+
"collectedAmount": "10000",
|
|
61
|
+
"collectedCurrency": "TZS",
|
|
62
|
+
"customer": {
|
|
63
|
+
"customerName": "John Doe",
|
|
64
|
+
"customerPhoneNumber": "255700000000",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
}
|
|
68
|
+
sig = SecurityManager.create_checksum(CHECKSUM_KEY, webhook)
|
|
69
|
+
assert WebhookValidator.verify(webhook, sig, CHECKSUM_KEY) is True
|
|
57
70
|
|
|
58
71
|
|
|
59
72
|
# ---------------------------------------------------------------------------
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/exchange.py
RENAMED
|
File without changes
|
|
File without changes
|
{clickpesa_python_sdk-0.1.3 → clickpesa_python_sdk-0.1.4}/src/clickpesa/services/payments.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|