Skip to content

Commit

Permalink
feat(carriers): add ups shipping options
Browse files Browse the repository at this point in the history
  • Loading branch information
joerivanveen committed Nov 12, 2024
1 parent 863ba7b commit e4b25b0
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/Model/Consignment/AbstractConsignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ abstract class AbstractConsignment
public const SHIPMENT_OPTION_RETURN = 'return';
public const SHIPMENT_OPTION_SAME_DAY_DELIVERY = 'same_day_delivery';
public const SHIPMENT_OPTION_SIGNATURE = 'signature';
public const SHIPMENT_OPTION_COLLECT = 'collect';
public const SHIPMENT_OPTION_RECEIPT_CODE = 'receipt_code';
/**
* @deprecated since jan 2023 extra_assurance is no longer supported
Expand All @@ -57,6 +58,7 @@ abstract class AbstractConsignment
self::SHIPMENT_OPTION_ONLY_RECIPIENT,
self::SHIPMENT_OPTION_RETURN,
self::SHIPMENT_OPTION_SIGNATURE,
self::SHIPMENT_OPTION_COLLECT,
self::SHIPMENT_OPTION_RECEIPT_CODE,
];

Expand All @@ -72,6 +74,7 @@ abstract class AbstractConsignment
public const DELIVERY_TYPE_STANDARD = 2;
public const DELIVERY_TYPE_EVENING = 3;
public const DELIVERY_TYPE_PICKUP = 4;
public const DELIVERY_TYPE_EXPRESS = 7;

/**
* @deprecated Since November 2019 is it no longer possible to use pickup express.
Expand All @@ -82,6 +85,7 @@ abstract class AbstractConsignment
public const DELIVERY_TYPE_STANDARD_NAME = 'standard';
public const DELIVERY_TYPE_EVENING_NAME = 'evening';
public const DELIVERY_TYPE_PICKUP_NAME = 'pickup';
public const DELIVERY_TYPE_EXPRESS_NAME = 'express';

/**
* @deprecated Since November 2019 is it no longer possible to use pickup express.
Expand All @@ -94,6 +98,7 @@ abstract class AbstractConsignment
self::DELIVERY_TYPE_STANDARD,
self::DELIVERY_TYPE_EVENING,
self::DELIVERY_TYPE_PICKUP,
self::DELIVERY_TYPE_EXPRESS,
self::DELIVERY_TYPE_PICKUP_EXPRESS,
];

Expand All @@ -103,6 +108,7 @@ abstract class AbstractConsignment
self::DELIVERY_TYPE_STANDARD_NAME,
self::DELIVERY_TYPE_EVENING_NAME,
self::DELIVERY_TYPE_PICKUP_NAME,
self::DELIVERY_TYPE_EXPRESS_NAME,
self::DELIVERY_TYPE_PICKUP_EXPRESS_NAME,
];

Expand All @@ -112,6 +118,7 @@ abstract class AbstractConsignment
self::DELIVERY_TYPE_STANDARD_NAME => self::DELIVERY_TYPE_STANDARD,
self::DELIVERY_TYPE_EVENING_NAME => self::DELIVERY_TYPE_EVENING,
self::DELIVERY_TYPE_PICKUP_NAME => self::DELIVERY_TYPE_PICKUP,
self::DELIVERY_TYPE_EXPRESS_NAME => self::DELIVERY_TYPE_EXPRESS,
self::DELIVERY_TYPE_PICKUP_EXPRESS_NAME => self::DELIVERY_TYPE_PICKUP_EXPRESS,
];

Expand Down
53 changes: 52 additions & 1 deletion src/Model/Consignment/UPSConsignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,58 @@ public function getAllowedPackageTypes(): array
public function getAllowedDeliveryTypes(): array
{
return [
self::DELIVERY_TYPE_STANDARD,
self::DELIVERY_TYPE_STANDARD_NAME,
self::DELIVERY_TYPE_EXPRESS_NAME,
];
}

/**
* @return string[]
*/
public function getAllowedShipmentOptions(): array
{
return [
self::SHIPMENT_OPTION_AGE_CHECK,
self::SHIPMENT_OPTION_COLLECT,
self::SHIPMENT_OPTION_INSURANCE,
self::SHIPMENT_OPTION_ONLY_RECIPIENT,
self::SHIPMENT_OPTION_SIGNATURE,
];
}

/**
* @return int[]
*/
protected function getLocalInsurancePossibilities(): array
{
return [
250,
500,
1000,
1500,
2000,
2500,
3000,
3500,
4000,
4500,
5000,
];
}

/**
* @return int[]
*/
protected function getEuInsurancePossibilities(): array
{
return $this->getLocalInsurancePossibilities();
}

/**
* @return array
*/
protected function getNlToBeInsurancePossibilities(): array
{
return $this->getLocalInsurancePossibilities();
}
}

0 comments on commit e4b25b0

Please sign in to comment.