Skip to content

Commit 6975174

Browse files
authored
Merge pull request #6 from OthnielDona/patch_verify_refund
Patch verify refund
2 parents 2513d90 + be68fcd commit 6975174

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

kkiapay/core.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ def __init__(self, public_key, private_key, secret, sandbox=False):
2424
def verify_transaction(self, transaction_id):
2525
self.url += "/api/v1/transactions/status"
2626
payload = {"transactionId": transaction_id}
27-
r = requests.post(self.url, data=payload, headers=self.headers)
27+
28+
try:
29+
r = requests.post(self.url, data=payload, headers=self.headers)
30+
except requests.exceptions.ConnectionError:
31+
return print('Sorry! There is a problem with your connection.')
2832

2933
return json.loads(
3034
r.text,
@@ -36,7 +40,11 @@ def verify_transaction(self, transaction_id):
3640
def refund_transaction(self, transaction_id):
3741
self.url += "/api/v1/transactions/revert"
3842
payload = {"transactionId": transaction_id}
39-
r = requests.post(self.url, data=payload, headers=self.headers)
43+
44+
try:
45+
r = requests.post(self.url, data=payload, headers=self.headers)
46+
except requests.exceptions.ConnectionError:
47+
return print('Sorry! There is a problem with your connection.')
4048

4149
return json.loads(
4250
r.text,

0 commit comments

Comments
 (0)