Skip to content

Commit 3b7f49d

Browse files
added bug monitoring tool to virtual card service, updated developer docs and fixed syntax bugs in VC service
1 parent 6333b18 commit 3b7f49d

File tree

4 files changed

+77
-12
lines changed

4 files changed

+77
-12
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,7 +2420,7 @@ A sample Create call is:
24202420

24212421
```py
24222422
card_id = "660bae3b-333c-410f-b283-2d181587247f"
2423-
res = rave.VirtualCard.getCard(card_id)
2423+
res = rave.VirtualCard.get(card_id)
24242424
print(res)
24252425
```
24262426

@@ -2465,7 +2465,7 @@ A sample Create call is:
24652465

24662466
```py
24672467
card_id = "660bae3b-333c-410f-b283-2d181587247f"
2468-
res = rave.VirtualCard.cancelCard(card_id)
2468+
res = rave.VirtualCard.cancel(card_id)
24692469
print(res)
24702470
```
24712471

@@ -2489,7 +2489,7 @@ A sample Create call is:
24892489

24902490
```py
24912491
card_id = "660bae3b-333c-410f-b283-2d181587247f"
2492-
res = rave.VirtualCard.freezeCard(card_id)
2492+
res = rave.VirtualCard.freeze(card_id)
24932493
print(res)
24942494
```
24952495

@@ -2513,7 +2513,7 @@ A sample Create call is:
25132513

25142514
```py
25152515
card_id = "660bae3b-333c-410f-b283-2d181587247f"
2516-
res = rave.VirtualCard.getCard(card_id)
2516+
res = rave.VirtualCard.unfreeze(card_id)
25172517
print(res)
25182518
```
25192519

@@ -2537,7 +2537,7 @@ A sample Create call is:
25372537

25382538
```py
25392539
card_id = "660bae3b-333c-410f-b283-2d181587247f"
2540-
res = rave.VirtualCard.fundCard(card_id, "NGN", 2000)
2540+
res = rave.VirtualCard.fund(card_id, "NGN", 2000)
25412541
print(res)
25422542
```
25432543

