inttegro 1.0.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.
Files changed (35) hide show
  1. inttegro-1.0.0/LICENSE +21 -0
  2. inttegro-1.0.0/PKG-INFO +121 -0
  3. inttegro-1.0.0/README.md +98 -0
  4. inttegro-1.0.0/pyproject.toml +24 -0
  5. inttegro-1.0.0/src/inttegro/__init__.py +21 -0
  6. inttegro-1.0.0/src/inttegro/client.py +157 -0
  7. inttegro-1.0.0/src/inttegro/enums.py +401 -0
  8. inttegro-1.0.0/src/inttegro/errors.py +78 -0
  9. inttegro-1.0.0/src/inttegro/http_client.py +318 -0
  10. inttegro-1.0.0/src/inttegro/resources/__init__.py +1 -0
  11. inttegro-1.0.0/src/inttegro/resources/apps.py +24 -0
  12. inttegro-1.0.0/src/inttegro/resources/balance_transactions.py +77 -0
  13. inttegro-1.0.0/src/inttegro/resources/balances.py +11 -0
  14. inttegro-1.0.0/src/inttegro/resources/broadcasts.py +20 -0
  15. inttegro-1.0.0/src/inttegro/resources/chimes.py +128 -0
  16. inttegro-1.0.0/src/inttegro/resources/customers.py +29 -0
  17. inttegro-1.0.0/src/inttegro/resources/file_links.py +33 -0
  18. inttegro-1.0.0/src/inttegro/resources/file_references.py +16 -0
  19. inttegro-1.0.0/src/inttegro/resources/files.py +54 -0
  20. inttegro-1.0.0/src/inttegro/resources/financial_accounts.py +328 -0
  21. inttegro-1.0.0/src/inttegro/resources/keys.py +46 -0
  22. inttegro-1.0.0/src/inttegro/resources/message_templates.py +59 -0
  23. inttegro-1.0.0/src/inttegro/resources/orders.py +642 -0
  24. inttegro-1.0.0/src/inttegro/resources/otp.py +129 -0
  25. inttegro-1.0.0/src/inttegro/resources/payment_methods.py +486 -0
  26. inttegro-1.0.0/src/inttegro/resources/payouts.py +492 -0
  27. inttegro-1.0.0/src/inttegro/resources/prices.py +41 -0
  28. inttegro-1.0.0/src/inttegro/resources/products.py +48 -0
  29. inttegro-1.0.0/src/inttegro/resources/purchase_intents.py +32 -0
  30. inttegro-1.0.0/src/inttegro/resources/refunds.py +42 -0
  31. inttegro-1.0.0/src/inttegro/resources/schedules.py +20 -0
  32. inttegro-1.0.0/src/inttegro/resources/spec.py +77 -0
  33. inttegro-1.0.0/src/inttegro/resources/upload_requests.py +32 -0
  34. inttegro-1.0.0/src/inttegro/response_object.py +57 -0
  35. inttegro-1.0.0/src/inttegro/version.py +1 -0
