Skip to content

Commit

Permalink
[IMP] Details of transactio
Browse files Browse the repository at this point in the history
  • Loading branch information
rivo2302 committed Jun 1, 2022
1 parent d3e9199 commit a3f4168
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 32 deletions.
83 changes: 74 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<p align="center">
<img height="400" src="https://raw.githubusercontent.com/rivo2302/Mvola/master/assets/icon.png">
</p>

<div align="center">
<p>
A <b>light</b> Python module for your <a href="https://www.mvola.mg/devportal/"> API Mvola </a>.
Expand Down Expand Up @@ -34,7 +33,7 @@
You can consult the link on pypi.org <a href="https://pypi.org/project/mvola/">here</a> for mode documentation.

```s
pip install mvola==1.0.1
pip install mvola==1.0.2
```

## USAGE
Expand All @@ -50,13 +49,16 @@ After you create application , you should have Consummer_key and Consummer_secre
from mvola import Mvola

# Initiate the api => API(Consummer_key, Consummer_secret)
api = Mvola("{consummer_key}","{consummer_secret}")
api = Mvola("{{consummer_key}}","{{consummenr_secret}}")
```

### Generate token
Check the documentation <a href="https://www.mvola.mg/devportal/apis/5fb6b560-ef7e-49ad-b3c7-5335b7ca45f6/documents/89b6b1d0-b3c9-4758-a548-47889825bc68"> here</a>

```python
from mvola import Mvola
api = Mvola("{{consummer_key}}","{{consummenr_secret}}")