@@ -2553,15 +2553,15 @@ This call returns a dictionary. A sample response is:
25532553
}
25542554
```
25552555

2556-
### ```.Withdraw()```
2556+
### ```.withdraw()```
25572557

25582558
This allows a the user to withdraw funds from a card with a given id. the `card id` and `amount` are passed into the `.Withdraw()` method.
25592559

25602560
A sample Create call is:
25612561

25622562
```py
25632563
card_id = "660bae3b-333c-410f-b283-2d181587247f"
2564-
res = rave.VirtualCard.Withdraw(card_id, 1000)
2564+
res = rave.VirtualCard.withdraw(card_id, 1000)
25652565
print(res)
25662566
```
25672567

rave_python/rave_account.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ def charge(self, accountDetails, hasFailed=False):
4444

4545
# setting the endpoint
4646
endpoint = self._baseUrl + self._endpointMap['account']['charge']
47+
# tracking_endpoint = self._trackingMap
48+
# tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.5", "title": "Incoming call","message": "Initiate Account charge"}
49+
# tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
4750

4851
# It is faster to just update rather than check if it is already present
4952
accountDetails.update({'payment_type': 'account'})
@@ -53,6 +56,7 @@ def charge(self, accountDetails, hasFailed=False):
5356

5457
# Checking for required account components
5558
requiredParameters = ['accountbank', 'accountnumber', 'amount', 'email', 'phonenumber', 'IP']
59+
5660
return super().charge(accountDetails, requiredParameters, endpoint)
5761

5862
def verify(self, txRef):

rave_python/rave_base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ def __init__(self, publicKey=None, secretKey=None, production=False, usingEnv=Tr
9595

9696

9797
# Setting up public and private keys (private)
98-
#
9998
# If we are using environment variables to store secretKey
10099
if(usingEnv):
101100
self.__publicKey = publicKey

rave_python/rave_virtualcard.py

Lines changed: 66 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,54 +56,109 @@ def _handleCardStatusRequests(self, type, endpoint, isPostRequest=False, data=No
5656
raise CardStatusError(type, {"error": True, "returnedData": responseJson })
5757

5858

59-
59+
6060
#function to create a virtual card
6161
#Params: vcardDetails - a dict containing currency, amount, billing_name, billing_address, billing_city, billing_state, billing_postal_code, billing_country
6262
def create(self, vcardDetails):
63+
64+
#card creating logic
6365
vcardDetails = copy.copy(vcardDetails)
6466
vcardDetails.update({"seckey": self._getSecretKey()})
65-
6667
requiredParameters = ["currency", "amount", "billing_name", "billing_address", "billing_city", "billing_state", "billing_postal_code", "billing_country"]
6768
checkIfParametersAreComplete(requiredParameters, vcardDetails)
68-
6969
endpoint = self._baseUrl + self._endpointMap["virtual_card"]["create"]
7070
response = requests.post(endpoint, headers=self.headers, data=json.dumps(vcardDetails))
71+
72+
#feature logging
73+
tracking_endpoint = self._trackingMap
74+
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.5", "title": "Incoming call","message": "Create-card"}
75+
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
76+
7177
return self._handleCreateResponse(response, vcardDetails)
7278

79+
7380
#gets all virtual cards connected to a merchant's account
7481
def all(self):
82+
83+
#feature logging
84+
tracking_endpoint = self._trackingMap
85+
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.5", "title": "Incoming call","message": "List-all-cards"}
86+
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
87+
88+
#logic for listing all cards
7589
endpoint = self._baseUrl + self._endpointMap["virtual_card"]["list"] + "?seckey="+ self._getSecretKey()
7690
data = {"seckey": self._getSecretKey()}
7791
return self._handleCardStatusRequests("List", endpoint, isPostRequest=True, data=data)
7892

93+
7994
#permanently deletes a card with specified id
8095
def cancel(self, card_id):
96+
8197
if not card_id:
8298
return "Card id was not supplied. Kindly supply one"
99+
100+
#feature logging
101+
tracking_endpoint = self._trackingMap
102+
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.5", "title": "Incoming call","message": "Delete-card"}
103+
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
104+
105+
#card cancel feature logic
83106
endpoint = self._baseUrl + self._endpointMap["virtual_card"]["terminate"] + str(card_id) + "/terminate"
84107
data = {"seckey": self._getSecretKey()}
85108
return self._handleCardStatusRequests("Cancel", endpoint, isPostRequest=True, data=data)
86109

110+
87111
#fetches Card details and transactions for a cars with specified id
88112
def get(self, card_id):
113+
114+
#feature logging
115+
tracking_endpoint = self._trackingMap
116+
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.5", "title": "Incoming call","message": "Fetch-card"}
117+
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
118+
119+
#fetch card logic
89120
endpoint = self._baseUrl + self._endpointMap["virtual_card"]["get"]
90121
data = {"seckey": self._getSecretKey()}
91122
return self._handleCardStatusRequests("Get", endpoint, isPostRequest=True, data=data)
92123

124+
93125
#temporarily suspends the use of card
94126
def freeze(self, card_id):
127+
128+
#feature logging
129+
tracking_endpoint = self._trackingMap
130+
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.5", "title": "Incoming call","message": "Block-card"}
131+
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
132+
133+
#feature logic
95134
endpoint = self._baseUrl + self._endpointMap["virtual_card"]["freeze"] + str(card_id) + "/status/block"
96135
data = {"seckey": self._getSecretKey()}
97136
return self._handleCardStatusRequests("Freeze", endpoint, isPostRequest=True, data=data)
98137

138+
99139
#reverses the freeze card operation
100140
def unfreeze(self, card_id):
141+
142+
#feature logging
143+
tracking_endpoint = self._trackingMap
144+
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.5", "title": "Incoming call","message": "Unblock-card"}
145+
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
146+
147+
#feature logic
101148
endpoint = self._baseUrl + self._endpointMap["virtual_card"]["unfreeze"] + str(card_id) + "/status/unblock"
102149
data = {"seckey": self._getSecretKey()}
103150
return self._handleCardStatusRequests("Unfreeze", endpoint, isPostRequest=True, data=data)
104151

152+
105153
#funds a card with specified balance for online transactions
106-
def fund(self, card_id, amount, currency):
154+
def fund(self, card_id, currency, amount):
155+
156+
#feature logging
157+
tracking_endpoint = self._trackingMap
158+
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.5", "title": "Incoming call","message": "Fund-card"}
159+
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
160+
161+
#feature logic
107162
data = {
108163
"card_id": card_id,
109164
"amount" : amount,
@@ -115,6 +170,13 @@ def fund(self, card_id, amount, currency):
115170

116171
#withdraws funds from Virtual card. Withdrawn funds are added to Rave Balance
117172
def withdraw(self, card_id, amount):
173+
174+
#feature logging
175+
tracking_endpoint = self._trackingMap
176+
tracking_payload = {"publicKey": self._getPublicKey(),"language": "Python v2", "version": "1.2.5", "title": "Incoming call","message": "Withdraw-card-funds"}
177+
tracking_response = requests.post(tracking_endpoint, data=json.dumps(tracking_payload))
178+
179+
#feature logic
118180
data = {
119181
"card_id": card_id,
120182
"amount" : amount,

0 commit comments

Comments
 (0)