sapliyio-fintech 0.0.1__py3-none-any.whl → 1.0.0__py3-none-any.whl
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.
- sapliyio_fintech/__init__.py +26 -171
- sapliyio_fintech/api_client.py +804 -0
- sapliyio_fintech/api_response.py +21 -0
- sapliyio_fintech/configuration.py +578 -0
- sapliyio_fintech/exceptions.py +219 -0
- sapliyio_fintech/py.typed +0 -0
- sapliyio_fintech/rest.py +263 -0
- sapliyio_fintech-1.0.0.dist-info/METADATA +254 -0
- sapliyio_fintech-1.0.0.dist-info/RECORD +12 -0
- sapliyio_fintech-0.0.1.dist-info/METADATA +0 -44
- sapliyio_fintech-0.0.1.dist-info/RECORD +0 -6
- {sapliyio_fintech-0.0.1.dist-info → sapliyio_fintech-1.0.0.dist-info}/WHEEL +0 -0
- {sapliyio_fintech-0.0.1.dist-info → sapliyio_fintech-1.0.0.dist-info}/licenses/LICENSE +0 -0
- {sapliyio_fintech-0.0.1.dist-info → sapliyio_fintech-1.0.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sapliyio-fintech
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Sapliy Fintech Ecosystem SDK for Python
|
|
5
|
+
Author-email: Sapliy <dev@sapliy.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/Sapliy/fintech-ecosystem
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.7
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: urllib3<3.0.0,>=2.1.0
|
|
14
|
+
Requires-Dist: python-dateutil>=2.8.2
|
|
15
|
+
Requires-Dist: pydantic>=2.0.0
|
|
16
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
17
|
+
Dynamic: license-file
|
|
18
|
+
|
|
19
|
+
# sapliyio-fintech
|
|
20
|
+
|
|
21
|
+
[](https://badge.fury.io/py/sapliyio-fintech)
|
|
22
|
+
[](https://opensource.org/licenses/MIT)
|
|
23
|
+
|
|
24
|
+
Official Python SDK for the Sapliy Fintech Ecosystem. Build financial applications with a clean, Pythonic API.
|
|
25
|
+
|
|
26
|
+
## Features
|
|
27
|
+
|
|
28
|
+
- **Payments** — Create charges, handle refunds, manage payment lifecycle
|
|
29
|
+
- **Wallets** — User balances and internal accounting
|
|
30
|
+
- **Ledger** — Double-entry bookkeeping for high-integrity transactions
|
|
31
|
+
- **Billing** — Subscriptions and recurring billing
|
|
32
|
+
- **Connect** — Multi-tenant support and managed accounts
|
|
33
|
+
- **Webhooks** — Event handling with signature verification
|
|
34
|
+
- **Type Hints** — Full typing support for IDE autocomplete
|
|
35
|
+
|
|
36
|
+
## Installation
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install sapliyio-fintech
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from sapliyio_fintech import FintechClient
|
|
46
|
+
|
|
47
|
+
client = FintechClient(api_key="sk_test_...")
|
|
48
|
+
|
|
49
|
+
# Create a payment
|
|
50
|
+
payment = client.payments.create(
|
|
51
|
+
amount=2000, # $20.00
|
|
52
|
+
currency="USD",
|
|
53
|
+
source_id="src_123",
|
|
54
|
+
description="Order #1234"
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
print(f"Payment created: {payment.id}")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
# Custom base URL (for self-hosted)
|
|
64
|
+
client = FintechClient(
|
|
65
|
+
api_key="sk_test_...",
|
|
66
|
+
base_url="https://api.yourdomain.com"
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Custom timeout
|
|
70
|
+
client = FintechClient(
|
|
71
|
+
api_key="sk_test_...",
|
|
72
|
+
timeout=30 # seconds
|
|
73
|
+
)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## API Reference
|
|
77
|
+
|
|
78
|
+
### Payments
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
# Create a charge
|
|
82
|
+
payment = client.payments.create(
|
|
83
|
+
amount=1000,
|
|
84
|
+
currency="USD",
|
|
85
|
+
source_id="src_123",
|
|
86
|
+
description="Coffee"
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
# Get payment details
|
|
90
|
+
payment = client.payments.get("pay_123")
|
|
91
|
+
|
|
92
|
+
# Refund a payment
|
|
93
|
+
payment = client.payments.refund("pay_123", amount=500) # partial refund
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Wallets
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
# Create a wallet
|
|
100
|
+
wallet = client.wallets.create(
|
|
101
|
+
name="User Wallet",
|
|
102
|
+
currency="USD"
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
# Get wallet balance
|
|
106
|
+
wallet = client.wallets.get("wal_123")
|
|
107
|
+
|
|
108
|
+
# Credit (add funds)
|
|
109
|
+
wallet = client.wallets.credit(
|
|
110
|
+
wallet_id="wal_123",
|
|
111
|
+
amount=1000,
|
|
112
|
+
description="Deposit"
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
# Debit (withdraw funds)
|
|
116
|
+
wallet = client.wallets.debit(
|
|
117
|
+
wallet_id="wal_123",
|
|
118
|
+
amount=500,
|
|
119
|
+
description="Purchase"
|
|
120
|
+
)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Ledger
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
# Record a transaction
|
|
127
|
+
response = client.ledger.record_transaction(
|
|
128
|
+
account_id="acc_123",
|
|
129
|
+
amount=1000,
|
|
130
|
+
currency="USD",
|
|
131
|
+
description="Payment received",
|
|
132
|
+
reference_id="ref_456"
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# Get account details
|
|
136
|
+
account = client.ledger.get_account("acc_123")
|
|
137
|
+
print(f"Balance: {account.balance}")
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Billing
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
# Create a subscription
|
|
144
|
+
subscription = client.billing.create_subscription(
|
|
145
|
+
customer_id="cust_123",
|
|
146
|
+
plan_id="plan_monthly"
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
# Get subscription
|
|
150
|
+
subscription = client.billing.get_subscription("sub_123")
|
|
151
|
+
|
|
152
|
+
# Cancel subscription
|
|
153
|
+
client.billing.cancel_subscription("sub_123")
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Webhook Handling
|
|
157
|
+
|
|
158
|
+
### Flask Example
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from flask import Flask, request
|
|
162
|
+
from sapliyio_fintech import FintechClient
|
|
163
|
+
|
|
164
|
+
app = Flask(__name__)
|
|
165
|
+
client = FintechClient(api_key="sk_test_...")
|
|
166
|
+
|
|
167
|
+
@app.route("/webhooks", methods=["POST"])
|
|
168
|
+
def webhook():
|
|
169
|
+
payload = request.data
|
|
170
|
+
signature = request.headers.get("X-Sapliy-Signature")
|
|
171
|
+
secret = "whsec_..."
|
|
172
|
+
|
|
173
|
+
try:
|
|
174
|
+
event = client.webhooks.construct_event(payload, signature, secret)
|
|
175
|
+
except ValueError:
|
|
176
|
+
return "Invalid signature", 400
|
|
177
|
+
|
|
178
|
+
if event.type == "payment.succeeded":
|
|
179
|
+
payment = event.data.object
|
|
180
|
+
# Handle successful payment
|
|
181
|
+
elif event.type == "payment.failed":
|
|
182
|
+
# Handle failed payment
|
|
183
|
+
pass
|
|
184
|
+
|
|
185
|
+
return {"received": True}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Django Example
|
|
189
|
+
|
|
190
|
+
```python
|
|
191
|
+
from django.http import JsonResponse
|
|
192
|
+
from django.views.decorators.csrf import csrf_exempt
|
|
193
|
+
from sapliyio_fintech import FintechClient
|
|
194
|
+
|
|
195
|
+
client = FintechClient(api_key="sk_test_...")
|
|
196
|
+
|
|
197
|
+
@csrf_exempt
|
|
198
|
+
def webhook_view(request):
|
|
199
|
+
payload = request.body
|
|
200
|
+
signature = request.headers.get("X-Sapliy-Signature")
|
|
201
|
+
secret = "whsec_..."
|
|
202
|
+
|
|
203
|
+
try:
|
|
204
|
+
event = client.webhooks.construct_event(payload, signature, secret)
|
|
205
|
+
except ValueError:
|
|
206
|
+
return JsonResponse({"error": "Invalid signature"}, status=400)
|
|
207
|
+
|
|
208
|
+
# Handle event
|
|
209
|
+
return JsonResponse({"received": True})
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Async Support
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
import asyncio
|
|
216
|
+
from sapliyio_fintech import AsyncFintechClient
|
|
217
|
+
|
|
218
|
+
async def main():
|
|
219
|
+
client = AsyncFintechClient(api_key="sk_test_...")
|
|
220
|
+
|
|
221
|
+
payment = await client.payments.create(
|
|
222
|
+
amount=2000,
|
|
223
|
+
currency="USD",
|
|
224
|
+
source_id="src_123",
|
|
225
|
+
description="Async payment"
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
print(f"Payment: {payment.id}")
|
|
229
|
+
|
|
230
|
+
asyncio.run(main())
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Error Handling
|
|
234
|
+
|
|
235
|
+
```python
|
|
236
|
+
from sapliyio_fintech.exceptions import FintechError, PaymentError
|
|
237
|
+
|
|
238
|
+
try:
|
|
239
|
+
payment = client.payments.get("invalid_id")
|
|
240
|
+
except PaymentError as e:
|
|
241
|
+
print(f"Payment error: {e.message}")
|
|
242
|
+
except FintechError as e:
|
|
243
|
+
print(f"API error ({e.status_code}): {e.message}")
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Part of Sapliy Fintech Ecosystem
|
|
247
|
+
|
|
248
|
+
- [fintech-ecosystem](https://github.com/Sapliy/fintech-ecosystem) — Core backend
|
|
249
|
+
- [fintech-sdk-node](https://github.com/Sapliy/fintech-sdk-node) — Node.js SDK
|
|
250
|
+
- [fintech-sdk-go](https://github.com/Sapliy/fintech-sdk-go) — Go SDK
|
|
251
|
+
|
|
252
|
+
## License
|
|
253
|
+
|
|
254
|
+
MIT © [Sapliy](https://github.com/sapliy)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
sapliyio_fintech/__init__.py,sha256=2DAWNG-Os91u1vrGNmJ6SsYru-Nq4dW5hnWs75SeKF0,1281
|
|
2
|
+
sapliyio_fintech/api_client.py,sha256=6sXWPBdncpVqG7nbxcGs17PHFedn7HBK-xma3mL8QQg,27833
|
|
3
|
+
sapliyio_fintech/api_response.py,sha256=eMxw1mpmJcoGZ3gs9z6jM4oYoZ10Gjk333s9sKxGv7s,652
|
|
4
|
+
sapliyio_fintech/configuration.py,sha256=AgiCC9O8t_KsTILlZwJtdlzpZRG9bbgWA4K4XUkSrDo,18232
|
|
5
|
+
sapliyio_fintech/exceptions.py,sha256=F2KEnJprvuYOhB2EmIJqfH9aNl0sKlWx1kKR28QmzQY,6570
|
|
6
|
+
sapliyio_fintech/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
+
sapliyio_fintech/rest.py,sha256=3xE7tv1BVl1hZNNpp-3K7_lICVcU5X2HaTf_kPUz5EM,9689
|
|
8
|
+
sapliyio_fintech-1.0.0.dist-info/licenses/LICENSE,sha256=B6WOalWo1F2oEzXNe12QKc57W58900MGSxQH6eHJPXY,1063
|
|
9
|
+
sapliyio_fintech-1.0.0.dist-info/METADATA,sha256=LbTXHxv3H0g8CXqligguXxc5RRsW0uObf6REvk4VMRM,5870
|
|
10
|
+
sapliyio_fintech-1.0.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
11
|
+
sapliyio_fintech-1.0.0.dist-info/top_level.txt,sha256=vfArSMzRxE7n6Ly1x0PSAvDNUCv-k93CY-8JLy9bc9k,17
|
|
12
|
+
sapliyio_fintech-1.0.0.dist-info/RECORD,,
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: sapliyio-fintech
|
|
3
|
-
Version: 0.0.1
|
|
4
|
-
Summary: Official Sapliy Fintech Ecosystem SDK for Python
|
|
5
|
-
Author-email: Sapliy <dev@sapliy.com>
|
|
6
|
-
Project-URL: Homepage, https://github.com/Sapliy/fintech-ecosystem
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.7
|
|
11
|
-
Description-Content-Type: text/markdown
|
|
12
|
-
License-File: LICENSE
|
|
13
|
-
Requires-Dist: requests>=2.25.0
|
|
14
|
-
Dynamic: license-file
|
|
15
|
-
|
|
16
|
-
# Sapliy Fintech Python SDK
|
|
17
|
-
|
|
18
|
-
Official Python SDK for the Sapliy Fintech Ecosystem.
|
|
19
|
-
|
|
20
|
-
## Installation
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
pip install sapliy-fintech
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
```python
|
|
29
|
-
from sapliy_fintech import FintechClient
|
|
30
|
-
|
|
31
|
-
# Initialize the client
|
|
32
|
-
client = FintechClient(api_key="your_api_key")
|
|
33
|
-
|
|
34
|
-
# Example: Record a transaction
|
|
35
|
-
response = client.ledger.record_transaction(
|
|
36
|
-
account_id="acc_123",
|
|
37
|
-
amount=1000,
|
|
38
|
-
currency="USD",
|
|
39
|
-
description="Coffee",
|
|
40
|
-
reference_id="ref_456"
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
print(response)
|
|
44
|
-
```
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
sapliyio_fintech/__init__.py,sha256=Fz7taHihBIRxNTDFd-Bw12a2peIpd1WBNFYVStHiZ9o,6280
|
|
2
|
-
sapliyio_fintech-0.0.1.dist-info/licenses/LICENSE,sha256=B6WOalWo1F2oEzXNe12QKc57W58900MGSxQH6eHJPXY,1063
|
|
3
|
-
sapliyio_fintech-0.0.1.dist-info/METADATA,sha256=dGAWk7BcqTcv-5TvJk9gFoBQrIj6RfOyKbhA5donqcU,1000
|
|
4
|
-
sapliyio_fintech-0.0.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
5
|
-
sapliyio_fintech-0.0.1.dist-info/top_level.txt,sha256=vfArSMzRxE7n6Ly1x0PSAvDNUCv-k93CY-8JLy9bc9k,17
|
|
6
|
-
sapliyio_fintech-0.0.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|