feat: Complete Shiplogic integration with mobile-optimized ops workflow

**Shiplogic API Integration:**
- Fixed API base URL configuration (removed /api suffix)
- Implemented comprehensive request/response logging for rates and shipments endpoints
- Fixed PDF fetching: API returns S3 URLs, now downloads actual PDFs from S3
- Added tests and mock API responses for local development (routes/shiplogic-mock.php)

**Courier Service Enhancements:**
- Added redownloadShipmentPdfs() public method for re-downloading corrupted PDFs
- Enhanced error logging with full request/response bodies for debugging
- Proper binary PDF storage using Laravel Storage facade
- URL and S3 download handling for Shiplogic API responses

**Workflow & Operations:**
- Changed to manual "Ready for Collection" button instead of automatic move
- Operators now: scan QR → apply labels → click "Ready for Collection" → moves to Awaiting Collection
- Removed duplicate PDF attachments to Trello (was adding twice from two listeners)
- Fixed NotifySlackOnShipmentCreated to only handle Slack notifications

**Mobile-Optimized Ops Page:**
- Removed QR code display from order detail page
- Implemented responsive single-column layout for mobile phones
- Large touch-friendly buttons (full width, increased padding)
- Bold typography for better readability on small screens
- Larger input fields and tracking number displays
- Clear step-by-step instructions for warehouse operators
- Re-download PDF button for damaged/corrupted labels

**New Features:**
- POST /ops/orders/{uuid}/ready-for-collection endpoint
- Re-download PDFs functionality accessible from awaiting_collection and in_transit states
- Full audit logging for all operations via ops interface
- Proper error handling and user feedback

**Testing:**
- Added ShipmentCreationTest with mock HTTP client
- Created comprehensive testing guide (SHIPLOGIC_TESTING.md)
- Mock API routes for local development without hitting live API
This commit is contained in:
twotalesanimation
2026-01-03 16:13:20 +02:00
parent b8cc8bd421
commit 2a10f9af38
90 changed files with 11794 additions and 381 deletions
+5 -1
View File
@@ -117,12 +117,14 @@ class OrderController extends Controller
'customer_email' => 'required|email',
'customer_phone' => 'required|string|max:20',
'shipping_street_address' => 'required|string|max:255',
'shipping_unit_number' => 'nullable|string|max:255',
'shipping_local_area' => 'required|string|max:255',
'shipping_city' => 'required|string|max:255',
'shipping_zone' => 'required|string|max:255',
'shipping_postcode' => 'required|string|max:20',
'shipping_country' => 'required|string|max:2',
'shipping_country' => 'required|string|max:255',
'shipping_type' => 'required|in:residential,business',
'business_name' => 'nullable|string|max:255',
'notes' => 'nullable|string|max:500'
]);
@@ -226,12 +228,14 @@ class OrderController extends Controller
'customer_email' => $request->input('customer_email'),
'customer_phone' => $request->input('customer_phone'),
'shipping_street_address' => $request->input('shipping_street_address'),
'shipping_unit_number' => $request->input('shipping_unit_number'),
'shipping_local_area' => $request->input('shipping_local_area'),
'shipping_city' => $request->input('shipping_city'),
'shipping_zone' => $request->input('shipping_zone'),
'shipping_postcode' => $request->input('shipping_postcode'),
'shipping_country' => $request->input('shipping_country'),
'shipping_type' => $request->input('shipping_type'),
'business_name' => $request->input('business_name'),
];
if ($request->filled('notes')) {