-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
323fef1
commit d8e2845
Showing
1 changed file
with
27 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,33 +58,33 @@ def get(self, request, param): | |
cart_id = request.GET.get("cart_id") | ||
requestjson = requestdata.json() | ||
result_dict = json.loads(str(json.dumps(requestjson))) | ||
try: | ||
carts = CartItem.objects.get(pk=cart_id) | ||
print(carts, cart_id) | ||
CartItem.objects.get(cart__id=carts.id) | ||
from django.core.mail import EmailMessage | ||
from django.template.loader import render_to_string | ||
|
||
# print(carts, cartitems) | ||
subject, from_email, to = ( | ||
"Payment Success GeraiPi", | ||
"[email protected]", | ||
request.user.email, | ||
) | ||
html_message = render_to_string("mail_template.html", {"carts": carts}) | ||
# # plain_message = strip_tags(html_message) | ||
# # mail.send_mail(subject, | ||
# # plain_message, | ||
# # from_email, | ||
# # [to], | ||
# # html_message=html_message) | ||
|
||
msg = EmailMessage(subject, html_message, from_email, [to]) | ||
msg.content_subtype = "html" | ||
msg.send() | ||
|
||
except CartItem.DoesNotExist or Exception as e: | ||
print(e) | ||
# try: | ||
# carts = CartItem.objects.get(pk=cart_id) | ||
# print(carts, cart_id) | ||
# CartItem.objects.get(cart__id=carts.id) | ||
# from django.core.mail import EmailMessage | ||
# from django.template.loader import render_to_string | ||
|
||
# # print(carts, cartitems) | ||
# subject, from_email, to = ( | ||
# "Payment Success GeraiPi", | ||
# "[email protected]", | ||
# request.user.email, | ||
# ) | ||
# html_message = render_to_string("mail_template.html", {"carts": carts}) | ||
# # # plain_message = strip_tags(html_message) | ||
# # # mail.send_mail(subject, | ||
# # # plain_message, | ||
# # # from_email, | ||
# # # [to], | ||
# # # html_message=html_message) | ||
|
||
# msg = EmailMessage(subject, html_message, from_email, [to]) | ||
# msg.content_subtype = "html" | ||
# msg.send() | ||
|
||
# except CartItem.DoesNotExist or Exception as e: | ||
# print("error") | ||
|
||
txid = result_dict.get("transaction") | ||
txid = json.loads(str(json.dumps(txid))) | ||
|