Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions kkiapay/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ def __init__(self, public_key, private_key, secret, sandbox=False):
"X-PRIVATE-KEY": self.private_key,
}
self.url = self.SANDBOX_URL if self.sandbox else self.BASE_URL
self.transaction_url = self.url + "/api/v1/transactions/status"
self.revert_url = self.url + "/api/v1/transactions/revert"
self.payout_url = self.url + "/merchant/payouts/schedule"

def verify_transaction(self, transaction_id):
self.url += "/api/v1/transactions/status"
payload = {"transactionId": transaction_id}
r = requests.post(self.url, data=payload, headers=self.headers)
r = requests.post(self.transaction_url, data=payload, headers=self.headers)

return json.loads(
r.text,
Expand All @@ -34,12 +36,10 @@ def verify_transaction(self, transaction_id):
)

def refund_transaction(self, transaction_id):
self.url += "/api/v1/transactions/revert"
payload = {"transactionId": transaction_id}
r = requests.post(self.url, data=payload, headers=self.headers)
r = requests.post(self.revert_url, data=payload, headers=self.headers)
return r.text

def setup_payout(self, options):
self.url += "/merchant/payouts/schedule"
r = requests.post(self.url, data=options, headers=self.headers)
r = requests.post(self.payout_url, data=options, headers=self.headers)
return r.text