@@ -20,11 +20,13 @@ def __init__(self, public_key, private_key, secret, sandbox=False):
2020 "X-PRIVATE-KEY" : self .private_key ,
2121 }
2222 self .url = self .SANDBOX_URL if self .sandbox else self .BASE_URL
23+ self .transaction_url = self .url + "/api/v1/transactions/status"
24+ self .revert_url = self .url + "/api/v1/transactions/revert"
25+ self .payout_url = self .url + "/merchant/payouts/schedule"
2326
2427 def verify_transaction (self , transaction_id ):
25- self .url += "/api/v1/transactions/status"
2628 payload = {"transactionId" : transaction_id }
27- r = requests .post (self .url , data = payload , headers = self .headers )
29+ r = requests .post (self .transaction_url , data = payload , headers = self .headers )
2830
2931 return json .loads (
3032 r .text ,
@@ -34,12 +36,10 @@ def verify_transaction(self, transaction_id):
3436 )
3537
3638 def refund_transaction (self , transaction_id ):
37- self .url += "/api/v1/transactions/revert"
3839 payload = {"transactionId" : transaction_id }
39- r = requests .post (self .url , data = payload , headers = self .headers )
40+ r = requests .post (self .revert_url , data = payload , headers = self .headers )
4041 return r .text
4142
4243 def setup_payout (self , options ):
43- self .url += "/merchant/payouts/schedule"
44- r = requests .post (self .url , data = options , headers = self .headers )
44+ r = requests .post (self .payout_url , data = options , headers = self .headers )
4545 return r .text
0 commit comments