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
+1
View File
@@ -36,6 +36,7 @@ class CustomOrder extends Model
'proof_approved_at',
'packing_width',
'packing_length',
'packing_height',
'packing_weight',
'packing_completed_at',
'packed_by',
+11
View File
@@ -27,12 +27,14 @@ class Order extends Model
'customer_phone',
'shipping_address',
'shipping_street_address',
'shipping_unit_number',
'shipping_local_area',
'shipping_city',
'shipping_zone',
'shipping_country',
'shipping_postcode',
'shipping_type',
'business_name',
'notes',
'yoco_checkout_id',
'yoco_redirect_url',
@@ -40,12 +42,19 @@ class Order extends Model
'yoco_payment_id',
'packing_width',
'packing_length',
'packing_height',
'packing_weight',
'packing_completed_at',
'packed_by',
'courier_shipment_id',
'courier_waybill_id',
'courier_tracking_number',
'courier_status',
'courier_rate',
'courier_service_level_code',
'courier_service_level_id',
'courier_collection_min_date',
'courier_delivery_min_date',
'delivered_at',
'delivery_failure_reason',
'trello_card_id',
@@ -59,6 +68,8 @@ class Order extends Model
'packing_completed_at' => 'datetime',
'delivered_at' => 'datetime',
'qr_generated_at' => 'datetime',
'courier_collection_min_date' => 'datetime',
'courier_delivery_min_date' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];