aboutsummaryrefslogtreecommitdiffstats
path: root/alphabetlearning/payments/views.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-10-19 14:41:08 +0100
committerMatthew Lemon <y@yulqen.org>2024-10-19 14:41:08 +0100
commitae9bc97c743ea4d31a3f392db72a948d87d3b2ab (patch)
treeafddbb59cfa7a2721cdf997fe83c033865537135 /alphabetlearning/payments/views.py
parent1d2aa924acc3429b66345ef742ed45b1ef4e02a7 (diff)
Test email in the console
Diffstat (limited to 'alphabetlearning/payments/views.py')
-rw-r--r--alphabetlearning/payments/views.py15
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)