From 3fae5278fa6da3c561402c98c159d6b8e9457761 Mon Sep 17 00:00:00 2001 From: vickytechkey Date: Sat, 10 Oct 2026 14:30:46 +0530 Subject: [PATCH] feat: add views for cart management, checkout, payment verification, and order history --- orders/views.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/orders/views.py b/orders/views.py index 1ade50e..1302cf3 100644 --- a/orders/views.py +++ b/orders/views.py @@ -848,20 +848,17 @@ class OrderTrackView(APIView): tracking_history.append({'status': 'accepted', 'timestamp': placed_ts, 'location': 'Seller Store'}) tracking_history.append({'status': 'picked_up', 'timestamp': placed_ts, 'location': 'Logistics Hub'}) display_status = 'Shipped' - rider_details = {'name': 'Rajesh Kumar', 'phone': '+919876543210'} elif raw_status in ['out_for_delivery']: tracking_history.append({'status': 'accepted', 'timestamp': placed_ts, 'location': 'Seller Store'}) tracking_history.append({'status': 'picked_up', 'timestamp': placed_ts, 'location': 'Logistics Hub'}) tracking_history.append({'status': 'out_for_delivery', 'timestamp': placed_ts, 'location': 'Destination Hub'}) display_status = 'Out for Delivery' - rider_details = {'name': 'Rajesh Kumar', 'phone': '+919876543210'} elif raw_status in ['delivered']: tracking_history.append({'status': 'accepted', 'timestamp': placed_ts, 'location': 'Seller Store'}) tracking_history.append({'status': 'picked_up', 'timestamp': placed_ts, 'location': 'Logistics Hub'}) tracking_history.append({'status': 'out_for_delivery', 'timestamp': placed_ts, 'location': 'Destination Hub'}) tracking_history.append({'status': 'delivered', 'timestamp': placed_ts, 'location': 'Customer Address'}) display_status = 'Delivered' - rider_details = {'name': 'Rajesh Kumar', 'phone': '+919876543210'} elif raw_status in ['cancelled', 'canceled']: tracking_history.append({'status': 'cancelled', 'timestamp': placed_ts, 'location': 'Order Cancelled'}) display_status = 'Cancelled' @@ -874,7 +871,6 @@ class OrderTrackView(APIView): 'awb_number': awb_number or 'Cancelled', 'current_status': display_status, 'carrier': 'Shadowfax Express' if awb_number else 'Awaiting Dispatch', - 'rider_details': rider_details, 'tracking_history': tracking_history } } @@ -888,6 +884,10 @@ class OrderTrackView(APIView): {'status': 'cancelled', 'timestamp': order.placed_at.strftime('%Y-%m-%dT%H:%M:%SZ') if (order and getattr(order, 'placed_at', None)) else '2026-10-09T10:00:00Z', 'location': 'Order Cancelled'} ] + # Ensure executive rider details are stripped for customer privacy + customer_live_tracking = dict(live_data.get('data', {})) if isinstance(live_data.get('data'), dict) else {} + customer_live_tracking.pop('rider_details', None) + result = { 'order_id': order.id if order else order_id, 'awb_number': awb_number or (order.awb_number if order else None), @@ -895,7 +895,7 @@ class OrderTrackView(APIView): 'order_status': order.status if order else raw_status, 'placed_at': order.placed_at if order else None, 'shipping_address': order.shipping_address if order else '', - 'live_tracking': live_data.get('data', {}) + 'live_tracking': customer_live_tracking } return Response(result)