ultraner 0.1.0__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.
@@ -0,0 +1,17 @@
1
+ name: publish
2
+ on:
3
+ release:
4
+ types: [published]
5
+ permissions:
6
+ id-token: write # OIDC, required for PyPI Trusted Publishing (no token needed)
7
+ jobs:
8
+ publish:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ - uses: actions/setup-python@v5
13
+ with:
14
+ python-version: '3.x'
15
+ - run: pip install build
16
+ - run: python -m build
17
+ - uses: pypa/gh-action-pypi-publish@release/v1
ultraner-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Hernatter Limited (Ultraner)
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
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: ultraner
3
+ Version: 0.1.0
4
+ Summary: Ultraner Python SDK, one API for payments across Africa (mobile money, cards, PayPal, wallets).
5
+ Project-URL: Homepage, https://ultraner.com/ai
6
+ Project-URL: Documentation, https://ultraner.com/docs
7
+ Project-URL: Source, https://github.com/ultraner/ultraner-python
8
+ Author: Hernatter Limited
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: africa,airtel money,mobile money,mpesa,mtn momo,payments,paypal,stripe,ultraner
12
+ Requires-Python: >=3.8
13
+ Description-Content-Type: text/markdown
14
+
15
+ # Ultraner Python SDK
16
+
17
+ One API for payments across Africa: mobile money, cards, PayPal and wallets. Live in Tanzania and Rwanda, expanding across the continent.
18
+
19
+ - Docs: https://ultraner.com/docs
20
+ - OpenAPI: https://ultraner.com/openapi.json
21
+ - For AI: https://ultraner.com/ai
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ pip install ultraner
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ```python
32
+ from ultraner import Ultraner
33
+
34
+ client = Ultraner(api_key="sk_live_...")
35
+
36
+ # Charge a mobile-money wallet
37
+ payment = client.payments.create_mobile_money(
38
+ amount=5000,
39
+ currency="TZS",
40
+ provider="Vodacom",
41
+ accountNumber="255700000000",
42
+ externalId="order_1001",
43
+ )
44
+
45
+ # Poll status
46
+ status = client.payments.get_status(payment["reference"])
47
+
48
+ # Wallet, transactions
49
+ client.wallet.get()
50
+ client.transactions.list(page=1, limit=20)
51
+
52
+ # Escrow
53
+ escrow = client.escrow.create(amount=10000, currency="TZS", recipient="vendor@example.com")
54
+ client.escrow.release(escrow["escrowCode"])
55
+
56
+ # International payers
57
+ client.paypal.create_order(amount=25, currency="USD")
58
+ client.stripe.create_session(amount=2500, currency="usd")
59
+ ```
60
+
61
+ Errors raise `ultraner.UltranerError` with `.status` and `.code`.
62
+
63
+ ## License
64
+
65
+ MIT
@@ -0,0 +1,51 @@
1
+ # Ultraner Python SDK
2
+
3
+ One API for payments across Africa: mobile money, cards, PayPal and wallets. Live in Tanzania and Rwanda, expanding across the continent.
4
+
5
+ - Docs: https://ultraner.com/docs
6
+ - OpenAPI: https://ultraner.com/openapi.json
7
+ - For AI: https://ultraner.com/ai
8
+
9
+ ## Install
10
+
11
+ ```bash
12
+ pip install ultraner
13
+ ```
14
+
15
+ ## Usage
16
+
17
+ ```python
18
+ from ultraner import Ultraner
19
+
20
+ client = Ultraner(api_key="sk_live_...")
21
+
22
+ # Charge a mobile-money wallet
23
+ payment = client.payments.create_mobile_money(
24
+ amount=5000,
25
+ currency="TZS",
26
+ provider="Vodacom",
27
+ accountNumber="255700000000",
28
+ externalId="order_1001",
29
+ )
30
+
31
+ # Poll status
32
+ status = client.payments.get_status(payment["reference"])
33
+
34
+ # Wallet, transactions
35
+ client.wallet.get()
36
+ client.transactions.list(page=1, limit=20)
37
+
38
+ # Escrow
39
+ escrow = client.escrow.create(amount=10000, currency="TZS", recipient="vendor@example.com")
40
+ client.escrow.release(escrow["escrowCode"])
41
+
42
+ # International payers
43
+ client.paypal.create_order(amount=25, currency="USD")
44
+ client.stripe.create_session(amount=2500, currency="usd")
45
+ ```
46
+
47
+ Errors raise `ultraner.UltranerError` with `.status` and `.code`.
48
+
49
+ ## License
50
+
51
+ MIT
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "ultraner"
7
+ version = "0.1.0"
8
+ description = "Ultraner Python SDK, one API for payments across Africa (mobile money, cards, PayPal, wallets)."
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "Hernatter Limited" }]
13
+ keywords = ["ultraner", "payments", "africa", "mobile money", "mpesa", "mtn momo", "airtel money", "stripe", "paypal"]
14
+ dependencies = []
15
+
16
+ [project.urls]
17
+ Homepage = "https://ultraner.com/ai"
18
+ Documentation = "https://ultraner.com/docs"
19
+ Source = "https://github.com/ultraner/ultraner-python"
20
+
21
+ [tool.hatch.build.targets.wheel]
22
+ packages = ["ultraner"]
@@ -0,0 +1,127 @@
1
+ """
2
+ Ultraner Python SDK
3
+ One API for payments across Africa: mobile money, cards, PayPal, wallets.
4
+ Docs: https://ultraner.com/docs · Spec: https://ultraner.com/openapi.json
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import json
10
+ import urllib.error
11
+ import urllib.parse
12
+ import urllib.request
13
+ from typing import Any, Optional
14
+
15
+ __version__ = "0.1.0"
16
+ __all__ = ["Ultraner", "UltranerError"]
17
+
18
+
19
+ class UltranerError(Exception):
20
+ def __init__(self, message: str, code: str = "ERROR", status: int = 0):
21
+ super().__init__(message)
22
+ self.message = message
23
+ self.code = code
24
+ self.status = status
25
+
26
+
27
+ class _Resource:
28
+ def __init__(self, client: "Ultraner"):
29
+ self._c = client
30
+
31
+
32
+ class _Payments(_Resource):
33
+ def create_mobile_money(self, **body: Any) -> dict:
34
+ return self._c.request("POST", "/v1/payments/express/mno", body)
35
+
36
+ def get_status(self, reference: str) -> dict:
37
+ return self._c.request("GET", f"/v1/payments/express/status/{urllib.parse.quote(reference)}")
38
+
39
+
40
+ class _Disbursements(_Resource):
41
+ def create(self, **body: Any) -> dict:
42
+ return self._c.request("POST", "/v1/disbursements", body)
43
+
44
+
45
+ class _Wallet(_Resource):
46
+ def get(self) -> dict:
47
+ return self._c.request("GET", "/v1/wallet")
48
+
49
+ def transfer(self, **body: Any) -> dict:
50
+ return self._c.request("POST", "/v1/transfer", body)
51
+
52
+
53
+ class _Transactions(_Resource):
54
+ def list(self, page: Optional[int] = None, limit: Optional[int] = None) -> dict:
55
+ params = {k: v for k, v in {"page": page, "limit": limit}.items() if v is not None}
56
+ qs = ("?" + urllib.parse.urlencode(params)) if params else ""
57
+ return self._c.request("GET", f"/v1/transactions{qs}")
58
+
59
+
60
+ class _Escrow(_Resource):
61
+ def create(self, **body: Any) -> dict:
62
+ return self._c.request("POST", "/v1/escrow", body)
63
+
64
+ def release(self, escrow_code: str) -> dict:
65
+ return self._c.request("POST", f"/v1/escrow/{urllib.parse.quote(escrow_code)}/release")
66
+
67
+ def list(self) -> dict:
68
+ return self._c.request("GET", "/v1/escrow")
69
+
70
+
71
+ class _PayPal(_Resource):
72
+ def create_order(self, **body: Any) -> dict:
73
+ return self._c.request("POST", "/paypal/orders", body)
74
+
75
+ def capture_order(self, order_id: str) -> dict:
76
+ return self._c.request("POST", f"/paypal/orders/{urllib.parse.quote(order_id)}/capture")
77
+
78
+
79
+ class _Stripe(_Resource):
80
+ def create_session(self, **body: Any) -> dict:
81
+ return self._c.request("POST", "/stripe/sessions", body)
82
+
83
+
84
+ class Ultraner:
85
+ def __init__(
86
+ self,
87
+ api_key: str,
88
+ base_url: str = "https://api.ultraner.com",
89
+ timeout: float = 30.0,
90
+ ):
91
+ if not api_key:
92
+ raise ValueError("Ultraner: an API key is required.")
93
+ self.api_key = api_key
94
+ self.base_url = base_url.rstrip("/")
95
+ self.timeout = timeout
96
+ self.payments = _Payments(self)
97
+ self.disbursements = _Disbursements(self)
98
+ self.wallet = _Wallet(self)
99
+ self.transactions = _Transactions(self)
100
+ self.escrow = _Escrow(self)
101
+ self.paypal = _PayPal(self)
102
+ self.stripe = _Stripe(self)
103
+
104
+ def request(self, method: str, path: str, body: Optional[dict] = None) -> Any:
105
+ data = json.dumps(body).encode("utf-8") if body is not None else None
106
+ req = urllib.request.Request(
107
+ f"{self.base_url}{path}",
108
+ data=data,
109
+ method=method,
110
+ headers={
111
+ "Content-Type": "application/json",
112
+ "Authorization": f"Bearer {self.api_key}",
113
+ },
114
+ )
115
+ try:
116
+ with urllib.request.urlopen(req, timeout=self.timeout) as resp:
117
+ text = resp.read().decode("utf-8")
118
+ payload = json.loads(text) if text else {}
119
+ return payload.get("data", payload)
120
+ except urllib.error.HTTPError as e:
121
+ text = e.read().decode("utf-8") if e.fp else ""
122
+ payload = json.loads(text) if text else {}
123
+ raise UltranerError(
124
+ payload.get("message", "Request failed"),
125
+ payload.get("code", "ERROR"),
126
+ e.code,
127
+ ) from None