Skip to content

Commit

Permalink
wip: renamed files
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianSDV committed Nov 21, 2024
1 parent e44e453 commit 08d4726
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/App/Order/Calculator/UPS/UPSAgeCheckCalculator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace MyParcelNL\Pdk\App\Order\Calculator\UPS;

use MyParcelNL\Pdk\App\Order\Calculator\AbstractPdkOrderOptionCalculator;
use MyParcelNL\Pdk\Types\Service\TriStateService;

/**
* When age check is enabled, signature and only recipient are required.
*/
final class UPSAgeCheckCalculator extends AbstractPdkOrderOptionCalculator
{
public function calculate(): void
{
$shipmentOptions = $this->order->deliveryOptions->shipmentOptions;

if (TriStateService::ENABLED !== $shipmentOptions->ageCheck) {
return;
}

$shipmentOptions->signature = TriStateService::ENABLED;
$shipmentOptions->onlyRecipient = TriStateService::ENABLED;
}
}
26 changes: 26 additions & 0 deletions src/App/Order/Calculator/UPS/UPSDeliveryTypeCalculator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

Check notice on line 1 in src/App/Order/Calculator/UPS/UPSDeliveryTypeCalculator.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/App/Order/Calculator/UPS/UPSDeliveryTypeCalculator.php#L1

Missing required strict_types declaration

namespace MyParcelNL\Pdk\App\Order\Calculator\UPS;

use MyParcelNL\Pdk\App\Order\Calculator\AbstractPdkOrderOptionCalculator;
use MyParcelNL\Pdk\Base\Service\CountryCodes;
use MyParcelNL\Pdk\Shipment\Model\DeliveryOptions;

class UPSDeliveryTypeCalculator extends AbstractPdkOrderOptionCalculator
{
/**
* @inheritDoc
*/
public function calculate(): void
{
$deliveryOptions = $this->order->deliveryOptions;
$cc = $this->order->shippingAddress->cc;

switch ($deliveryOptions->deliveryType) {
case DeliveryOptions::DELIVERY_TYPE_EXPRESS_NAME:
if ($cc !== CountryCodes::CC_NL) {
$deliveryOptions->deliveryType = DeliveryOptions::DELIVERY_TYPE_STANDARD_NAME;
}
}
}
}

0 comments on commit 08d4726

Please sign in to comment.