Skip to content

Commit 839a400

Browse files
committed
format code
1 parent 7f01cd5 commit 839a400

File tree

3 files changed

+16
-23
lines changed

3 files changed

+16
-23
lines changed

kkiapay/core.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import json
22
import requests
33
from collections import namedtuple
4+
45
try:
56
from types import SimpleNamespace as Namespace
67
except ImportError:
@@ -25,13 +26,17 @@ def __init__(self, public_key, private_key, secret, sandbox=False):
2526
}
2627
self.url = self.SANDBOX_URL if self.sandbox else self.BASE_URL
2728

28-
2929
def verify_transaction(self, transaction_id):
3030
self.url += "/api/v1/transactions/status"
3131
payload = {"transactionId": transaction_id}
3232
r = requests.post(self.url, data=payload, headers=self.headers)
3333

34-
return json.loads(r.text, object_hook=lambda d: namedtuple('KkiapayTransaction', d.keys())(*d.values()))
34+
return json.loads(
35+
r.text,
36+
object_hook=lambda d: namedtuple("KkiapayTransaction", d.keys())(
37+
*d.values()
38+
),
39+
)
3540

3641
def refund_transaction(self, transaction_id):
3742
self.url += "/api/v1/transactions/revert"
@@ -42,4 +47,4 @@ def refund_transaction(self, transaction_id):
4247
def setup_payout(self, options):
4348
self.url += "/merchant/payouts/schedule"
4449
r = requests.post(self.url, data=options, headers=self.headers)
45-
return r.text
50+
return r.text

tests/context.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import sys
44
import os
5-
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
65

7-
import kkiapay
6+
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
7+
8+
import kkiapay

tests/test_kkiapay.py

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
2-
31
from .context import kkiapay
42
from kkiapay import Kkiapay
53
import requests_mock, requests
64

5+
76
def setup_module(module):
87
""" setup any state specific to the execution of the given module."""
98

@@ -13,26 +12,14 @@ def teardown_module(module):
1312
method.
1413
"""
1514

16-
class TestKkiapay(object):
1715

16+
class TestKkiapay(object):
1817
def test_urls(self):
19-
live = Kkiapay('public_key', 'private_key', 'secret')
20-
sandbox = Kkiapay('public_key', 'private_key', 'secret', sandbox=True)
18+
live = Kkiapay("public_key", "private_key", "secret")
19+
sandbox = Kkiapay("public_key", "private_key", "secret", sandbox=True)
2120

2221
assert live.url == Kkiapay.BASE_URL
2322
assert sandbox.url == Kkiapay.SANDBOX_URL
2423

25-
26-
def test_answer(self, requests_mock):
24+
def test_requests(self, requests_mock):
2725
pass
28-
# requests_mock.get("http://123-fake-api.com", text="Hello!")
29-
# requests_mock.get("http://123-fake-api.com", text="Hello!")
30-
# response = requests.get("http://123-fake-api.com")
31-
32-
# assert response.text == "Hello!"
33-
34-
35-
36-
# k = Kkiapay('a1fc2c00410911e991519dc1901933da', 'pk_a1fc5310410911e991519dc1901933da', 'sk_a1fc5311410911e991519dc1901933da')
37-
38-
# r = k.verify_transaction('qM0enu1Czb')

0 commit comments

Comments
 (0)