feat: add views for cart management, checkout, payment verification, and order history
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 24s

This commit is contained in:
vickytechkey 2026-10-10 14:30:46 +05:30
parent 15cce9a2f7
commit 3fae5278fa

View file

@ -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)