Skip to content

Commit ea5f7d1

Browse files
author
Craig Christenson
committed
adding payments api bindings
1 parent acc88f9 commit ea5f7d1

5 files changed

Lines changed: 43 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ To use, download or clone the repository.
99
git clone https://github.com/2checkout/2checkout-python.git
1010
```
1111

12+
If your using python version 3.0 or higher, checkout the 3.x branch.
13+
14+
```shell
15+
git checkout 3.x
16+
```
17+
1218
Install _(Or just import in your script.)_
1319

1420
```shell

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from distutils.core import setup
44
setup(
55
name="twocheckout",
6-
version='0.1.0',
6+
version='0.1.1',
77
description="2Checkout Python Library",
88
author="Craig Christenson",
99
author_email="christensoncraig@gmail.com",

test/test_twocheckout.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,18 @@ def test_1_create(self):
247247
contact = twocheckout.Contact.retrieve()
248248
self.assertEqual(contact.vendor_id, "1817037")
249249

250+
class PaymentTest(TwocheckoutTestCase):
251+
def setUp(self):
252+
super(PaymentTest, self).setUp()
253+
254+
def test_1_pending(self):
255+
payment = twocheckout.Payment.pending()
256+
self.assertEqual(payment.release_level, "100")
257+
258+
def test_2_list(self):
259+
payments = twocheckout.Payment.list()
260+
self.assertEqual(len(payments), 0)
261+
250262
class PassbackTest(TwocheckoutTestCase):
251263
def setUp(self):
252264
super(PassbackTest, self).setUp()

twocheckout/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
from contact import Contact
1010
from company import Company
1111
from charge import Charge
12+
from payment import Payment
1213
from error import TwocheckoutError

twocheckout/payment.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
from .api_request import Api
2+
from .twocheckout import Twocheckout
3+
4+
5+
class Payment(Twocheckout):
6+
def __init__(self, dict_):
7+
super(self.__class__, self).__init__(dict_)
8+
9+
@classmethod
10+
def pending(cls, params=None):
11+
if params is None:
12+
params = dict()
13+
url = 'acct/detail_pending_payment'
14+
response = cls(Api.call(url, params))
15+
return response.payment
16+
17+
@classmethod
18+
def list(cls, params=None):
19+
if params is None:
20+
params = dict()
21+
url = 'acct/list_payments'
22+
response = cls(Api.call(url, params))
23+
return response.payments

0 commit comments

Comments
 (0)