Permalink
Browse files

Merge pull request #22 from stripe/invoice-methods

Invoice paying and updating methods.
  • Loading branch information...
2 parents 3912935 + 4ac5a31 commit 3cce17bde1caad60929cff5a0d43d5f3afa3193c @spakanati spakanati committed Aug 31, 2012
Showing with 21 additions and 5 deletions.
  1. +4 −0 CHANGELOG
  2. +1 −1 VERSION
  3. +7 −1 bin/stripe
  4. +8 −2 stripe/__init__.py
  5. +1 −1 stripe/version.py
View
@@ -1,3 +1,7 @@
+=== 1.7.4 2012-08-31
+
+* Add update and pay methods for Invoice resource
+
=== 1.7.3 2012-08-15
* Add new stripe.Account resource
View
@@ -1 +1 @@
-1.7.3
+1.7.4
View
@@ -143,9 +143,13 @@ class CustomerClient(CreateableAPIResourceClient, UpdateableAPIResourceClient,
url = self.instance_url() + '/subscription'
self.logged_curl('delete', url, params)
-class InvoiceClient(ListableAPIResourceClient):
+class InvoiceClient(ListableAPIResourceClient, UpdateableAPIResourceClient):
client_for = stripe.Invoice
+ def pay(self):
+ url = self.instance_url() + '/pay'
+ self.logged_curl('post', url, {})
+
@classmethod
def upcoming(cls, params):
url = cls.client_for.class_url() + '/upcoming'
@@ -213,6 +217,8 @@ invoice
all
retrieve
upcoming
+ update
+ pay
invoiceitem
all
View
@@ -123,7 +123,7 @@ def convert_to_stripe_object(resp, api_key):
resp = resp.copy()
klass_name = resp.get('object')
if isinstance(klass_name, basestring):
- klass = types.get(klass_name, StripeObject)
+ klass = types.get(klass_name, StripeObject)
else:
klass = StripeObject
return klass.construct_from(resp, api_key)
@@ -734,7 +734,13 @@ def delete_discount(self, **params):
response, api_key = requestor.request('delete', url)
self.refresh_from({ 'discount' : None }, api_key, True)
-class Invoice(ListableAPIResource):
+class Invoice(ListableAPIResource, UpdateableAPIResource):
+ def pay(self):
+ requestor = APIRequestor(self.api_key)
+ url = self.instance_url() + '/pay'
+ response, api_key = requestor.request('post', url, {})
+ return convert_to_stripe_object(response, api_key)
+
@classmethod
def upcoming(cls, api_key=None, **params):
requestor = APIRequestor(api_key)
View
@@ -1 +1 @@
-VERSION = '1.7.3'
+VERSION = '1.7.4'

0 comments on commit 3cce17b

Please sign in to comment.