Skip to content

Commit 6ba2e0f

Browse files
committed
create setup script
1 parent 621f227 commit 6ba2e0f

6 files changed

Lines changed: 99 additions & 40 deletions

File tree

LICENSE.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License
2+
3+
Copyright (c) 2019 Qubeans, LLC. http://soofapay.org
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
13+
all 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
21+
THE SOFTWARE.

python_soofa/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from python_soofa.transaction import Transaction
2+
from python_soofa.soofa import Soofa
3+

soofa.py renamed to python_soofa/soofa.py

Lines changed: 8 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,13 @@
11
import requests
22
import logging
33

4-
from datetime import datetime
4+
from python_soofa import Transaction
55

6-
__all__ = ["Transaction", "Soofa"]
6+
__all__ = ["Soofa"]
77

88
logging.basicConfig(format='%(levelname)s - %(asctime)s - %(message)s', level=logging.INFO)
99

1010

11-
class Transaction(object):
12-
def __init__(self, status, sender_currency, receiver_currency, tid, reference, sender, receiver,
13-
receipt_no, timestamp, gross_amount, net_amount, transacted_via, is_money_in, **kwargs):
14-
self.sender = sender
15-
self.sender_currency = sender_currency
16-
self.status = status
17-
self.receiver_currency = receiver_currency
18-
self.tid = tid
19-
self.reference = reference
20-
self.receiver = receiver
21-
self.receipt_no = receipt_no
22-
self.timestamp = timestamp
23-
self.gross_amount = gross_amount
24-
self.net_amount = net_amount
25-
self.transacted_via = transacted_via
26-
self.is_money_in=is_money_in
27-
28-
def json(self):
29-
return {
30-
"status": self.status,
31-
"sender_currency": self.sender_currency,
32-
"receiver_currency": self.receiver_currency,
33-
"tid": self.tid,
34-
"reference": self.reference,
35-
"receipt_no": self.receipt_no,
36-
"timestamp": self.timestamp,
37-
"gross_amount": self.gross_amount,
38-
"net_amount": self.net_amount,
39-
"transacted_via": self.transacted_via,
40-
"is_money_in": self.is_money_in,
41-
"sender": self.sender,
42-
"receiver": self.receiver
43-
}
44-
45-
def get_time(self):
46-
return datetime.fromtimestamp(self.timestamp)
47-
48-
4911
class Soofa(object):
5012
TRANSACTION_DOES_NOT_EXIST = 404
5113
PERMISSION_DENIED = 403
@@ -97,3 +59,9 @@ def get_balance(self):
9759
return r.json()
9860

9961

62+
if __name__ == '__main__':
63+
soofa = Soofa("5002", '3ixwt45uq88wttqgixpyla8d27ob0w')
64+
exists = soofa.find("QTMB6")
65+
if exists:
66+
trx: Transaction = soofa.get_transaction()
67+
print(trx.json())

python_soofa/transaction.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from datetime import datetime
2+
3+
__all__=["Transaction"]
4+
5+
class Transaction(object):
6+
def __init__(self, status, sender_currency, receiver_currency, tid, reference, sender, receiver,
7+
receipt_no, timestamp, gross_amount, net_amount, transacted_via, is_money_in, **kwargs):
8+
self.sender = sender
9+
self.sender_currency = sender_currency
10+
self.status = status
11+
self.receiver_currency = receiver_currency
12+
self.tid = tid
13+
self.reference = reference
14+
self.receiver = receiver
15+
self.receipt_no = receipt_no
16+
self.timestamp = timestamp
17+
self.gross_amount = gross_amount
18+
self.net_amount = net_amount
19+
self.transacted_via = transacted_via
20+
self.is_money_in=is_money_in
21+
22+
def json(self):
23+
return {
24+
"status": self.status,
25+
"sender_currency": self.sender_currency,
26+
"receiver_currency": self.receiver_currency,
27+
"tid": self.tid,
28+
"reference": self.reference,
29+
"receipt_no": self.receipt_no,
30+
"timestamp": self.timestamp,
31+
"gross_amount": self.gross_amount,
32+
"net_amount": self.net_amount,
33+
"transacted_via": self.transacted_via,
34+
"is_money_in": self.is_money_in,
35+
"sender": self.sender,
36+
"receiver": self.receiver
37+
}
38+
39+
def get_time(self):
40+
return datetime.fromtimestamp(self.timestamp)

setup.cfg

Whitespace-only changes.

setup.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from distutils.core import setup
2+
setup(
3+
name = 'python-soofa',
4+
packages = ['python-soofa'],
5+
version = '0.1.2',
6+
license='MIT',
7+
description = 'Python package to simplify integration to soofapay',
8+
author = 'Soofapay Team',
9+
author_email = 'info@soofapay.com',
10+
url = 'https://github.com/soofapay/python-soofa',
11+
download_url = 'https://github.com/soofapay/python-soofa/archive/v_012.tar.gz',
12+
keywords = ['soofa', 'soofapay', 'pay', "python"],
13+
install_requires=[
14+
'requests',
15+
],
16+
classifiers=[
17+
'Development Status :: 3 - Alpha', # Chose either "3 - Alpha", "4 - Beta" or "5 - Production/Stable" as the current state of your package
18+
'Intended Audience :: Developers',
19+
'Topic :: Software Development :: Build Tools',
20+
'License :: OSI Approved :: MIT License',
21+
'Programming Language :: Python :: 2.7',
22+
'Programming Language :: Python :: 3',
23+
'Programming Language :: Python :: 3.4',
24+
'Programming Language :: Python :: 3.5',
25+
'Programming Language :: Python :: 3.6',
26+
],
27+
)

0 commit comments

Comments
 (0)