Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -995,6 +995,8 @@ def update_quantity():
|
|
| 995 |
|
| 996 |
|
| 997 |
|
|
|
|
|
|
|
| 998 |
@app.route("/checkout", methods=["POST"])
|
| 999 |
def checkout():
|
| 1000 |
email = session.get('user_email')
|
|
@@ -1042,9 +1044,7 @@ def checkout():
|
|
| 1042 |
has_coupons = bool(coupon_query["records"])
|
| 1043 |
print(f"Has Coupons: {has_coupons}") # Debugging coupon presence check
|
| 1044 |
|
| 1045 |
-
if selected_coupon:
|
| 1046 |
-
print("Coupon Selected, Applying Discount...")
|
| 1047 |
-
|
| 1048 |
# Apply 10% discount if a valid coupon is selected
|
| 1049 |
discount = total_price * 0.10 # Example: 10% discount
|
| 1050 |
print(f"Discount Applied: {discount}") # Debugging discount calculation
|
|
@@ -1071,10 +1071,8 @@ def checkout():
|
|
| 1071 |
sf.Referral_Coupon__c.update(referral_coupon_id, {
|
| 1072 |
"Coupon_Code__c": updated_coupons_str
|
| 1073 |
})
|
| 1074 |
-
|
| 1075 |
-
|
| 1076 |
-
print("No Coupon Selected, Applying Reward Points...")
|
| 1077 |
-
|
| 1078 |
reward_points_to_add = total_price * 0.10 # Example: 10% reward points
|
| 1079 |
print(f"Reward Points to Add: {reward_points_to_add}") # Debugging reward points
|
| 1080 |
|
|
|
|
| 995 |
|
| 996 |
|
| 997 |
|
| 998 |
+
from flask import redirect, url_for
|
| 999 |
+
|
| 1000 |
@app.route("/checkout", methods=["POST"])
|
| 1001 |
def checkout():
|
| 1002 |
email = session.get('user_email')
|
|
|
|
| 1044 |
has_coupons = bool(coupon_query["records"])
|
| 1045 |
print(f"Has Coupons: {has_coupons}") # Debugging coupon presence check
|
| 1046 |
|
| 1047 |
+
if selected_coupon:
|
|
|
|
|
|
|
| 1048 |
# Apply 10% discount if a valid coupon is selected
|
| 1049 |
discount = total_price * 0.10 # Example: 10% discount
|
| 1050 |
print(f"Discount Applied: {discount}") # Debugging discount calculation
|
|
|
|
| 1071 |
sf.Referral_Coupon__c.update(referral_coupon_id, {
|
| 1072 |
"Coupon_Code__c": updated_coupons_str
|
| 1073 |
})
|
| 1074 |
+
else:
|
| 1075 |
+
# If no coupon is selected, add reward points
|
|
|
|
|
|
|
| 1076 |
reward_points_to_add = total_price * 0.10 # Example: 10% reward points
|
| 1077 |
print(f"Reward Points to Add: {reward_points_to_add}") # Debugging reward points
|
| 1078 |
|