-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add ups to nl, be and lu (#324)
INT-658 --------- Co-authored-by: jochemgravendeel <[email protected]>
- Loading branch information
1 parent
0cdbf7d
commit 065e50f
Showing
131 changed files
with
2,540 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MyParcelNL\Pdk\App\Options\Definition; | ||
|
||
use MyParcelNL\Pdk\App\Options\Contract\OrderOptionDefinitionInterface; | ||
use MyParcelNL\Pdk\Settings\Model\CarrierSettings; | ||
use MyParcelNL\Pdk\Shipment\Model\ShipmentOptions; | ||
use MyParcelNL\Pdk\Validation\Validator\CarrierSchema; | ||
|
||
class CollectDefinition implements OrderOptionDefinitionInterface | ||
{ | ||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getCarrierSettingsKey(): ?string | ||
{ | ||
return CarrierSettings::EXPORT_COLLECT; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getProductSettingsKey(): ?string | ||
{ | ||
return null; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getShipmentOptionsKey(): ?string | ||
{ | ||
return ShipmentOptions::COLLECT; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function validate(CarrierSchema $carrierSchema): bool | ||
{ | ||
return $carrierSchema->canHaveCollect(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?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 is 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; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/App/Order/Calculator/UPS/UPSDeliveryTypeCalculator.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
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; | ||
|
||
$isExpress = $deliveryOptions->deliveryType === DeliveryOptions::DELIVERY_TYPE_EXPRESS_NAME; | ||
if ( | ||
$isExpress | ||
&& $this->order->shippingAddress->cc !== CountryCodes::CC_NL | ||
) { | ||
$deliveryOptions->deliveryType = DeliveryOptions::DELIVERY_TYPE_STANDARD_NAME; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.