res = api.generate_token()
if res.success :
api.token = res
Expand Down Expand Up @@ -115,7 +117,7 @@ transaction = Transaction(
res = api.init_transaction(transaction)

if res.success :
print(res.value)
print(res.response)
else :
print(f"Status_code [{res.status_code}] \n {res.error}")
```
Expand Down Expand Up @@ -145,21 +147,22 @@ else :
Check the documentation <a href="https://www.mvola.mg/devportal/apis/5fb6b560-ef7e-49ad-b3c7-5335b7ca45f6/documents/b36ca2a3-f339-43a1-88d3-bbee6c77b06f"> here</a>

```python

from mvola.tools import Transaction

transaction = Transaction(
token="{{token}}", # [Token] Requiered fields
token="{{token}}", # [Token] Required fields
user_language="FR", # MG or FR
user_account_identifier="0343500003", # [UserAccountIdentifier] Requiered fields
user_account_identifier="0343500003", # [UserAccountIdentifier] Required fields
partner_name="Marketbot", # Name of your application
server_correlation_id='c8e9e922-b965-4515-b390-137b41c9f40b' , # The response when you initiate transaction
server_correlation_id='c8e9e922-b965-4515-b390-137b41c9f40b' , # [server_correlation_id] Required fields , The response when you initiate transaction
)

# Status of transaction
res = api.init_transaction(transaction)
res = api.status_transaction(transaction)

if res.success :
print(res.value)
print(res.response)
else :
print(f"Status_code [{res.status_code}] \n {res.error}")
```
Expand All @@ -185,6 +188,68 @@ else :
}
```


#### Details of Transaction
Check the documentation <a href="https://www.mvola.mg/devportal/apis/5fb6b560-ef7e-49ad-b3c7-5335b7ca45f6/documents/b36ca2a3-f339-43a1-88d3-bbee6c77b06f"> here</a>

```python
from mvola.tools import Transaction

transaction = Transaction(
token="eyJ4NXQiOiJPRE5tWkRFMll6UTRNVEkxTVRZME1tSmhaR00yTUdWa1lUZGhOall5TWpnM01XTmpNalJqWWpnMll6bGpNRGRsWWpZd05ERmhZVGd6WkRoa1lUVm1OZyIsImtpZCI6Ik9ETm1aREUyWXpRNE1USTFNVFkwTW1KaFpHTTJNR1ZrWVRkaE5qWXlNamczTVdOak1qUmpZamcyWXpsak1EZGxZall3TkRGaFlUZ3paRGhrWVRWbU5nX1JTMjU2IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJyaXZvMjMwMkBnbWFpbC5jb21AY2FyYm9uLnN1cGVyIiwiYXV0IjoiQVBQTElDQVRJT04iLCJhdWQiOiIwekw3ZVRyU0VmWGY2a2t3SjUzRFNlZ0NiQndhIiwibmJmIjoxNjU0MTA4ODg2LCJhenAiOiIwekw3ZVRyU0VmWGY2a2t3SjUzRFNlZ0NiQndhIiwic2NvcGUiOiJFWFRfSU5UX01WT0xBX1NDT1BFIiwiaXNzIjoiaHR0cHM6XC9cL2FwaW0ucHJlcC50ZWxtYS5tZzo5NDQzXC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNjU0MTEyNDg2LCJpYXQiOjE2NTQxMDg4ODYsImp0aSI6IjVlOGY5ZjFhLWUxODItNGZkMS04ZjUyLWU2YTIzMzljYTIzMCJ9.voIBGWbGiI7vFklcmHiufu5fW1UvlE79c7MNOZZisuGD7HQ8P4CFljBhbQQj8lHnd8u48KFdLxHWwg4SozDejPlTFmeDdHaE8UoYhTsVthYgG5eKN3ZSQ0LSyYyeLbxA25vssvVSkQBCX-4EtcrH_vgEnZiJotBqD8PhicuwtvJuiqm3lbkFcGpNNtVGlUD8Q_xxBt31Az044qJ3BYTcmnG1tXmjRzQNyNrGe3rnQxbnndqg1gHrr-st8bulgODHWGZ3vKkmpdXnMxAn6sYjPRZ0YOdfdQwpgYK8HpLh1oI8VtTsw8oqTiVXpk-4F00qXjqihVd66len-BS48DIsig",
user_language="FR",
user_account_identifier="0343500003",
partner_name="Marketbot",
transid="636251274" # Transaction ID [Required] Fields on details transaction
)
res = api.details_transaction(transaction)
if res.success :
print(res.response)
else :
print(f"Status_code [{res.status_code}] \n {res.error}")
```
###### OUTPUT
```python
{
'amount': '5555.00',
'currency': 'Ar',
'requestDate': '2022-06-01T19:15:52.848Z',
'debitParty':
[
{
'key': 'msisdn',
'value': '0343500003'
}
],
'creditParty':
[
{
'key': 'msisdn',
'value': '0343500004'
}
],
'fees':
[
{'feeAmount': '84'}
],
'metadata':
[
{
'key': 'originalTransactionResult',
'value': '0'
},
{
'key': 'originalTransactionResultDesc',
'value': '0'
}
],
'transactionStatus': 'completed',
'creationDate': '2022-06-01T19:07:24.223Z',
'transactionReference': '636251282' , #This is the transaction ID
}

```

## How to contribute ?

- Make a fork of the repository
Expand Down
33 changes: 24 additions & 9 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,51 @@

# INITIATE TRANSACTION
transaction = Transaction(
token="eyJ4NXQiOiJPRE5tWkRFMll6UTRNVEkxTVRZME1tSmhaR00yTUdWa1lUZGhOall5TWpnM01XTmpNalJqWWpnMll6bGpNRGRsWWpZd05ERmh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a1lUVm1OZyIsImtpZCI6Ik9ETm1aREUyWXpRNE1USTFNVFkwTW1KaFpHTTJNR1ZrWVRkaE5qWXlNamczTVdOak1qUmpZamcyWXpsak1EZGxZall3TkRGaFlUZ3paRGhrWVRWbU5nX1JTMjU2IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJyaXZvMjMwMkBnbWFpbC5jb21AY2FyYm9uLnN1cGVyIiwiYXV0IjoiQVBQTElDQVRJT04iLCJhdWQiOiIwekw3ZVRyU0VmWGY2a2t3SjUzRFNlZ0NiQndhIiwibmJmIjoxNjU0MTA4ODg2LCJhenAiOiIwekw3ZVRyU0VmWGY2a2t3SjUzRFNlZ0NiQndhIiwic2NvcGUiOiJFWFRfSU5UX01WT0xBX1NDT1BFIiwiaXNzIjoiaHR0cHM6XC9cL2FwaW0ucHJlcC50ZWxtYS5tZzo5NDQzXC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNjU0MTEyNDg2LCJpYXQiOjE2NTQxMDg4ODYsImp0aSI6IjVlOGY5ZjFhLWUxODItNGZkMS04ZjUyLWU2YTIzMzljYTIzMCJ9.voIBGWbGiI7vFklcmHiufu5fW1UvlE79c7MNOZZisuGD7HQ8P4CFljBhbQQj8lHnd8u48KFdLxHWwg4SozDejPlTFmeDdHaE8UoYhTsVthYgG5eKN3ZSQ0LSyYyeLbxA25vssvVSkQBCX-4EtcrH_vgEnZiJotBqD8PhicuwtvJuiqm3lbkFcGpNNtVGlUD8Q_xxBt31Az044qJ3BYTcmnG1tXmjRzQNyNrGe3rnQxbnndqg1gHrr-st8bulgODHWGZ3vKkmpdXnMxAn6sYjPRZ0YOdfdQwpgYK8HpLh1oI8VtTsw8oqTiVXpk-4F00qXjqihVd66len-BS48DIsig",
user_language="FR",
user_account_identifier="0343500003",
partner_name="Marketbot",
x_callback_url="https://2809-102-16-43-64.ngrok.io",
amount="1500",
x_callback_url="https://a978-154-126-10-61.ngrok.io/",
amount="5555",
currency="Ar",
original_transaction_reference="orgina",
requesting_organisation_transaction_reference="ozcbajq",
description_text="fevvs",
request_date="2022-05-07T12:03:10.567Z",
request_date="2022-06-01T22:08:10.567Z",
debit="0343500003",
credit="0343500004",
)
init = api.init_transaction(transaction)
if init.success :
print(init.value)
print(init.response)
else :
print(f"Status_code:[{init.status_code}] - {init.error}")

# STATUS TRANSACTION
# STATUS OF TRANSACTION
transaction = Transaction(
token="eyJ4NXQiOiJPRE5tWkRFMll6UTRNVEkxTVRZME1tSmhaR00yTUdWa1lUZGhOall5TWpnM01XTmpNalJqWWpnMll6bGpNRGRsWWpZd05ERmhZVGd6WkRoa1lUVm1OZyIsImtpZCI6Ik9ETm1aREUyWXpRNE1USTFNVFkwTW1KaFpHTTJNR1ZrWVRkaE5qWXlNamczTVdOak1qUmpZamcyWXpsak1EZGxZall3TkRGaFlUZ3paRGhrWVRWbU5nX1JTMjU2IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJyaXZvMjMwMkBnbWFpbC5jb21AY2FyYm9uLnN1cGVyIiwiYXV0IjoiQVBQTElDQVRJT04iLCJhdWQiOiIwekw3ZVRyU0VmWGY2a2t3SjUzRFNlZ0NiQndhIiwibmJmIjoxNjUzNzI5MzAyLCJhenAiOiIwekw3ZVRyU0VmWGY2a2t3SjUzRFNlZ0NiQndhIiwic2NvcGUiOiJFWFRfSU5UX01WT0xBX1NDT1BFIiwiaXNzIjoiaHR0cHM6XC9cL2FwaW0ucHJlcC50ZWxtYS5tZzo5NDQzXC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNjUzNzMyOTAyLCJpYXQiOjE2NTM3MjkzMDIsImp0aSI6IjhkZjI1MWU3LWUzZTAtNGNiNy1hNjU0LTc3NmI3NWJlZTM0MiJ9.f6SvY8sS5BVD6eCt5n1jLhZl_cCVRjOciqWkj1bDuC31oJUKAjs9i00dmc4YTwH76ne5FgAzUvItLxenq9qjOHYLGZBrnAG5Z-v3pKh0qNMkyVXmkyn3xzLfyGsKCuy8C_mRFcVtnj3RVq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BqD8PhicuwtvJuiqm3lbkFcGpNNtVGlUD8Q_xxBt31Az044qJ3BYTcmnG1tXmjRzQNyNrGe3rnQxbnndqg1gHrr-st8bulgODHWGZ3vKkmpdXnMxAn6sYjPRZ0YOdfdQwpgYK8HpLh1oI8VtTsw8oqTiVXpk-4F00qXjqihVd66len-BS48DIsig",
user_language="FR",
user_account_identifier="0343500003",
partner_name="Marketbot",
server_correlation_id='bf9f849b-c9c4-4d09-921d-953f988179e4'
server_correlation_id='72c5142d-5132-4f66-ac98-af905ba2c9ec'
)
res = api.status_transaction(transaction)
if res.success :
print(res.value)
print(res.response)
else :
print(f"Status_code [{res.status_code}] \n {res.error}")


# DETAILS OF TRANSACTION
transaction = Transaction(
token="eyJ4NXQiOiJPRE5tWkRFMll6UTRNVEkxTVRZME1tSmhaR00yTUdWa1lUZGhOall5TWpnM01XTmpNalJqWWpnMll6bGpNRGRsWWpZd05ERmhZVGd6WkRoa1lUVm1OZyIsImtpZCI6Ik9ETm1aREUyWXpRNE1USTFNVFkwTW1KaFpHTTJNR1ZrWVRkaE5qWXlNamczTVdOak1qUmpZamcyWXpsak1EZGxZall3TkRGaFlUZ3paRGhrWVRWbU5nX1JTMjU2IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJyaXZvMjMwMkBnbWFpbC5jb21AY2FyYm9uLnN1cGVyIiwiYXV0IjoiQVBQTElDQVRJT04iLCJhdWQiOiIwekw3ZVRyU0VmWGY2a2t3SjUzRFNlZ0NiQndhIiwibmJmIjoxNjU0MTA4ODg2LCJhenAiOiIwekw3ZVRyU0VmWGY2a2t3SjUzRFNlZ0NiQndhIiwic2NvcGUiOiJFWFRfSU5UX01WT0xBX1NDT1BFIiwiaXNzIjoiaHR0cHM6XC9cL2FwaW0ucHJlcC50ZWxtYS5tZzo5NDQzXC9vYXV0aDJcL3Rva2VuIiwiZXhwIjoxNjU0MTEyNDg2LCJpYXQiOjE2NTQxMDg4ODYsImp0aSI6IjVlOGY5ZjFhLWUxODItNGZkMS04ZjUyLWU2YTIzMzljYTIzMCJ9.voIBGWbGiI7vFklcmHiufu5fW1UvlE79c7MNOZZisuGD7HQ8P4CFljBhbQQj8lHnd8u48KFdLxHWwg4SozDejPlTFmeDdHaE8UoYhTsVthYgG5eKN3ZSQ0LSyYyeLbxA25vssvVSkQBCX-4EtcrH_vgEnZiJotBqD8PhicuwtvJuiqm3lbkFcGpNNtVGlUD8Q_xxBt31Az044qJ3BYTcmnG1tXmjRzQNyNrGe3rnQxbnndqg1gHrr-st8bulgODHWGZ3vKkmpdXnMxAn6sYjPRZ0YOdfdQwpgYK8HpLh1oI8VtTsw8oqTiVXpk-4F00qXjqihVd66len-BS48DIsig",
user_language="FR",
user_account_identifier="0343500003",
partner_name="Marketbot",
transid="636251274"
)
res = api.details_transaction(transaction)
if res.success :
print(res.response)
else :
print(f"Status_code [{res.status_code}] \n {res.error}")
59 changes: 50 additions & 9 deletions mvola/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ def __init__(self,consumer_key:str,consumer_secret:str,status:str="SANDBOX",toke
self.secret = consumer_secret
self.type = status
self.token = token

self.url = 'https://api.mvola.mg' if self.type == "PRODUCTION" else "https://devapi.mvola.mg"

def generate_token(self) :

Expand All @@ -30,8 +32,8 @@ def generate_token(self) :
A function to generate a token for the Mvola API.
"""
url = 'https://api.mvola.mg/token' if self.type == "PRODUCTION" else "https://devapi.mvola.mg/token"


url = f'{self.url}/token'
keys = f"{self.key}:{self.secret}"
keys_bytes = keys.encode("ascii")
encoded = base64.b64encode(keys_bytes).decode("utf-8")
Expand All @@ -58,8 +60,8 @@ def generate_token(self) :
if status_code == 200:
res.success = True
response = req.json()
res.value = response
res.token = response["access_token"]
res.response = response
res.response = response["access_token"]

elif status_code in range (500,504) :
res.error = {'error_description': 'Internal server errors.', 'error': 'server errors'}
Expand All @@ -78,7 +80,7 @@ def init_transaction (self,transaction) :
Args:
transaction ( object : Transaction ): An instance of Transaction class.
"""
url = "https://devapi.mvola.mg/mvola/mm/transactions/type/merchantpay/1.0.0/"
url = f'{self.url}/mvola/mm/transactions/type/merchantpay/1.0.0/'
res = ResultAction()
data = transaction.dataJson
if not data.get("amount") :
Expand Down Expand Up @@ -118,7 +120,7 @@ def init_transaction (self,transaction) :
if status_code in [200 , 202]:
res.success = True
response = req.json()
res.value = response
res.response = response
elif status_code in range (500,504) :
res.error = {'error_description': 'Internal server errors.', 'error': 'server errors'}
else :
Expand All @@ -135,7 +137,7 @@ def status_transaction(self,transaction) :
transaction ( object : Transaction ): An instance of Transaction class.
"""

url = "https://devapi.mvola.mg/mvola/mm/transactions/type/merchantpay/1.0.0/status/"
url = f'{self.url}/mvola/mm/transactions/type/merchantpay/1.0.0/status/'
res = ResultAction()

data = transaction.dataJson
Expand All @@ -156,7 +158,7 @@ def status_transaction(self,transaction) :
if status_code in [200 , 202]:
res.success = True
response = req.json()
res.value = response
res.response = response

elif status_code in range (500,504) :
res.error = {'error_description': 'Internal server errors.', 'error': 'server errors'}
Expand All @@ -166,4 +168,43 @@ def status_transaction(self,transaction) :

res.status_code = req.status_code
return res



def details_transaction(self,transaction) :

"""
details of transaction
Args:
transaction ( object : Transaction ): An instance of Transaction class.
"""
url = f'{self.url}/mvola/mm/transactions/type/merchantpay/1.0.0'
res = ResultAction()
data = transaction.dataJson

if not data.get("transid") :
raise ValueError("[transid] Required fields on acion : details of transaction")

try :
req = requests.get(
f'{url}/{data.get("transid")}',
headers=transaction.headers
)
except Exception as e :
res.error = e
return res

status_code = req.status_code
if status_code in [200 , 202]:
res.success = True
response = req.json()
res.response = response

elif status_code in range (500,504) :
res.error = {'error_description': 'Internal server errors.', 'error': 'server errors'}

else :
res.error = req.json()

res.status_code = req.status_code
return res
8 changes: 5 additions & 3 deletions mvola/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self) -> None:

self.success = False # True if the requests is success
self.error = None # Details if error occurs
self.value = None # Content of the request's response
self.response = None # Content of the request's response
self.token = None # The value of token
self.status_code = None # The status code the requests
self.headers = None,
Expand All @@ -25,7 +25,7 @@ def __str__(self) :
"Success" : self.success,
"Error" : self.error,
"Status code" : self.status_code,
"Value" : self.value
"response" : self.response
},indent=4)

class Transaction :
Expand Down Expand Up @@ -58,6 +58,7 @@ def __init__ (self ,**kwargs) :
self.fc = kwargs.get("fc","USD")
self.amount_fc = kwargs.get("amount_fc","1")
self.server_correlation_id = kwargs.get("server_correlation_id")
self.transid = kwargs.get("transid")

if not self.token :
raise ValueError("[token] Required fields | MerchantNumber: the company phone number ex : 0343500004")
Expand Down Expand Up @@ -156,7 +157,8 @@ def dataJson(self):
"value": self.amount_fc
}
],
"serverCorrelationId" : str(self.server_correlation_id) if self.server_correlation_id else None
"serverCorrelationId" : str(self.server_correlation_id) if self.server_correlation_id else None,
"transid" : str(self.transid) if self.transid else None
}
for k, v in dict(data).items():
if v is None:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = mvola
version = 1.0.1
version = 1.0.2
author = rivo2302
author_email = [email protected]
description = A light open source module for Mvola API.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setuptools.setup(
name="mvola", # This is the name of the package
version="1.0.1", # The initial release version
version="1.0.2", # The initial release version
author="rivo2302", # Full name of the author
description="Mvola is a light open source module for your Mvola API.",
long_description=long_description, # Long description read from the readme
Expand Down

0 comments on commit a3f4168

Please sign in to comment.