GithubHelp home page GithubHelp logo

Comments (7)

pydanny avatar pydanny commented on July 20, 2024

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.

tomusher avatar tomusher commented on July 20, 2024

@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.

pydanny avatar pydanny commented on July 20, 2024

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.

tomusher avatar tomusher commented on July 20, 2024

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.

buddylindsey avatar buddylindsey commented on July 20, 2024

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.

buddylindsey avatar buddylindsey commented on July 20, 2024

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.

pydanny avatar pydanny commented on July 20, 2024

This is fixed in #80.

from dj-stripe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.