nelsius-pay 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.
- nelsius_pay-1.0.0/PKG-INFO +69 -0
- nelsius_pay-1.0.0/README.md +53 -0
- nelsius_pay-1.0.0/nelsius/__init__.py +1 -0
- nelsius_pay-1.0.0/nelsius/cli.py +63 -0
- nelsius_pay-1.0.0/nelsius/client.py +61 -0
- nelsius_pay-1.0.0/nelsius/managers/__init__.py +1 -0
- nelsius_pay-1.0.0/nelsius/managers/balance.py +9 -0
- nelsius_pay-1.0.0/nelsius/managers/charge.py +15 -0
- nelsius_pay-1.0.0/nelsius/managers/checkout.py +15 -0
- nelsius_pay-1.0.0/nelsius_pay.egg-info/PKG-INFO +69 -0
- nelsius_pay-1.0.0/nelsius_pay.egg-info/SOURCES.txt +15 -0
- nelsius_pay-1.0.0/nelsius_pay.egg-info/dependency_links.txt +1 -0
- nelsius_pay-1.0.0/nelsius_pay.egg-info/entry_points.txt +2 -0
- nelsius_pay-1.0.0/nelsius_pay.egg-info/requires.txt +1 -0
- nelsius_pay-1.0.0/nelsius_pay.egg-info/top_level.txt +1 -0
- nelsius_pay-1.0.0/pyproject.toml +30 -0
- nelsius_pay-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nelsius-pay
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python SDK for the Nelsius Developer API
|
|
5
|
+
Author-email: Nelson Siebi <nelsonsiebi237@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://nelsius.com
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/nelson-siebi/nelsius-pay-python/issues
|
|
8
|
+
Project-URL: Source, https://github.com/nelson-siebi/nelsius-pay-python
|
|
9
|
+
Keywords: nelsius,payments,sdk,api
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.7
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: requests>=2.25.0
|
|
16
|
+
|
|
17
|
+
# Nelsius Python SDK
|
|
18
|
+
|
|
19
|
+
Official Python SDK for the [Nelsius Developer API](https://nelsius.com/api-doc).
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install nelsius-pay
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from nelsius import Nelsius
|
|
31
|
+
|
|
32
|
+
# Initialize the client
|
|
33
|
+
nelsius = Nelsius('your_secret_key', {
|
|
34
|
+
'verify_ssl': False # Set to False for local development
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
# 1. Get available payment methods
|
|
38
|
+
methods = nelsius.methods('CM', 'XAF')
|
|
39
|
+
print("Available methods:", methods)
|
|
40
|
+
|
|
41
|
+
# 2. Create a Checkout Session
|
|
42
|
+
session = nelsius.checkout.create_session({
|
|
43
|
+
'amount': 5000,
|
|
44
|
+
'currency': 'XAF',
|
|
45
|
+
'reference': 'ORDER_12345',
|
|
46
|
+
'return_url': 'https://yoursite.com/success',
|
|
47
|
+
'customer': {
|
|
48
|
+
'email': 'client@example.com',
|
|
49
|
+
'name': 'Jean Dupont'
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
if session.get('success'):
|
|
54
|
+
print("Checkout URL:", session['data']['checkout_url'])
|
|
55
|
+
|
|
56
|
+
# 3. Direct Charge (Mobile Money)
|
|
57
|
+
charge = nelsius.charge.create({
|
|
58
|
+
'amount': 2000,
|
|
59
|
+
'currency': 'XAF',
|
|
60
|
+
'payment_method': 'orange_money_cm',
|
|
61
|
+
'phone': '690000000',
|
|
62
|
+
'reference': 'REF_999'
|
|
63
|
+
})
|
|
64
|
+
print("Charge Result:", charge)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Documentation
|
|
68
|
+
|
|
69
|
+
For full details on the parameters and responses, visit the [official documentation](https://nelsius.com/docs).
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Nelsius Python SDK
|
|
2
|
+
|
|
3
|
+
Official Python SDK for the [Nelsius Developer API](https://nelsius.com/api-doc).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install nelsius-pay
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from nelsius import Nelsius
|
|
15
|
+
|
|
16
|
+
# Initialize the client
|
|
17
|
+
nelsius = Nelsius('your_secret_key', {
|
|
18
|
+
'verify_ssl': False # Set to False for local development
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
# 1. Get available payment methods
|
|
22
|
+
methods = nelsius.methods('CM', 'XAF')
|
|
23
|
+
print("Available methods:", methods)
|
|
24
|
+
|
|
25
|
+
# 2. Create a Checkout Session
|
|
26
|
+
session = nelsius.checkout.create_session({
|
|
27
|
+
'amount': 5000,
|
|
28
|
+
'currency': 'XAF',
|
|
29
|
+
'reference': 'ORDER_12345',
|
|
30
|
+
'return_url': 'https://yoursite.com/success',
|
|
31
|
+
'customer': {
|
|
32
|
+
'email': 'client@example.com',
|
|
33
|
+
'name': 'Jean Dupont'
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
if session.get('success'):
|
|
38
|
+
print("Checkout URL:", session['data']['checkout_url'])
|
|
39
|
+
|
|
40
|
+
# 3. Direct Charge (Mobile Money)
|
|
41
|
+
charge = nelsius.charge.create({
|
|
42
|
+
'amount': 2000,
|
|
43
|
+
'currency': 'XAF',
|
|
44
|
+
'payment_method': 'orange_money_cm',
|
|
45
|
+
'phone': '690000000',
|
|
46
|
+
'reference': 'REF_999'
|
|
47
|
+
})
|
|
48
|
+
print("Charge Result:", charge)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Documentation
|
|
52
|
+
|
|
53
|
+
For full details on the parameters and responses, visit the [official documentation](https://nelsius.com/docs).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .client import Nelsius
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import argparse
|
|
2
|
+
import sys
|
|
3
|
+
import json
|
|
4
|
+
from .client import Nelsius
|
|
5
|
+
|
|
6
|
+
def main():
|
|
7
|
+
parser = argparse.ArgumentParser(description="Nelsius Pay CLI - Interface ligne de commande officielle")
|
|
8
|
+
parser.add_argument('--key', help="Votre Secret Key (ou utilise la variable d'environnement NELSIUS_SECRET_KEY)")
|
|
9
|
+
|
|
10
|
+
subparsers = parser.add_subparsers(dest='command', help='Commandes disponibles')
|
|
11
|
+
|
|
12
|
+
# Commande Balance
|
|
13
|
+
subparsers.add_parser('balance', help='Consulter votre solde')
|
|
14
|
+
|
|
15
|
+
# Commande Methods
|
|
16
|
+
method_parser = subparsers.add_parser('methods', help='Lister les méthodes de paiement')
|
|
17
|
+
method_parser.add_argument('--country', default='CM', help='Code pays (ex: CM, CI)')
|
|
18
|
+
method_parser.add_argument('--currency', default='XAF', help='Code devise (ex: XAF, XOF)')
|
|
19
|
+
|
|
20
|
+
# Commande Checkout
|
|
21
|
+
checkout_parser = subparsers.add_parser('checkout', help='Créer une session de paiement')
|
|
22
|
+
checkout_parser.add_argument('--amount', type=int, required=True, help='Montant')
|
|
23
|
+
checkout_parser.add_argument('--currency', default='XAF', help='Devise')
|
|
24
|
+
checkout_parser.add_argument('--ref', required=True, help='Référence unique')
|
|
25
|
+
|
|
26
|
+
args = parser.parse_args()
|
|
27
|
+
|
|
28
|
+
# Récupération de la clé
|
|
29
|
+
import os
|
|
30
|
+
secret_key = args.key or os.environ.get('NELSIUS_SECRET_KEY')
|
|
31
|
+
|
|
32
|
+
if not secret_key:
|
|
33
|
+
print("Erreur: Clé secrète manquante. Utilisez --key ou positionnez la variable d'environement NELSIUS_SECRET_KEY.")
|
|
34
|
+
sys.exit(1)
|
|
35
|
+
|
|
36
|
+
client = Nelsius(secret_key)
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
if args.command == 'balance':
|
|
40
|
+
result = client.balance.retrieve()
|
|
41
|
+
print(json.dumps(result, indent=2))
|
|
42
|
+
|
|
43
|
+
elif args.command == 'methods':
|
|
44
|
+
result = client.methods(args.country, args.currency)
|
|
45
|
+
print(json.dumps(result, indent=2))
|
|
46
|
+
|
|
47
|
+
elif args.command == 'checkout':
|
|
48
|
+
result = client.checkout.create_session({
|
|
49
|
+
'amount': args.amount,
|
|
50
|
+
'currency': args.currency,
|
|
51
|
+
'reference': args.ref,
|
|
52
|
+
'return_url': 'https://example.com/success'
|
|
53
|
+
})
|
|
54
|
+
print(json.dumps(result, indent=2))
|
|
55
|
+
else:
|
|
56
|
+
parser.print_help()
|
|
57
|
+
|
|
58
|
+
except Exception as e:
|
|
59
|
+
print(f"Erreur lors de l'exécution : {str(e)}")
|
|
60
|
+
sys.exit(1)
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
main()
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
from .managers.checkout import CheckoutManager
|
|
3
|
+
from .managers.charge import ChargeManager
|
|
4
|
+
from .managers.balance import BalanceManager
|
|
5
|
+
|
|
6
|
+
class Nelsius:
|
|
7
|
+
"""
|
|
8
|
+
Nelsius Pay Python SDK Client
|
|
9
|
+
"""
|
|
10
|
+
def __init__(self, secret_key, options=None):
|
|
11
|
+
self.secret_key = secret_key
|
|
12
|
+
self.options = options or {}
|
|
13
|
+
self.base_url = self.options.get('base_url', 'https://api.nelsius.com')
|
|
14
|
+
self.verify_ssl = self.options.get('verify_ssl', True)
|
|
15
|
+
|
|
16
|
+
# Initialize Managers
|
|
17
|
+
self.checkout = CheckoutManager(self)
|
|
18
|
+
self.charge = ChargeManager(self)
|
|
19
|
+
self.balance = BalanceManager(self)
|
|
20
|
+
|
|
21
|
+
def request(self, method, endpoint, data=None, params=None):
|
|
22
|
+
url = f"{self.base_url.rstrip('/')}/{endpoint.lstrip('/')}"
|
|
23
|
+
|
|
24
|
+
headers = {
|
|
25
|
+
'Authorization': f'Bearer {self.secret_key}',
|
|
26
|
+
'Accept': 'application/json',
|
|
27
|
+
'Content-Type': 'application/json',
|
|
28
|
+
'X-SDK-Platform': 'python'
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try:
|
|
32
|
+
response = requests.request(
|
|
33
|
+
method=method,
|
|
34
|
+
url=url,
|
|
35
|
+
json=data,
|
|
36
|
+
params=params,
|
|
37
|
+
headers=headers,
|
|
38
|
+
verify=self.verify_ssl
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Simple error handling (matching Node.js/PHP behavior)
|
|
42
|
+
return response.json()
|
|
43
|
+
|
|
44
|
+
except requests.exceptions.RequestException as e:
|
|
45
|
+
return {
|
|
46
|
+
'success': False,
|
|
47
|
+
'message': f'Request failed: {str(e)}',
|
|
48
|
+
'error': str(e)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
def methods(self, country=None, currency=None):
|
|
52
|
+
"""
|
|
53
|
+
Get available payment methods
|
|
54
|
+
"""
|
|
55
|
+
params = {}
|
|
56
|
+
if country:
|
|
57
|
+
params['country'] = country
|
|
58
|
+
if currency:
|
|
59
|
+
params['currency'] = currency
|
|
60
|
+
|
|
61
|
+
return self.request('GET', '/api/v1/payment-methods', params=params)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Managers package
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class ChargeManager:
|
|
2
|
+
def __init__(self, client):
|
|
3
|
+
self.client = client
|
|
4
|
+
|
|
5
|
+
def create(self, data):
|
|
6
|
+
"""
|
|
7
|
+
Initiate a direct charge (Mobile Money, etc.)
|
|
8
|
+
"""
|
|
9
|
+
return self.client.request('POST', '/api/v1/charges', data=data)
|
|
10
|
+
|
|
11
|
+
def retrieve(self, charge_id):
|
|
12
|
+
"""
|
|
13
|
+
Retrieve a charge status
|
|
14
|
+
"""
|
|
15
|
+
return self.client.request('GET', f'/api/v1/charges/{charge_id}')
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CheckoutManager:
|
|
2
|
+
def __init__(self, client):
|
|
3
|
+
self.client = client
|
|
4
|
+
|
|
5
|
+
def create_session(self, data):
|
|
6
|
+
"""
|
|
7
|
+
Create a hosted checkout session
|
|
8
|
+
"""
|
|
9
|
+
return self.client.request('POST', '/api/v1/checkout/sessions', data=data)
|
|
10
|
+
|
|
11
|
+
def retrieve(self, session_id):
|
|
12
|
+
"""
|
|
13
|
+
Retrieve a checkout session status
|
|
14
|
+
"""
|
|
15
|
+
return self.client.request('GET', f'/api/v1/checkout/sessions/{session_id}')
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: nelsius-pay
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Official Python SDK for the Nelsius Developer API
|
|
5
|
+
Author-email: Nelson Siebi <nelsonsiebi237@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://nelsius.com
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/nelson-siebi/nelsius-pay-python/issues
|
|
8
|
+
Project-URL: Source, https://github.com/nelson-siebi/nelsius-pay-python
|
|
9
|
+
Keywords: nelsius,payments,sdk,api
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.7
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
Requires-Dist: requests>=2.25.0
|
|
16
|
+
|
|
17
|
+
# Nelsius Python SDK
|
|
18
|
+
|
|
19
|
+
Official Python SDK for the [Nelsius Developer API](https://nelsius.com/api-doc).
|
|
20
|
+
|
|
21
|
+
## Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install nelsius-pay
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from nelsius import Nelsius
|
|
31
|
+
|
|
32
|
+
# Initialize the client
|
|
33
|
+
nelsius = Nelsius('your_secret_key', {
|
|
34
|
+
'verify_ssl': False # Set to False for local development
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
# 1. Get available payment methods
|
|
38
|
+
methods = nelsius.methods('CM', 'XAF')
|
|
39
|
+
print("Available methods:", methods)
|
|
40
|
+
|
|
41
|
+
# 2. Create a Checkout Session
|
|
42
|
+
session = nelsius.checkout.create_session({
|
|
43
|
+
'amount': 5000,
|
|
44
|
+
'currency': 'XAF',
|
|
45
|
+
'reference': 'ORDER_12345',
|
|
46
|
+
'return_url': 'https://yoursite.com/success',
|
|
47
|
+
'customer': {
|
|
48
|
+
'email': 'client@example.com',
|
|
49
|
+
'name': 'Jean Dupont'
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
if session.get('success'):
|
|
54
|
+
print("Checkout URL:", session['data']['checkout_url'])
|
|
55
|
+
|
|
56
|
+
# 3. Direct Charge (Mobile Money)
|
|
57
|
+
charge = nelsius.charge.create({
|
|
58
|
+
'amount': 2000,
|
|
59
|
+
'currency': 'XAF',
|
|
60
|
+
'payment_method': 'orange_money_cm',
|
|
61
|
+
'phone': '690000000',
|
|
62
|
+
'reference': 'REF_999'
|
|
63
|
+
})
|
|
64
|
+
print("Charge Result:", charge)
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Documentation
|
|
68
|
+
|
|
69
|
+
For full details on the parameters and responses, visit the [official documentation](https://nelsius.com/docs).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
nelsius/__init__.py
|
|
4
|
+
nelsius/cli.py
|
|
5
|
+
nelsius/client.py
|
|
6
|
+
nelsius/managers/__init__.py
|
|
7
|
+
nelsius/managers/balance.py
|
|
8
|
+
nelsius/managers/charge.py
|
|
9
|
+
nelsius/managers/checkout.py
|
|
10
|
+
nelsius_pay.egg-info/PKG-INFO
|
|
11
|
+
nelsius_pay.egg-info/SOURCES.txt
|
|
12
|
+
nelsius_pay.egg-info/dependency_links.txt
|
|
13
|
+
nelsius_pay.egg-info/entry_points.txt
|
|
14
|
+
nelsius_pay.egg-info/requires.txt
|
|
15
|
+
nelsius_pay.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
requests>=2.25.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nelsius
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "nelsius-pay"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Nelson Siebi", email="nelsonsiebi237@gmail.com" },
|
|
10
|
+
]
|
|
11
|
+
description = "Official Python SDK for the Nelsius Developer API"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.7"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"requests>=2.25.0",
|
|
16
|
+
]
|
|
17
|
+
keywords = ["nelsius", "payments", "sdk", "api"]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"License :: OSI Approved :: MIT License",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
"Homepage" = "https://nelsius.com"
|
|
26
|
+
"Bug Tracker" = "https://github.com/nelson-siebi/nelsius-pay-python/issues"
|
|
27
|
+
"Source" = "https://github.com/nelson-siebi/nelsius-pay-python"
|
|
28
|
+
|
|
29
|
+
[project.scripts]
|
|
30
|
+
nelsius-pay = "nelsius.cli:main"
|