DSatishchandra commited on
Commit
831514f
·
verified ·
1 Parent(s): b1792cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -106,7 +106,7 @@ def create_order(email, total_amount):
106
  print(f"Customer with email {email} not found. Cannot create order.")
107
  return None
108
 
109
- # Format order details from the cart
110
  order_details = "; ".join([f"{item} x{quantity} (${price * quantity})" for item, price, quantity in cart])
111
 
112
  # Define order status (default to 'Pending')
@@ -115,13 +115,15 @@ def create_order(email, total_amount):
115
  # Get current date
116
  order_date = datetime.datetime.now().isoformat() # ISO format (YYYY-MM-DD)
117
 
118
- # Prepare the order data dictionary for the Order object
119
  order_data = {
120
  "Customer__c": customer_id, # Link the order to the customer using Customer ID
121
  "Total_Amount__c": total_amount, # Total price of the order
122
  "Order_Date__c": order_date, # Date of the order
123
  "Order_Status__c": order_status, # Status of the order
124
- "Order_Details__c": order_details # Save the itemized order details in Order object
 
 
125
  }
126
 
127
  try:
 
106
  print(f"Customer with email {email} not found. Cannot create order.")
107
  return None
108
 
109
+ # Ensure order_details is defined here
110
  order_details = "; ".join([f"{item} x{quantity} (${price * quantity})" for item, price, quantity in cart])
111
 
112
  # Define order status (default to 'Pending')
 
115
  # Get current date
116
  order_date = datetime.datetime.now().isoformat() # ISO format (YYYY-MM-DD)
117
 
118
+ # Prepare the order data dictionary
119
  order_data = {
120
  "Customer__c": customer_id, # Link the order to the customer using Customer ID
121
  "Total_Amount__c": total_amount, # Total price of the order
122
  "Order_Date__c": order_date, # Date of the order
123
  "Order_Status__c": order_status, # Status of the order
124
+ "Order_Details__c": order_details, # Ensure order_details is passed correctly
125
+ "Customer_Email__c": customer_email,
126
+ "Total_Bill__c":total_amount
127
  }
128
 
129
  try: