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 #46 from paypal/stable
Browse files Browse the repository at this point in the history
Stable
  • Loading branch information
avidas committed Apr 4, 2014
2 parents ea81929 + c88e373 commit 2fd529b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.txt
@@ -1,3 +1,6 @@
Version 1.1.0 - April 3, 2014
- invoicing api support added

Version 1.0.0 - March 21, 2014
- future payments support added to sdk
- move from httplib2 to requests
Expand Down
32 changes: 32 additions & 0 deletions README.md
Expand Up @@ -164,3 +164,35 @@ logout_url = tokeninfo.logout_url()
### Future Payments

Check out this [sample](/samples/payment/create_future_payment.py) for executing [future payments](https://developer.paypal.com/docs/integration/mobile/make-future-payment/) for a customer who has granted consent on a mobile device.

### Invoicing

Create, send and manage [invoices](https://developer.paypal.com/docs/integration/direct/invoicing/).

### Create an invoice

```python
from paypalrestsdk import Invoice

invoice = Invoice({
'merchant_info': {
"email": "default@merchant.com",
},
"billing_info": [{
"email": "example@example.com"
}],
"items": [{
"name": "Widgets",
"quantity": 20,
"unit_price": {
"currency": "USD",
"value": 2
}
}],
})

response = invoice.create()
print response
```

Check out [more samples](/samples/invoice/). The [Invoicing REST APIs](https://developer.paypal.com/webapps/developer/docs/api/#invoicing) are fully supported by the sdk.
2 changes: 1 addition & 1 deletion paypalrestsdk/version.py
@@ -1 +1 @@
__version__ = "1.0.1"
__version__ = "1.1.0"
12 changes: 5 additions & 7 deletions test/unit_tests/invoices_test.py
Expand Up @@ -50,7 +50,6 @@ def test_all(self, mock):
self.assertTrue(isinstance(history.invoices[0], paypal.Invoice))



@patch('test_helper.paypal.Api.delete', autospec=True)
def test_delete(self, mock):
response = self.invoice.delete()
Expand All @@ -72,19 +71,18 @@ def test_send(self, mock):
mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/'+self.invoice.id+'/send', {}, {'PayPal-Request-Id' : ANY})
self.assertEqual(response, True)


@patch('test_helper.paypal.Api.post', autospec=True)
def test_search(self, mock):
search_attributes = {
"start_invoice_date" : "2010-05-10 PST",
"end_invoice_date" : "2013-05-11 PST",
"start_invoice_date" : "2014-04-01 PST",
"end_invoice_date" : "2013-04-03 PST",
"page" : 1,
"page_size" : 20,
"total_count_required" : True
}
mock.return_value = {'total_count': 1, 'invoices': [self.invoice_attributes]}

history = paypal.Invoice.search(search_attributes);
history = paypal.Invoice.search(search_attributes)

mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/search', search_attributes)
self.assertEqual(history.total_count, 1)
Expand All @@ -98,7 +96,7 @@ def test_remind(self, mock):
'send_to_merchant': True
}

response = self.invoice.remind(remind_attributes);
response = self.invoice.remind(remind_attributes)

mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/'+self.invoice.id+'/remind', remind_attributes, {'PayPal-Request-Id' : ANY})
self.assertEqual(response, True)
Expand All @@ -112,7 +110,7 @@ def test_cancel(self, mock):
'send_to_payer': True
}

response = self.invoice.cancel(cancel_attributes);
response = self.invoice.cancel(cancel_attributes)

mock.assert_called_once_with(self.invoice.api,'v1/invoicing/invoices/'+self.invoice.id+'/cancel', cancel_attributes, {'PayPal-Request-Id' : ANY})
self.assertEqual(response, True)

0 comments on commit 2fd529b

Please sign in to comment.