fix: Fix CreateShipmentOnReadyToShip listener syntax and add guard logging
This commit is contained in:
@@ -26,6 +26,13 @@ class ShippingController extends Controller
|
||||
Log::info('Initiating shipment creation', ['order_uuid' => $order->uuid]);
|
||||
// Guard 1: Verify packing completed with valid dimensions
|
||||
if (! $this->validatePackingGate($order)) {
|
||||
Log::warning('Packing gate validation failed', [
|
||||
'order_uuid' => $order->uuid,
|
||||
'packing_completed_at' => $order->packing_completed_at,
|
||||
'width' => $order->packing_width,
|
||||
'length' => $order->packing_length,
|
||||
'weight' => $order->packing_weight,
|
||||
]);
|
||||
return response()->json([
|
||||
'error' => 'Order not yet packed with valid dimensions',
|
||||
'details' => [
|
||||
@@ -44,12 +51,21 @@ class ShippingController extends Controller
|
||||
$message = $order->is_custom_order ?
|
||||
'Custom order requires proof approved and balance paid' :
|
||||
'Standard order must be fully paid';
|
||||
|
||||
Log::warning('Payment/approval gate validation failed', [
|
||||
'order_uuid' => $order->uuid,
|
||||
'is_custom_order' => $order->is_custom_order,
|
||||
'payment_status' => $order->payment_status,
|
||||
]);
|
||||
return response()->json([
|
||||
'error' => $message,
|
||||
'payment_status' => $order->payment_status,
|
||||
], 403);
|
||||
}
|
||||
}Log::warning('Order status gate validation failed', [
|
||||
'order_uuid' => $order->uuid,
|
||||
'expected_status' => 'ready_to_ship',
|
||||
'current_status' => $order->status,
|
||||
]);
|
||||
|
||||
|
||||
// Guard 3: Check order status is Ready to Ship
|
||||
if ($order->status !== 'ready_to_ship') {
|
||||
|
||||
Reference in New Issue
Block a user