From 966f099ffb1257f79bc83fe4f2ddd44eae08a582 Mon Sep 17 00:00:00 2001 From: Konstantinos Arvanitakis Date: Wed, 30 Sep 2026 20:58:10 +0300 Subject: [PATCH] Fix: Turning the bind of the ShippingMethodManagerInterface to a singleton, so that it can actually resolve the shipping methods --- src/Providers/ShippingServiceProvider.php | 8 +++++++- src/Shipping/Carriers/Elta/EltaFulfillmentService.php | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Providers/ShippingServiceProvider.php b/src/Providers/ShippingServiceProvider.php index 0de35ee..87279b0 100644 --- a/src/Providers/ShippingServiceProvider.php +++ b/src/Providers/ShippingServiceProvider.php @@ -154,7 +154,13 @@ class ShippingServiceProvider extends ServiceProvider // run before the Shipping::extend() calls below, which resolve — // and the facade then CACHES — whatever's bound at that moment). $this->app->booted(function () { - $this->app->bind(ShippingMethodManagerInterface::class, fn ($app) => $app->make(ShippingManager::class)); + // A singleton, not bind(): the queue worker clears every + // facade's cached instance before each job + // (Facade::clearResolvedInstances()), so with bind() the Shipping + // facade then built a fresh, empty manager — without the drivers + // extended below — and every queued job (tracking, voucher sync) + // saw no carriers at all. + $this->app->singleton(ShippingMethodManagerInterface::class, fn ($app) => $app->make(ShippingManager::class)); // Shipping::extend('acs', fn ($app) => $app->make(AcsRateDriver::class)); Shipping::extend('box-now', fn ($app) => $app->make(BoxNowRateDriver::class)); diff --git a/src/Shipping/Carriers/Elta/EltaFulfillmentService.php b/src/Shipping/Carriers/Elta/EltaFulfillmentService.php index 505956e..a6fce6a 100644 --- a/src/Shipping/Carriers/Elta/EltaFulfillmentService.php +++ b/src/Shipping/Carriers/Elta/EltaFulfillmentService.php @@ -278,6 +278,13 @@ class EltaFulfillmentService implements CarrierFulfillmentInterface, IssuesVouch public function trackShipment(Shipment $shipment): Collection { + // ELTA tracks a multi-parcel send by its main voucher only — an + // extra parcel's own number is rejected ("Λάθος ΣΥΔΕΤΑ"). Its + // history is the main voucher's, which is tracked on its own row. + if (! $shipment->is($this->masterOf($shipment))) { + return collect(); + } + $response = $this->client->getTracking([ 'web_vg' => $shipment->tracking_reference, 'pel_code' => config('elta.apost_code'),