inttegro-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Inttegro
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,121 @@
1
+ Metadata-Version: 2.4
2
+ Name: inttegro
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the Inttegro API
5
+ License: MIT
6
+ License-File: LICENSE
7
+ Author: Inttegro Engineering
8
+ Author-email: engineering@inttegro.com
9
+ Requires-Python: >=3.10
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Project-URL: Documentation, https://studio.inttegro.com/api-reference
18
+ Project-URL: Homepage, https://studio.inttegro.com
19
+ Project-URL: Issues, https://github.com/zebodotdev/inttegro-sdk-python/issues
20
+ Project-URL: Repository, https://github.com/zebodotdev/inttegro-sdk-python
21
+ Description-Content-Type: text/markdown
22
+
23
+ # Inttegro Python SDK
24
+
25
+ The official Python client for building server-side Inttegro integrations.
26
+
27
+ > **Fastest, most modern path:** connect an agent to [Inttegro MCP](https://studio.inttegro.com/inttegro-mcp) at `https://mcp.inttegro.com`, then ask it to run `design_integration`. It will produce an implementation and test plan for your application. Use this SDK when you are ready to connect that plan to your Python service.
28
+
29
+ All official Inttegro SDKs expose the same API capabilities. This package adds Python-specific data access, transports, and test seams.
30
+
31
+ ## Install
32
+
33
+ Requires Python 3.10 or newer.
34
+
35
+ ```bash
36
+ pip install inttegro
37
+ ```
38
+
39
+ Store your secret key in the server environment:
40
+
41
+ ```bash
42
+ export INTTEGRO_API_KEY="your_secret_key"
43
+ ```
44
+
45
+ Never put the key in browser code, a mobile app, or source control. The client uses `https://api.inttegro.com` by default.
46
+
47
+ ## Create a hosted checkout
48
+
49
+ Create and finalize an order, then send the customer to its hosted invoice URL:
50
+
51
+ ```python
52
+ import os
53
+
54
+ from inttegro import APIError, InttegroClient, ProductType
55
+
56
+ inttegro = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])
57
+
58
+ try:
59
+ result = inttegro.orders.create({
60
+ "request_meta": {"idempotency_key": "checkout-cart-123"},
61
+ "customer_data": {
62
+ "name": "Akua Mensah",
63
+ "email_address": "akua@example.com",
64
+ "phone_number": "+233544998605",
65
+ },
66
+ "finalize": True,
67
+ "checkout_settings": {
68
+ "redirect_url": "https://example.com/orders/complete",
69
+ "cancel_url": "https://example.com/cart",
70
+ },
71
+ "line_items": [{
72
+ "type": "product",
73
+ "product": {
74
+ "type": ProductType.DIGITAL,
75
+ "name": "Monthly subscription",
76
+ "quantity": 1,
77
+ "price": {"currency": "ghs", "value": 5000},
78
+ },
79
+ }],
80
+ })
81
+
82
+ checkout_url = result.order.invoice.format.web.url
83
+ print(result.order.id, checkout_url)
84
+ except APIError as error:
85
+ print(error.code, error.detail or str(error))
86
+ raise
87
+ ```
88
+
89
+ Amounts use integer minor units: `5000` GHS is GHS 50.00. Reuse the same idempotency key when retrying the same logical write. If you omit one, the SDK generates a UUIDv7 key for mutating calls.
90
+
91
+ ## Work with the API
92
+
93
+ The SDK covers orders and checkout, customers, products and prices, purchase intents, payment methods, balances, payouts and refunds, notifications, files, application settings, keys, and country specifications. Resources use snake-case attributes such as `purchase_intents` and `payment_methods`.
94
+
95
+ Python-specific features:
96
+
97
+ - Standard-library-only runtime with no third-party dependencies.
98
+ - Native dictionary requests and responses that support both attribute and mapping access.
99
+ - JSON-compatible string enums for public API values.
100
+ - Configurable timeout, base URL, and injectable transport for tests or custom networking.
101
+ - Structured authentication, rate-limit, network, timeout, and API exceptions.
102
+
103
+ See the [API reference](https://studio.inttegro.com/api-reference) for request fields and lifecycle rules, [errors](https://studio.inttegro.com/errors) for recovery guidance, and [idempotency](https://studio.inttegro.com/idempotency) for safe retries.
104
+
105
+ ## Verify a release
106
+
107
+ The GitHub release for each version is the canonical record. It contains the exact wheel and source distribution uploaded to PyPI, SHA-256 checksums, and a Sigstore attestation tied to the source commit and release workflow.
108
+
109
+ ```bash
110
+ sha256sum --check SHA256SUMS
111
+ gh attestation verify inttegro-1.0.0-py3-none-any.whl \
112
+ --repo zebodotdev/inttegro-sdk-python
113
+ ```
114
+
115
+ ## Develop
116
+
117
+ ```bash
118
+ poetry install
119
+ poetry run python -m unittest discover -s tests -p "test_*.py"
120
+ ```
121
+
@@ -0,0 +1,98 @@
1
+ # Inttegro Python SDK
2
+
3
+ The official Python client for building server-side Inttegro integrations.
4
+
5
+ > **Fastest, most modern path:** connect an agent to [Inttegro MCP](https://studio.inttegro.com/inttegro-mcp) at `https://mcp.inttegro.com`, then ask it to run `design_integration`. It will produce an implementation and test plan for your application. Use this SDK when you are ready to connect that plan to your Python service.
6
+
7
+ All official Inttegro SDKs expose the same API capabilities. This package adds Python-specific data access, transports, and test seams.
8
+
9
+ ## Install
10
+
11
+ Requires Python 3.10 or newer.
12
+
13
+ ```bash
14
+ pip install inttegro
15
+ ```
16
+
17
+ Store your secret key in the server environment:
18
+
19
+ ```bash
20
+ export INTTEGRO_API_KEY="your_secret_key"
21
+ ```
22
+
23
+ Never put the key in browser code, a mobile app, or source control. The client uses `https://api.inttegro.com` by default.
24
+
25
+ ## Create a hosted checkout
26
+
27
+ Create and finalize an order, then send the customer to its hosted invoice URL:
28
+
29
+ ```python
30
+ import os
31
+
32
+ from inttegro import APIError, InttegroClient, ProductType
33
+
34
+ inttegro = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])
35
+
36
+ try:
37
+ result = inttegro.orders.create({
38
+ "request_meta": {"idempotency_key": "checkout-cart-123"},
39
+ "customer_data": {
40
+ "name": "Akua Mensah",
41
+ "email_address": "akua@example.com",
42
+ "phone_number": "+233544998605",
43
+ },
44
+ "finalize": True,
45
+ "checkout_settings": {
46
+ "redirect_url": "https://example.com/orders/complete",
47
+ "cancel_url": "https://example.com/cart",
48
+ },
49
+ "line_items": [{
50
+ "type": "product",
51
+ "product": {
52
+ "type": ProductType.DIGITAL,
53
+ "name": "Monthly subscription",
54
+ "quantity": 1,
55
+ "price": {"currency": "ghs", "value": 5000},
56
+ },
57
+ }],
58
+ })
59
+
60
+ checkout_url = result.order.invoice.format.web.url
61
+ print(result.order.id, checkout_url)
62
+ except APIError as error:
63
+ print(error.code, error.detail or str(error))
64
+ raise
65
+ ```
66
+
67
+ Amounts use integer minor units: `5000` GHS is GHS 50.00. Reuse the same idempotency key when retrying the same logical write. If you omit one, the SDK generates a UUIDv7 key for mutating calls.
68
+
69
+ ## Work with the API
70
+
71
+ The SDK covers orders and checkout, customers, products and prices, purchase intents, payment methods, balances, payouts and refunds, notifications, files, application settings, keys, and country specifications. Resources use snake-case attributes such as `purchase_intents` and `payment_methods`.
72
+
73
+ Python-specific features:
74
+
75
+ - Standard-library-only runtime with no third-party dependencies.
76
+ - Native dictionary requests and responses that support both attribute and mapping access.
77
+ - JSON-compatible string enums for public API values.
78
+ - Configurable timeout, base URL, and injectable transport for tests or custom networking.
79
+ - Structured authentication, rate-limit, network, timeout, and API exceptions.
80
+
81
+ See the [API reference](https://studio.inttegro.com/api-reference) for request fields and lifecycle rules, [errors](https://studio.inttegro.com/errors) for recovery guidance, and [idempotency](https://studio.inttegro.com/idempotency) for safe retries.
82
+
83
+ ## Verify a release
84
+
85
+ The GitHub release for each version is the canonical record. It contains the exact wheel and source distribution uploaded to PyPI, SHA-256 checksums, and a Sigstore attestation tied to the source commit and release workflow.
86
+
87
+ ```bash
88
+ sha256sum --check SHA256SUMS
89
+ gh attestation verify inttegro-1.0.0-py3-none-any.whl \
90
+ --repo zebodotdev/inttegro-sdk-python
91
+ ```
92
+
93
+ ## Develop
94
+
95
+ ```bash
96
+ poetry install
97
+ poetry run python -m unittest discover -s tests -p "test_*.py"
98
+ ```
@@ -0,0 +1,24 @@
1
+ [tool.poetry]
2
+ name = "inttegro"
3
+ version = "1.0.0"
4
+ description = "Official Python SDK for the Inttegro API"
5
+ authors = ["Inttegro Engineering <engineering@inttegro.com>"]
6
+ license = "MIT"
7
+ readme = "README.md"
8
+ packages = [{ include = "inttegro", from = "src" }]
9
+
10
+ [tool.poetry.urls]
11
+ Homepage = "https://studio.inttegro.com"
12
+ Repository = "https://github.com/zebodotdev/inttegro-sdk-python"
13
+ Issues = "https://github.com/zebodotdev/inttegro-sdk-python/issues"
14
+ Documentation = "https://studio.inttegro.com/api-reference"
15
+
16
+ [tool.poetry.dependencies]
17
+ python = ">=3.10"
18
+
19
+ [tool.poetry.group.dev.dependencies]
20
+ coverage = "^7.6.1"
21
+
22
+ [build-system]
23
+ requires = ["poetry-core==2.4.1"]
24
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,21 @@
1
+ from .client import InttegroClient
2
+ from .errors import (
3
+ InttegroError,
4
+ NetworkError,
5
+ TimeoutError,
6
+ APIError,
7
+ AuthenticationError,
8
+ RateLimitError,
9
+ )
10
+ from .enums import * # noqa: F401,F403
11
+ from .enums import __all__ as _enum_exports
12
+
13
+ __all__ = [
14
+ "InttegroClient",
15
+ "InttegroError",
16
+ "NetworkError",
17
+ "TimeoutError",
18
+ "APIError",
19
+ "AuthenticationError",
20
+ "RateLimitError",
21
+ ] + _enum_exports
@@ -0,0 +1,157 @@
1
+ from __future__ import annotations
2
+
3
+ from .http_client import HttpClient
4
+ from .resources.balance_transactions import BalanceTransactions
5
+ from .resources.chimes import Chimes
6
+ from .resources.customers import Customers
7
+ from .resources.schedules import Schedules
8
+ from .resources.broadcasts import Broadcasts
9
+ from .resources.message_templates import MessageTemplates
10
+ from .resources.financial_accounts import FinancialAccounts
11
+ from .resources.files import Files
12
+ from .resources.file_links import FileLinks
13
+ from .resources.file_references import FileReferences
14
+ from .resources.keys import Keys
15
+ from .resources.otp import Otp
16
+ from .resources.orders import Orders
17
+ from .resources.payment_methods import PaymentMethods
18
+ from .resources.payouts import Payouts
19
+ from .resources.products import Products
20
+ from .resources.prices import Prices
21
+ from .resources.purchase_intents import PurchaseIntents
22
+ from .resources.refunds import Refunds
23
+ from .resources.spec import Spec
24
+ from .resources.balances import Balances
25
+ from .resources.upload_requests import UploadRequests
26
+ from .resources.apps import Apps
27
+
28
+
29
+ class InttegroClient:
30
+ """
31
+ Main SDK client for the Inttegro API.
32
+
33
+ The Inttegro client provides access to all API resources including orders,
34
+ payment methods, payouts, financial accounts, and more. Initialize with
35
+ your API key from the Inttegro dashboard.
36
+
37
+ Attributes:
38
+ orders: Orders resource for creating and managing orders, processing payments
39
+ payment_methods: Payment methods resource for tokenizing and managing payment instruments
40
+ payouts: Payouts resource for scheduling and managing fund transfers
41
+ balance_transactions: Balance transactions resource for viewing account activity
42
+ financial_accounts: Financial accounts resource for connecting bank and mobile money accounts
43
+ customers: Customers resource for creating and managing customers
44
+ products: Products resource for managing catalog products
45
+ prices: Prices resource for managing catalog prices
46
+ refunds: Refunds resource for creating and managing refunds
47
+ chimes: Chimes resource for sending transactional notifications
48
+ schedules: Schedules resource for looking up and canceling scheduled chimes
49
+ broadcasts: Broadcasts resource for looking up and canceling broadcasts
50
+ otp: OTP resource for one-time password verification
51
+ apps: Apps resource for creating, looking up, and updating applications
52
+ spec: Spec resource for retrieving supported countries and currencies
53
+
54
+ Example:
55
+ ```python
56
+ import os
57
+ from inttegro import InttegroClient
58
+
59
+ # Initialize client with API key
60
+ client = InttegroClient(api_key=os.environ["INTTEGRO_API_KEY"])
61
+
62
+ # Create and process an order
63
+ result = client.orders.create({
64
+ "customer_data": {
65
+ "name": "Akua Asantewaa",
66
+ "phone_number": "+233541234567",
67
+ "email_address": "akua@example.com"
68
+ },
69
+ "line_items": [{
70
+ "type": "product",
71
+ "product": {
72
+ "type": "digital",
73
+ "name": "Premium Subscription",
74
+ "quantity": 1,
75
+ "price": {"currency": "ghs", "value": 5000}
76
+ }
77
+ }],
78
+ "billing_details": {
79
+ "name": "Akua Asantewaa",
80
+ "phone_number": "+233541234567"
81
+ },
82
+ "execute_payment": True
83
+ })
84
+ ```
85
+
86
+ Thread Safety:
87
+ The client is thread-safe after initialization and can be safely shared
88
+ across multiple threads.
89
+ """
90
+
91
+ def __init__(
92
+ self,
93
+ api_key: str,
94
+ base_url: str = "https://api.inttegro.com",
95
+ timeout: float = 30.0,
96
+ transport=None,
97
+ ):
98
+ """
99
+ Initialize a new Inttegro client.
100
+
101
+ Args:
102
+ api_key: Your Inttegro API key (required). Get this from your dashboard
103
+ at https://studio.inttegro.com/settings/keys. Use test keys (sk_test_...)
104
+ for development and live keys (sk_live_...) for production.
105
+ base_url: API base URL. Defaults to production (https://api.inttegro.com).
106
+ Override for testing or staging environments.
107
+ timeout: Request timeout in seconds. Defaults to 30.0. Increase for
108
+ long-running operations or slow networks.
109
+ transport: Custom HTTP transport adapter. Pass a requests.Session or
110
+ custom transport for connection pooling, retries, or proxies.
111
+
112
+ Raises:
113
+ ValueError: If api_key is empty or invalid
114
+
115
+ Example:
116
+ ```python
117
+ # Production usage
118
+ client = InttegroClient(api_key="sk_live_...")
119
+
120
+ # Development with custom timeout
121
+ client = InttegroClient(
122
+ api_key="sk_test_...",
123
+ timeout=60.0
124
+ )
125
+
126
+ # Testing with mock server
127
+ client = InttegroClient(
128
+ api_key="sk_test_...",
129
+ base_url="http://localhost:8080"
130
+ )
131
+ ```
132
+ """
133
+ self.http = HttpClient(api_key=api_key, base_url=base_url, timeout=timeout, transport=transport)
134
+
135
+ self.orders = Orders(self.http)
136
+ self.payment_methods = PaymentMethods(self.http)
137
+ self.payouts = Payouts(self.http)
138
+ self.balance_transactions = BalanceTransactions(self.http)
139
+ self.financial_accounts = FinancialAccounts(self.http)
140
+ self.files = Files(self.http)
141
+ self.file_links = FileLinks(self.http)
142
+ self.file_references = FileReferences(self.http)
143
+ self.customers = Customers(self.http)
144
+ self.products = Products(self.http)
145
+ self.prices = Prices(self.http)
146
+ self.purchase_intents = PurchaseIntents(self.http)
147
+ self.refunds = Refunds(self.http)
148
+ self.chimes = Chimes(self.http)
149
+ self.schedules = Schedules(self.http)
150
+ self.broadcasts = Broadcasts(self.http)
151
+ self.message_templates = MessageTemplates(self.http)
152
+ self.otp = Otp(self.http)
153
+ self.apps = Apps(self.http)
154
+ self.keys = Keys(self.http)
155
+ self.spec = Spec(self.http)
156
+ self.balances = Balances(self.http)
157
+ self.upload_requests = UploadRequests(self.http)