From d0fc338a6804be3412da4b0668b8c27ef0a521d9 Mon Sep 17 00:00:00 2001 From: benoit Date: Mon, 10 Dec 2018 11:45:12 +0100 Subject: [PATCH 1/2] Add customer.subscription.updated event properly. --- localstripe/resources.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/localstripe/resources.py b/localstripe/resources.py index c811aa18..e97bf87d 100644 --- a/localstripe/resources.py +++ b/localstripe/resources.py @@ -1363,6 +1363,15 @@ def _update(self, metadata=None, items=None, tax_percent=None, # be manually created using the POST /invoices route. self._set_up_subscription_and_invoice(plan, create_an_invoice=False) + @classmethod + def _api_update(cls, id, **data): + obj = cls._api_retrieve(id) + obj._update(**data) + schedule_webhook( + Event('customer.subscription.updated', obj) + ) + return obj + @classmethod def _api_delete(cls, id): obj = super()._api_retrieve(id) From e1aeb5cf964b3b362ba4daaa13024b42813d6947 Mon Sep 17 00:00:00 2001 From: benoit Date: Mon, 10 Dec 2018 11:53:54 +0100 Subject: [PATCH 2/2] Add event support in doc. --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 5137313f..ce99f766 100644 --- a/README.rst +++ b/README.rst @@ -207,8 +207,8 @@ Only those events types are currently supported: - Plan: ``plan.created`` - Customer: ``customer.created``, ``customer.updated`` and ``customer.deleted`` - Source: ``customer.source.created`` -- Subscription: ``customer.subscription.created`` and - ``customer.subscription.deleted`` +- Subscription: ``customer.subscription.created``, + ``customer.subscription.updated`` and ``customer.subscription.deleted`` - Invoice: ``invoice.created``, ``invoice.payment_succeeded`` and ``invoice.payment_failed``