Skip to content
Snippets Groups Projects
Commit 7d3aaf0c authored by Campbell-Brady, Fin (PG/T - Comp Sci & Elec Eng)'s avatar Campbell-Brady, Fin (PG/T - Comp Sci & Elec Eng)
Browse files

Updated CheckOutController and DeleteFromItemController

parent f94316fe
No related branches found
No related tags found
No related merge requests found
......@@ -22,10 +22,9 @@ def handle_checkout():
# Check for errors in the result and return appropriate responses
if 'error' in checkout_result:
return jsonify({"error": checkout_result["error"]}), 500 # or another appropriate status code
return jsonify({"error": checkout_result["error"]}), 500
# If checkout is successful, publish an event to Kafka for each item purchased
for item in checkout_result.get('item_details', []): # Ensure that item_details are included in checkout_result
for item in checkout_result.get('item_details', []):
event_data = {
"ProductID": item['ProductID'],
"QuantityPurchased": item['Quantity']
......
......@@ -17,5 +17,5 @@ def delete_item(cart_item_id):
result = delete_item_from_cart(user_id, cart_item_id)
if "error" in result:
return jsonify(result), 404 # Or another appropriate status code based on the error
return jsonify(result), 404
return jsonify(result), 200
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment