Skip to content

Commit

Permalink
refactor(UPS): disable delivery date for all countries
Browse files Browse the repository at this point in the history
  • Loading branch information
GravendeelJochem committed Dec 11, 2024
1 parent 4b4c9b4 commit 2cc8ec1
Showing 1 changed file with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,12 @@
namespace MyParcelNL\Pdk\App\Order\Calculator\UPS;

use MyParcelNL\Pdk\App\Order\Calculator\AbstractPdkOrderOptionCalculator;
use MyParcelNL\Pdk\App\Order\Model\PdkOrder;
use MyParcelNL\Pdk\Base\Contract\CountryServiceInterface;
use MyParcelNL\Pdk\Facade\Pdk;

class UPSCountryShipmentOptionsCalculator extends AbstractPdkOrderOptionCalculator
{
private $countryService;

public function __construct(PdkOrder $order)
{
parent::__construct($order);

$this->countryService = Pdk::get(CountryServiceInterface::class);
}

// Comment: Always set delivery date to null for UPS shipments regardless of country
public function calculate(): void
{
$cc = $this->order->shippingAddress->cc;
if ($this->countryService->isRow($cc) || $this->countryService->isEu($cc) || $this->countryService->isLocalCountry($cc)) {
$this->order->deliveryOptions->date = null;
}
$this->order->deliveryOptions->date = null;
}
}

0 comments on commit 2cc8ec1

Please sign in to comment.