diff --git a/Orders_Microservice_Group3/app/controllers/CheckOutController.py b/Orders_Microservice_Group3/app/controllers/CheckOutController.py index 1f2d33b14dfd5ab6e2de330d476dc995b5f53a89..a1a2f5d58e0ae2bc2206f2f281543ab2d14541ea 100644 --- a/Orders_Microservice_Group3/app/controllers/CheckOutController.py +++ b/Orders_Microservice_Group3/app/controllers/CheckOutController.py @@ -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'] diff --git a/Orders_Microservice_Group3/app/controllers/DeleteFromItemController.py b/Orders_Microservice_Group3/app/controllers/DeleteFromItemController.py index 5520377bdab4b3877269318d6f601eb15869d77e..ca51e9c3ec271e1e4f9e81271eacdf88bb4c2656 100644 --- a/Orders_Microservice_Group3/app/controllers/DeleteFromItemController.py +++ b/Orders_Microservice_Group3/app/controllers/DeleteFromItemController.py @@ -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