Files
twotalesanimation 2a10f9af38 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
2026-01-03 16:13:20 +02:00

92 lines
3.4 KiB
PHP

<?php
if (!defined('YOCO_TESTING_MODE')) define('YOCO_TESTING_MODE', (bool)($_SERVER['YOCO_TESTING_MODE'] ?? $_ENV['YOCO_TESTING_MODE'] ?? true));
// Use test keys if in testing mode, otherwise use production keys from environment
$yoco_secret_key = YOCO_TESTING_MODE
? ($_SERVER['YOCO_TEST_SECRET_KEY'] ?? $_ENV['YOCO_TEST_SECRET_KEY'] ?? '')
: ($_SERVER['YOCO_SECRET_KEY'] ?? $_ENV['YOCO_SECRET_KEY'] ?? '');
$yoco_public_key = YOCO_TESTING_MODE
? ($_SERVER['YOCO_TEST_PUBLIC_KEY'] ?? $_ENV['YOCO_TEST_PUBLIC_KEY'] ?? '')
: ($_SERVER['YOCO_PUBLIC_KEY'] ?? $_ENV['YOCO_PUBLIC_KEY'] ?? '');
return [
/*
|--------------------------------------------------------------------------
| Third Party Services
|--------------------------------------------------------------------------
|
| This file is for storing the credentials for third party services such
| as Mailgun, Postmark, AWS and more. This file provides the de facto
| location for this type of information, allowing packages to have
| a conventional file to locate the various service credentials.
|
*/
'postmark' => [
'key' => env('POSTMARK_API_KEY'),
],
'resend' => [
'key' => env('RESEND_API_KEY'),
],
'ses' => [
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
],
'slack' => [
'notifications' => [
'bot_user_oauth_token' => env('SLACK_BOT_USER_OAUTH_TOKEN'),
'channel' => env('SLACK_BOT_USER_DEFAULT_CHANNEL'),
],
'design_hook_url' => env('SLACK_DESIGN_HOOK_URL'),
'production_hook_url' => env('SLACK_PRODUCTION_HOOK_URL'),
'orders_hook_url' => env('SLACK_ORDERS_HOOK_URL'),
'shipping_hook_url' => env('SLACK_SHIPPING_HOOK_URL'),
'opsalert_hook_url' => env('SLACK_OPSALERT_HOOK_URL'),
],
'yoco' => [
'mode' => env('YOCO_MODE', 'test'),
'secret_key' => $yoco_secret_key,
'public_key' => $yoco_public_key,
'webhook_secret' => env('YOCO_WEBHOOK_SECRET'),
],
'google' => [
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'redirect' => env('GOOGLE_REDIRECT_URI', '/auth/google/callback'),
],
'google_places' => [
'api_key' => env('GOOGLE_PLACES_API_KEY'),
],
'shiplogic' => [
'api_key' => env('COURIER_API_KEY'),
'api_base_url' => env('COURIER_API_BASE_URL', 'https://api.shiplogic.com'),
'collection_address' => [
'type' => 'business',
'company' => env('SHIPLOGIC_COLLECTION_COMPANY', 'Two Tales Designs'),
'street_address' => env('SHIPLOGIC_COLLECTION_STREET', '194 Bancor Avenue'),
'local_area' => env('SHIPLOGIC_COLLECTION_AREA', 'Menlyn'),
'city' => env('SHIPLOGIC_COLLECTION_CITY', 'Cape Town'),
'zone' => env('SHIPLOGIC_COLLECTION_ZONE', 'Western Cape'),
'code' => env('SHIPLOGIC_COLLECTION_CODE', '8000'),
'country' => env('SHIPLOGIC_COLLECTION_COUNTRY', 'ZA'),
],
'collection_contact' => [
'name' => env('SHIPLOGIC_COLLECTION_CONTACT_NAME', 'Two Tales Designs'),
'email' => env('SHIPLOGIC_COLLECTION_EMAIL', env('MAIL_FROM_ADDRESS')),
'mobile_number' => env('SHIPLOGIC_COLLECTION_PHONE', '+27000000000'),
],
],
];