Skip to content

Commit

Permalink
update payment
Browse files Browse the repository at this point in the history
  • Loading branch information
roniahmadi committed Jun 24, 2024
1 parent 323fef1 commit d8e2845
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions frontend/views/payments_cart_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit d8e2845

Please sign in to comment.