diff options
Diffstat (limited to 'alphabetlearning/payments/views.py')
-rw-r--r-- | alphabetlearning/payments/views.py | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/alphabetlearning/payments/views.py b/alphabetlearning/payments/views.py index dfbf8f1..73a14c2 100644 --- a/alphabetlearning/payments/views.py +++ b/alphabetlearning/payments/views.py @@ -1,5 +1,6 @@ import stripe from django.http import HttpResponse +from django.core.mail import send_mail from django.conf import settings from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404 @@ -20,7 +21,10 @@ from .models import ShoppingCart # TODO get the cart integrated with Stripe # Steps to convert our Cart into something that can be used with Stripe: # -# - Sort out the webhook +# - X Sort out the webhook +# - Associate the purchases with the users profile page +# - We need a profile page! +# - Fix the email and make it nice # - Associate each of our resources with a Product item # - this should be done in the create resource page # - or we can do it manually for the time being @@ -132,6 +136,13 @@ def stripe_webhook(request): payment_intent = session["payment_intent"] # TODO send an email to the customer - print("Here we send an email to the customer") + send_mail( + "Thank you for your purchase", + "You have bought something nice - enjoy it", + settings.DEFAULT_FROM_EMAIL, + [customer_email], + fail_silently=False, + ) + return HttpResponse(status=200) |