Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Commit

Permalink
Merge pull request #34 from paypal/rel-0.7.0
Browse files Browse the repository at this point in the history
Rel 0.7.0
  • Loading branch information
avidas committed Feb 5, 2014
2 parents 4625b68 + 0abccc8 commit 7ea8925
Show file tree
Hide file tree
Showing 27 changed files with 962 additions and 210 deletions.
2 changes: 2 additions & 0 deletions .coveragerc
@@ -0,0 +1,2 @@
[run]
source = paypalrestsdk
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,5 +1,8 @@
*.pyc
*.noseids
.coverage
build/
dist/
MANIFEST

.*.sw*
24 changes: 15 additions & 9 deletions .travis.yml
@@ -1,14 +1,20 @@
language: python
python:
- "2.6"
- "2.7"
- "3.2"
- "3.3"
- '2.6'
- '2.7'
- '3.2'
- '3.3'
install:
- pip install -r requirements.txt --use-mirrors
- pip install coverage
- pip install coveralls
- pip install -r requirements.txt --use-mirrors
- pip install coverage
- pip install coveralls
script:
- nosetests --with-coverage --cover-package=paypalrestsdk --include=paypalrestsdk/*
- nosetests --with-coverage --cover-package=paypalrestsdk --include=paypalrestsdk/* --exclude=functional*
after_success:
- coveralls
- coveralls
notifications:
webhooks:
urls:
- secure: AQB+jHDVe3JuypMbSFxIObXIlB87ft2zqgVjXctmMu1qfybn9FzL6azrhL+rnVYb9O2paoETKX73jiJTcaN4yu/l92XG3qqinzISu1rhAE0Nx0uBnZD8VAKq7synCRqSuGvhe1PRT7HnqimJU4OjBtkXd20rRkJd0LhNf+PvXAU=
on_success: change
on_failure: always
8 changes: 8 additions & 0 deletions CHANGELOG.txt
@@ -1,3 +1,11 @@
Version 0.7.0 - February 5, 2014
- Allow multiple API object in same thread
- Remove mutable default arguments
- Change comments to be docstrings
- Token creation supports unicode
- Add unit_tests using mock and patch, separate from functional_tests
- Optimize merge_dict

Version 0.6.4 - October 23, 2013
- Support OpenIDConnect for sandbox environment

Expand Down
24 changes: 23 additions & 1 deletion README.md
@@ -1,4 +1,14 @@
# PayPal REST SDK [![Build Status](https://travis-ci.org/paypal/rest-api-sdk-python.png?branch=master)](https://travis-ci.org/paypal/rest-api-sdk-python)
# PayPal REST SDK

Continuous integration status:

[![Build Status](https://travis-ci.org/paypal/rest-api-sdk-python.png?branch=master)](https://travis-ci.org/paypal/rest-api-sdk-python) [![Coverage Status](https://coveralls.io/repos/paypal/rest-api-sdk-python/badge.png?branch=master)](https://coveralls.io/r/paypal/rest-api-sdk-python?branch=master)

PyPI status:

[![PyPi version](https://pypip.in/v/paypalrestsdk/badge.png)](https://crate.io/packages/paypalrestsdk/)
[![PyPi downloads](https://pypip.in/d/paypalrestsdk/badge.png)](https://crate.io/packages/paypalrestsdk/)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/paypal/rest-api-sdk-python/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

The PayPal REST SDK provides Python APIs to create, process and manage payment.

Expand Down Expand Up @@ -34,6 +44,18 @@ export PAYPAL_CLIENT_ID=EBWKjlELKMYqRNQ6sYvFo64FtaRLRR5BdHEESmha49TM
export PAYPAL_CLIENT_SECRET=EO422dn3gQLgDbuwqTjzrFgFtaRLRR5BdHEESmha49TM
```

Configure through a non-global Api object
```python
import paypalrestsdk
my_api = paypalrestsdk.Api({
'mode': 'sandbox',
'client_id': '...',
'client_secret': '...'})

payment = paypalrestsdk.Payment({...}, api=my_api)

```

### Create Payment

```python
Expand Down
66 changes: 66 additions & 0 deletions capture_refunds.test
@@ -0,0 +1,66 @@
'''
@patch('test_helper.paypal.Api.post', autospec=True)
@patch('test_helper.paypal.Api.get', autospec=True)
def test_reauthorize(self, mock_get, mock_post):
mock_get.return_value = {'id': 'PAY-888868365Y436124EKLKW6JA', 'update_time': '2014-01-14T17:09:00Z', 'links': [], 'payer' : {},
'transactions': [{'related_resources': [{'authorization': self.authorization_attributes}],
}]}
response = self.payment.create()
authorization = self.payment.transactions[0].related_resources[0].authorization

authorization.amount = {
"currency": "USD",
"total": "7.00" }

mock_post.return_value = { "id": "8AA831015G517922L", "create_time": "2013-06-25T21:39:15Z",
"update_time": "2013-06-25T21:39:17Z",
"state": "authorized",
"amount": {
"total": "7.00",
"currency": "USD"
},
"parent_payment": "PAY-7LD317540C810384EKHFAGYA",
"valid_until": "2013-07-24T21:39:15Z",
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/payments/authorization/8AA831015G517922L",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-7LD317540C810384EKHFAGYA",
"rel": "parent_payment",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/payments/authorization/8AA831015G517922L/capture",
"rel": "capture",
"method": "POST"
}
]
}
response = authorization.reauthorize()
self.assertEqual(response, True)
mock_post.assert_called_once_with(authorization.api)


@patch('test_helper.paypal.Api.get', autospec=True)
def test_capture_find(self, mock):
capture_id = '7S373777UY2709045'
capture = paypal.Capture.find(capture_id)
self.assertEqual(capture.__class__, paypal.Capture)
mock.assert_called_once_with(capture.api, 'v1/payments/capture/' + capture_id)

with patch.object(paypal.Api, 'post', return_value=None) as mock_post:
mock_post.return_value = { "id": "8AA831015G517922L"}
refund = capture.refund({ "amount": { "currency": "USD", "total": "1.00" } })
'''

'''
@patch('test_helper.paypal.Api.get', autospec=True)
def test_refund(self, mock_get):
sale = paypal.Sale.find(self.create_sale().id)
mock_get.assert_called_once_with(sale.api,'v1/payments/sale/5VX40080GX603650')
refund = sale.refund({ "amount": { "total": "0.01", "currency": "USD" } })
self.assertEqual(refund.success(), True)
'''

0 comments on commit 7ea8925

Please sign in to comment.