2026-09-29 14:31:30 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Modules\Core\Shipping\Carriers\Elta;
|
|
|
|
|
|
|
|
|
|
use Lunar\DataTypes\ShippingOption;
|
|
|
|
|
use Lunar\Shipping\DataTransferObjects\ShippingOptionRequest;
|
|
|
|
|
use Lunar\Shipping\Interfaces\ShippingRateInterface;
|
2026-09-30 17:28:47 +03:00
|
|
|
use Lunar\Shipping\Models\ShippingMethod;
|
2026-09-29 14:31:30 +03:00
|
|
|
use Lunar\Shipping\Models\ShippingRate;
|
|
|
|
|
use Modules\Core\Shipping\Concerns\ExcludesRestrictedProducts;
|
|
|
|
|
use Modules\Core\Shipping\Concerns\ResolvesFixedPricing;
|
|
|
|
|
use Modules\Core\Shipping\Contracts\DeclaresFulfillmentType;
|
|
|
|
|
use Modules\Core\Shipping\Contracts\SupportsCashCollection;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* None of ELTA's four SOAP operations (create/label/track/station) expose
|
|
|
|
|
* a price-quote/calculation call, so — like Box Now — this always
|
|
|
|
|
* resolves the method's own charge_by + price-break configuration, never
|
|
|
|
|
* live pricing. Does not implement SupportsLivePricing.
|
|
|
|
|
*
|
|
|
|
|
* Implements SupportsCashCollection: an ELTA courier hands a parcel to
|
|
|
|
|
* the recipient in person, the same fact as AcsRateDriver, unlike Box
|
|
|
|
|
* Now's unattended lockers.
|
|
|
|
|
*/
|
|
|
|
|
class EltaRateDriver implements ShippingRateInterface, DeclaresFulfillmentType, SupportsCashCollection
|
|
|
|
|
{
|
|
|
|
|
use ResolvesFixedPricing;
|
|
|
|
|
use ExcludesRestrictedProducts;
|
|
|
|
|
|
|
|
|
|
public ShippingRate $shippingRate;
|
|
|
|
|
|
|
|
|
|
public function name(): string
|
|
|
|
|
{
|
|
|
|
|
return 'ELTA Courier';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function fulfillmentType(): string
|
|
|
|
|
{
|
|
|
|
|
return 'carrier';
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-30 17:28:47 +03:00
|
|
|
public function collectsCash(ShippingMethod $method): bool
|
2026-09-29 14:31:30 +03:00
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function description(): string
|
|
|
|
|
{
|
|
|
|
|
return 'Delivery via ELTA Courier.';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function resolve(ShippingOptionRequest $shippingOptionRequest): ?ShippingOption
|
|
|
|
|
{
|
|
|
|
|
if ($this->cartHasExcludedProducts($shippingOptionRequest->shippingRate, $shippingOptionRequest->cart)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $this->resolveFixedPrice(
|
|
|
|
|
$shippingOptionRequest->shippingRate,
|
|
|
|
|
$shippingOptionRequest->shippingRate->shippingMethod,
|
|
|
|
|
$shippingOptionRequest->cart,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function on(ShippingRate $shippingRate): self
|
|
|
|
|
{
|
|
|
|
|
$this->shippingRate = $shippingRate;
|
|
|
|
|
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
}
|