viaro 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.
viaro-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,126 @@
1
+ Metadata-Version: 2.4
2
+ Name: viaro
3
+ Version: 1.0.0
4
+ Summary: Official Viaro Python SDK (Sync & Async) for Payments, Subscriptions, Mobile Money, Cards, Invoices, and Webhooks.
5
+ Author-email: Viaro Engineering <developers@viaro.com>
6
+ License-Expression: MIT
7
+ Keywords: viaro,payments,subscriptions,cemac,xaf,mobile-money,fintech,sdk
8
+ Requires-Python: >=3.10
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: httpx>=0.25.0
11
+ Provides-Extra: dev
12
+ Requires-Dist: pytest>=7.4.0; extra == "dev"
13
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
14
+ Requires-Dist: mypy>=1.8.0; extra == "dev"
15
+ Requires-Dist: ruff>=0.3.0; extra == "dev"
16
+
17
+ # `viaro` — Official Viaro Python SDK (Sync & Async)
18
+
19
+ Official Python 3.10+ SDK for the **Viaro API (`/v1`)**, supporting both synchronous (`Viaro`) and asynchronous (`AsyncViaro`) clients for **Payment Intents**, **Subscriptions & Recurring Billing**, **Mobile Money (MTN MoMo, Orange Money, Airtel)**, **Card Tokenization**, **Payment Links**, **Invoices**, **Refunds**, **Balance & Payouts**, and **HMAC-SHA256 Webhook Verification**.
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install viaro
25
+ ```
26
+
27
+ ## Quick Start (Synchronous)
28
+
29
+ ```python
30
+ import os
31
+ from viaro import Viaro
32
+
33
+ viaro = Viaro(os.environ["VIARO_SECRET_KEY"]) # sk_live_... or sk_test_...
34
+
35
+ intent = viaro.payments.create(
36
+ amount=15000,
37
+ currency="XAF",
38
+ phone="+237677000000",
39
+ email="buyer@example.com",
40
+ payment_method="mobile_money",
41
+ network="MTN",
42
+ description="Order #4821",
43
+ )
44
+ print(intent.id, intent.status)
45
+ ```
46
+
47
+ ## Quick Start (Asynchronous / FastAPI)
48
+
49
+ ```python
50
+ import os
51
+ from viaro import AsyncViaro
52
+
53
+
54
+ async def create_subscription():
55
+ async with AsyncViaro(os.environ["VIARO_SECRET_KEY"]) as viaro:
56
+ plan = await viaro.plans.create(
57
+ name="Viaro Cloud Pro",
58
+ code="viaro-cloud-pro-monthly",
59
+ amount=25000,
60
+ currency="XAF",
61
+ billing_cycle="monthly",
62
+ trial_days=14,
63
+ )
64
+
65
+ sub = await viaro.subscriptions.create(
66
+ customer_id="cus_9f8e7d6c5b",
67
+ plan_id=plan.id,
68
+ payment_method="mobile_money",
69
+ mobile_money={
70
+ "phone": "+237670112233",
71
+ "network": "MTN",
72
+ "country": "CM",
73
+ },
74
+ preferred_time={
75
+ "hour": 18,
76
+ "minute": 30,
77
+ "timezone": "Africa/Douala",
78
+ },
79
+ fallback={
80
+ "type": "card",
81
+ "enabled": True,
82
+ "trigger_after_failures": 2,
83
+ "card": {
84
+ "token": "tok_visa_4242",
85
+ "last_four": "4242",
86
+ "brand": "visa",
87
+ "exp_month": 12,
88
+ "exp_year": 2029,
89
+ },
90
+ },
91
+ )
92
+ return sub
93
+ ```
94
+
95
+ ## Webhook Signature Verification (`X-Viaro-Signature`)
96
+
97
+ ```python
98
+ import os
99
+ from fastapi import FastAPI, Header, HTTPException, Request
100
+ from viaro import Viaro, ViaroSignatureVerificationError
101
+
102
+ app = FastAPI()
103
+ viaro = Viaro(os.environ["VIARO_SECRET_KEY"])
104
+
105
+
106
+ @app.post("/webhooks/viaro")
107
+ async def handle_viaro_webhook(
108
+ request: Request,
109
+ x_viaro_signature: str = Header(None, alias="X-Viaro-Signature"),
110
+ ):
111
+ raw_body = await request.body()
112
+ try:
113
+ event = viaro.webhooks.construct_event(
114
+ payload=raw_body,
115
+ sig_header=x_viaro_signature,
116
+ secret=os.environ["VIARO_WEBHOOK_SECRET"],
117
+ )
118
+ except ViaroSignatureVerificationError as exc:
119
+ raise HTTPException(status_code=400, detail=str(exc))
120
+
121
+ if event.type in ("payment_intent.succeeded", "subscription.renewed"):
122
+ obj = event.data.object
123
+ print("Verified event:", event.id, obj.id)
124
+
125
+ return {"received": True}
126
+ ```
viaro-1.0.0/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # `viaro` — Official Viaro Python SDK (Sync & Async)
2
+
3
+ Official Python 3.10+ SDK for the **Viaro API (`/v1`)**, supporting both synchronous (`Viaro`) and asynchronous (`AsyncViaro`) clients for **Payment Intents**, **Subscriptions & Recurring Billing**, **Mobile Money (MTN MoMo, Orange Money, Airtel)**, **Card Tokenization**, **Payment Links**, **Invoices**, **Refunds**, **Balance & Payouts**, and **HMAC-SHA256 Webhook Verification**.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install viaro
9
+ ```
10
+
11
+ ## Quick Start (Synchronous)
12
+
13
+ ```python
14
+ import os
15
+ from viaro import Viaro
16
+
17
+ viaro = Viaro(os.environ["VIARO_SECRET_KEY"]) # sk_live_... or sk_test_...
18
+
19
+ intent = viaro.payments.create(
20
+ amount=15000,
21
+ currency="XAF",
22
+ phone="+237677000000",
23
+ email="buyer@example.com",
24
+ payment_method="mobile_money",
25
+ network="MTN",
26
+ description="Order #4821",
27
+ )
28
+ print(intent.id, intent.status)
29
+ ```
30
+
31
+ ## Quick Start (Asynchronous / FastAPI)
32
+
33
+ ```python
34
+ import os
35
+ from viaro import AsyncViaro
36
+
37
+
38
+ async def create_subscription():
39
+ async with AsyncViaro(os.environ["VIARO_SECRET_KEY"]) as viaro:
40
+ plan = await viaro.plans.create(
41
+ name="Viaro Cloud Pro",
42
+ code="viaro-cloud-pro-monthly",
43
+ amount=25000,
44
+ currency="XAF",
45
+ billing_cycle="monthly",
46
+ trial_days=14,
47
+ )
48
+
49
+ sub = await viaro.subscriptions.create(
50
+ customer_id="cus_9f8e7d6c5b",
51
+ plan_id=plan.id,
52
+ payment_method="mobile_money",
53
+ mobile_money={
54
+ "phone": "+237670112233",
55
+ "network": "MTN",
56
+ "country": "CM",
57
+ },
58
+ preferred_time={
59
+ "hour": 18,
60
+ "minute": 30,
61
+ "timezone": "Africa/Douala",
62
+ },
63
+ fallback={
64
+ "type": "card",
65
+ "enabled": True,
66
+ "trigger_after_failures": 2,
67
+ "card": {
68
+ "token": "tok_visa_4242",
69
+ "last_four": "4242",
70
+ "brand": "visa",
71
+ "exp_month": 12,
72
+ "exp_year": 2029,
73
+ },
74
+ },
75
+ )
76
+ return sub
77
+ ```
78
+
79
+ ## Webhook Signature Verification (`X-Viaro-Signature`)
80
+
81
+ ```python
82
+ import os
83
+ from fastapi import FastAPI, Header, HTTPException, Request
84
+ from viaro import Viaro, ViaroSignatureVerificationError
85
+
86
+ app = FastAPI()
87
+ viaro = Viaro(os.environ["VIARO_SECRET_KEY"])
88
+
89
+
90
+ @app.post("/webhooks/viaro")
91
+ async def handle_viaro_webhook(
92
+ request: Request,
93
+ x_viaro_signature: str = Header(None, alias="X-Viaro-Signature"),
94
+ ):
95
+ raw_body = await request.body()
96
+ try:
97
+ event = viaro.webhooks.construct_event(
98
+ payload=raw_body,
99
+ sig_header=x_viaro_signature,
100
+ secret=os.environ["VIARO_WEBHOOK_SECRET"],
101
+ )
102
+ except ViaroSignatureVerificationError as exc:
103
+ raise HTTPException(status_code=400, detail=str(exc))
104
+
105
+ if event.type in ("payment_intent.succeeded", "subscription.renewed"):
106
+ obj = event.data.object
107
+ print("Verified event:", event.id, obj.id)
108
+
109
+ return {"received": True}
110
+ ```
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0.3", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "viaro"
7
+ version = "1.0.0"
8
+ description = "Official Viaro Python SDK (Sync & Async) for Payments, Subscriptions, Mobile Money, Cards, Invoices, and Webhooks."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ authors = [
13
+ { name = "Viaro Engineering", email = "developers@viaro.com" }
14
+ ]
15
+ keywords = ["viaro", "payments", "subscriptions", "cemac", "xaf", "mobile-money", "fintech", "sdk"]
16
+ dependencies = [
17
+ "httpx>=0.25.0",
18
+ ]
19
+
20
+ [project.optional-dependencies]
21
+ dev = [
22
+ "pytest>=7.4.0",
23
+ "pytest-asyncio>=0.21.0",
24
+ "mypy>=1.8.0",
25
+ "ruff>=0.3.0",
26
+ ]
27
+
28
+ [tool.setuptools.packages.find]
29
+ where = ["."]
30
+ include = ["viaro*"]
31
+
32
+ [tool.pytest.ini_options]
33
+ asyncio_mode = "auto"
34
+ asyncio_default_fixture_loop_scope = "function"
35
+ testpaths = ["tests"]
36
+
37
+ [tool.ruff]
38
+ line-length = 100
39
+ target-version = "py310"
40
+
41
+ [tool.ruff.lint]
42
+ select = ["E", "F", "I", "W", "B", "UP", "BLE", "PYI", "RUF"]
43
+
44
+ [tool.ruff.lint.isort]
45
+ known-first-party = ["viaro"]
viaro-1.0.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+