Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1026,7 +1026,7 @@ def checkout():
|
|
| 1026 |
print("Cart is empty")
|
| 1027 |
return jsonify({"success": False, "message": "Cart is empty"})
|
| 1028 |
|
| 1029 |
-
total_price = sum(item
|
| 1030 |
print(f"Total Price: {total_price}") # Debugging total price calculation
|
| 1031 |
|
| 1032 |
discount = 0
|
|
@@ -1095,7 +1095,11 @@ def checkout():
|
|
| 1095 |
# Final total bill calculation
|
| 1096 |
total_bill = total_price - discount
|
| 1097 |
print(f"Total Bill After Discount: {total_bill}") # Debugging final total bill
|
| 1098 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1099 |
# Store all order details (before deleting cart items)
|
| 1100 |
order_details = "\n".join(
|
| 1101 |
f"{item['Name']} x{item['Quantity__c']} | Add-Ons: {item.get('Add_Ons__c', 'None')} | "
|
|
@@ -1117,7 +1121,9 @@ def checkout():
|
|
| 1117 |
if not customer_id:
|
| 1118 |
print("Customer record not found")
|
| 1119 |
return jsonify({"success": False, "message": "Customer record not found in Salesforce"})
|
| 1120 |
-
|
|
|
|
|
|
|
| 1121 |
# Store order data
|
| 1122 |
order_data = {
|
| 1123 |
"Customer_Name__c": user_id,
|
|
|
|
| 1026 |
print("Cart is empty")
|
| 1027 |
return jsonify({"success": False, "message": "Cart is empty"})
|
| 1028 |
|
| 1029 |
+
total_price = sum(float(item.get('Price__c', 0)) for item in cart_items)
|
| 1030 |
print(f"Total Price: {total_price}") # Debugging total price calculation
|
| 1031 |
|
| 1032 |
discount = 0
|
|
|
|
| 1095 |
# Final total bill calculation
|
| 1096 |
total_bill = total_price - discount
|
| 1097 |
print(f"Total Bill After Discount: {total_bill}") # Debugging final total bill
|
| 1098 |
+
print(f"Discount After Discount: {discount}")
|
| 1099 |
+
print(f"Discount After Discount: {total_price}")# Debugging total bill
|
| 1100 |
+
total_price = float(total_price) if total_price is not None else 0.0
|
| 1101 |
+
discount = float(discount) if discount is not None else 0.0
|
| 1102 |
+
total_bill = float(total_bill) if total_bill is not None else 0.0
|
| 1103 |
# Store all order details (before deleting cart items)
|
| 1104 |
order_details = "\n".join(
|
| 1105 |
f"{item['Name']} x{item['Quantity__c']} | Add-Ons: {item.get('Add_Ons__c', 'None')} | "
|
|
|
|
| 1121 |
if not customer_id:
|
| 1122 |
print("Customer record not found")
|
| 1123 |
return jsonify({"success": False, "message": "Customer record not found in Salesforce"})
|
| 1124 |
+
print(f"Total Bill After Discount: {total_bill}") # Debugging final total bill
|
| 1125 |
+
print(f"Discount After Discount: {discount}")
|
| 1126 |
+
print(f"Discount After Discount: {total_price}")
|
| 1127 |
# Store order data
|
| 1128 |
order_data = {
|
| 1129 |
"Customer_Name__c": user_id,
|