Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1160,6 +1160,31 @@ def checkout():
|
|
1160 |
print(f"Error during checkout: {str(e)}")
|
1161 |
return jsonify({"success": False, "error": str(e)})
|
1162 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1163 |
@app.route("/order", methods=["GET"])
|
1164 |
def order_summary():
|
1165 |
email = session.get('user_email') # Fetch logged-in user's email
|
@@ -1180,10 +1205,18 @@ def order_summary():
|
|
1180 |
if not order:
|
1181 |
return render_template("order.html", order=None)
|
1182 |
|
|
|
|
|
|
|
|
|
|
|
1183 |
return render_template("order.html", order=order)
|
1184 |
except Exception as e:
|
1185 |
print(f"Error fetching order details: {str(e)}")
|
1186 |
return render_template("order.html", order=None, error=str(e))
|
|
|
|
|
|
|
1187 |
import smtplib
|
1188 |
from email.mime.multipart import MIMEMultipart
|
1189 |
from email.mime.text import MIMEText
|
|
|
1160 |
print(f"Error during checkout: {str(e)}")
|
1161 |
return jsonify({"success": False, "error": str(e)})
|
1162 |
|
1163 |
+
# @app.route("/order", methods=["GET"])
|
1164 |
+
# def order_summary():
|
1165 |
+
# email = session.get('user_email') # Fetch logged-in user's email
|
1166 |
+
# if not email:
|
1167 |
+
# return redirect(url_for("login"))
|
1168 |
+
|
1169 |
+
# try:
|
1170 |
+
# # Fetch the most recent order for the user
|
1171 |
+
# result = sf.query(f"""
|
1172 |
+
# SELECT Id, Customer_Name__c, Customer_Email__c, Total_Amount__c, Order_Details__c, Order_Status__c, Discount__c, Total_Bill__c
|
1173 |
+
# FROM Order__c
|
1174 |
+
# WHERE Customer_Email__c = '{email}'
|
1175 |
+
# ORDER BY CreatedDate DESC
|
1176 |
+
# LIMIT 1
|
1177 |
+
# """)
|
1178 |
+
# order = result.get("records", [])[0] if result.get("records") else None
|
1179 |
+
|
1180 |
+
# if not order:
|
1181 |
+
# return render_template("order.html", order=None)
|
1182 |
+
|
1183 |
+
# return render_template("order.html", order=order)
|
1184 |
+
# except Exception as e:
|
1185 |
+
# print(f"Error fetching order details: {str(e)}")
|
1186 |
+
# return render_template("order.html", order=None, error=str(e))
|
1187 |
+
|
1188 |
@app.route("/order", methods=["GET"])
|
1189 |
def order_summary():
|
1190 |
email = session.get('user_email') # Fetch logged-in user's email
|
|
|
1205 |
if not order:
|
1206 |
return render_template("order.html", order=None)
|
1207 |
|
1208 |
+
# Convert prices to integers
|
1209 |
+
order['Total_Amount__c'] = int(float(order['Total_Amount__c']))
|
1210 |
+
order['Discount__c'] = int(float(order['Discount__c']))
|
1211 |
+
order['Total_Bill__c'] = int(float(order['Total_Bill__c']))
|
1212 |
+
|
1213 |
return render_template("order.html", order=order)
|
1214 |
except Exception as e:
|
1215 |
print(f"Error fetching order details: {str(e)}")
|
1216 |
return render_template("order.html", order=None, error=str(e))
|
1217 |
+
|
1218 |
+
|
1219 |
+
|
1220 |
import smtplib
|
1221 |
from email.mime.multipart import MIMEMultipart
|
1222 |
from email.mime.text import MIMEText
|