Comments (7)
Hi @tomusher,
I'm thinking of having a setting that can be toggled. Then fully document the existing signals. I'm not 100% happy with that solution, so I would love to hear your input on what you think would be ideal.
Danny
from dj-stripe.
@pydanny Great. A toggle would be fine, but as you say, documentation would go a long way too - the main issue seems to how unpredictable things can be - some events are triggered by signals, some by webhooks, and some as side effects of calling a utility method on a model.
Ideally, I'd (personally) like to use dj-stripe purely for the structural stuff; models, utility methods and webhook/signal management, all the behavioural bits (forms, e-mail notifications, etc.) are great but would be nice if it was easier to make them optional.
from dj-stripe.
Now that I've been able to return to this, I've discovered that the signals we inherited from the forked project don't make it clear where the email notifications are occurring. Note: This is why I'm not a fan of the observer pattern i.e. signals...
@tomusher, were these coming from the the registration system or dj-stripe itself?
from dj-stripe.
Trying to think back to the problem I was having - I think it was calling 'subscribe' on a Customer, and then trying to trace where the email came from.
It seems to be sent in response to a webhook triggered by Stripe -> Invoice.handle_event -> sync_from_stripe_data -> send_receipt.
It's difficult to follow but also pretty difficult to intercept to change the behaviour.
from dj-stripe.
I have had to track down this path a few times for various reasons. Here it is again to give better path for it:
Enters the webook call for "Invoice.payment_succeeded" and builds the vent then calls the process method:
https://github.com/pydanny/dj-stripe/blob/master/djstripe/views.py#L110
In the process method it makes sure it is an Invoice namespaced webhook and calls the handle_event method
https://github.com/pydanny/dj-stripe/blob/master/djstripe/models.py#L183
The start of the handle_event method is here and it goes through to the sync_from_strype_data
https://github.com/pydanny/dj-stripe/blob/master/djstripe/models.py#L766
After going all the way through the sync function it gets the charge object if there is one
https://github.com/pydanny/dj-stripe/blob/master/djstripe/models.py#L757
Then finally sends the receipt
https://github.com/pydanny/dj-stripe/blob/master/djstripe/models.py#L762
I have traced this a few times because of the inconsistency of sending emails at times.
from dj-stripe.
Forgot to add the only other place I could find a call to send_receipt as here:
https://github.com/pydanny/dj-stripe/blob/master/djstripe/models.py#L579
from dj-stripe.
This is fixed in #80.
from dj-stripe.
Related Issues (20)
- ProgrammingError: column djstripe_product.default_price_id does not exist HOT 7
- Use case for multiple API Keys? HOT 9
- Plugin 'mkdocstrings' option 'watch' is breaking the docs HOT 2
- Failing webhook events in dj-stripe regarding Plan and Price HOT 2
- Having multiple projects breaks the webhook HOT 1
- The stripe api key placement is very confusing HOT 15
- Use AbstractModels HOT 1
- Webhook doesn't work if API keys removed from .env HOT 4
- Current state of the projects Documentation/Website
- v2.9 Release Checklist HOT 2
- Sync only Subscriptions with specific status HOT 2
- Initial Sync Fails to Import Charge data from Connect Express Accounts
- Re-enable Migration Check in Linter Action for Release 3.0
- Support an upgrade from 2.X HOT 4
- Webhooks for some users are failing after library update from 2.5 to 2.8 HOT 4
- Errors when manually running djstripe_sync_models
- API change for Sepa payments in their source api HOT 1
- Enhance Admin Interface to Dynamically Include All Properties as Read-Only Fields HOT 2
- Impossible to install dj-stripe to my django project HOT 6
- Event Process: pass new obj instance to signal
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dj-stripe.