diff --git a/src/FedexRest/Entity/PackageSpecialServicesRequested.php b/src/FedexRest/Entity/PackageSpecialServicesRequested.php index 81a9bdb..6c97f40 100644 --- a/src/FedexRest/Entity/PackageSpecialServicesRequested.php +++ b/src/FedexRest/Entity/PackageSpecialServicesRequested.php @@ -2,12 +2,16 @@ namespace FedexRest\Entity; +use FedexRest\Services\Ship\Type\PackageSpecialServiceType; + class PackageSpecialServicesRequested { public array $specialServiceTypes; public ?DangerousGoodsDetail $dangerousGoodsDetail; public ?Weight $dryIceWeight; + public ?$signatureOptionType; + public ?PackageSpecialServiceType $dangerousGoods; /** * @param array $specialServiceTypes @@ -38,6 +42,16 @@ public function setDangerousGoodsDetail(?DangerousGoodsDetail $dangerousGoodsDet $this->dangerousGoodsDetail = $dangerousGoodsDetail; return $this; } + + /** + * @param ?DangerousGoods $dangerousGoods + * @return $this + */ + public function setDangerousGoods(?PackageSpecialServiceType $dangerousGoods): PackageSpecialServicesRequested + { + $this->dangerousGoods = $dangerousGoods; + return $this; + } /** * @param ?Weight $dryIceWeight @@ -48,12 +62,26 @@ public function setDryIceWeight(?Weight $dryIceWeight): PackageSpecialServicesRe $this->dryIceWeight = $dryIceWeight; return $this; } - + + /** + * @param ?PackageSpecialServiceType $signatureOptionType + * @return $this + */ + public function setSignatureOptionType(?PackageSpecialServiceType $signatureOptionType): PackageSpecialServicesRequested { + $this->signatureOptionType = $signatureOptionType; + return $this; + + } + public function prepare(): array { $data = []; - if (!empty($this->setSpecialServiceTypes)) { - $data['specialServiceTypes'] = $this->setSpecialServiceTypes; + if (!empty($this->specialServiceTypes)) { + $data['specialServiceTypes'] = $this->specialServiceTypes; + } + + if (!empty($this->dangerousGoods)) { + $data['dangerousGoods'] = $this->dangerousGoods; } if (!empty($this->dangerousGoodsDetail)) { @@ -63,7 +91,10 @@ public function prepare(): array { if (!empty($this->dryIceWeight)) { $data['dryIceWeight'] = $this->dryIceWeight->prepare(); } - + + if (!empty($this->signatureOptionType)) { + $data['signatureOptionType'] = $this->signatureOptionType; + } return $data; } diff --git a/src/FedexRest/Services/Rates/CreateRatesRequest.php b/src/FedexRest/Services/Rates/CreateRatesRequest.php index 6ce3d7e..2339fa2 100644 --- a/src/FedexRest/Services/Rates/CreateRatesRequest.php +++ b/src/FedexRest/Services/Rates/CreateRatesRequest.php @@ -12,10 +12,13 @@ use FedexRest\Services\Ship\Entity\Label; use FedexRest\Services\Ship\Entity\ShipmentSpecialServices; use FedexRest\Services\Ship\Entity\ShippingChargesPayment; +use FedexRest\Services\Ship\Entity\SmartPostInfoDetail; +use FedexRest\Services\Ship\Entity\CustomsClearanceDetail; use GuzzleHttp\Exception\GuzzleException; class CreateRatesRequest extends AbstractRequest { + protected Person $shipper; protected Person $recipient; protected Label $label; @@ -24,10 +27,12 @@ class CreateRatesRequest extends AbstractRequest protected array $rateRequestTypes; protected string $packagingType = ''; protected string $pickupType = ''; + protected ?SmartPostInfoDetail $smart_post; protected int $accountNumber; protected array $lineItems = []; protected ShipmentSpecialServices $shipmentSpecialServices; protected ShippingChargesPayment $shippingChargesPayment; + protected ?CustomsClearanceDetail $customsClearanceDetail; protected int $totalWeight; protected string $preferredCurrency = ''; protected int $totalPackageCount; @@ -154,6 +159,15 @@ public function getPickupType(): string return $this->pickupType; } + /** + * @param SmartPostInfoDetail $SmartPostInfoDetail + * @return $this + */ + public function setSmartPost(SmartPostInfoDetail $smartPost): CreateRatesRequest { + $this->smart_post = $smartPost; + return $this; + } + /** * @param int $accountNumber * @return $this @@ -229,6 +243,15 @@ public function getShippingChargesPayment(): ShippingChargesPayment { return $this->shippingChargesPayment; } + + /** + * @param CustomsClearanceDetail $customsClearanceDetail + * @return $this + */ + public function setCustomsClearanceDetail(CustomsClearanceDetail $customsClearanceDetail) { + $this->customsClearanceDetail = $customsClearanceDetail; + return $this; + } /** * @param int $totalWeight @@ -306,24 +329,24 @@ public function getServicesNeededOnRateFailure(): bool return $this->servicesNeededOnRateFailure; } - public function setVariableOptions(?string $variableOptions): CreateRatesRequest + public function setVariableOptions(string $variableOptions): CreateRatesRequest { $this->variableOptions = $variableOptions; return $this; } - public function getVariableOptions(): ?string + public function getVariableOptions(): string { return $this->variableOptions; } - public function setRateSortOrder(?string $rateSortOrder): CreateRatesRequest + public function setRateSortOrder(string $rateSortOrder): CreateRatesRequest { $this->rateSortOrder = $rateSortOrder; return $this; } - public function getRateSortOrder(): ?string + public function getRateSortOrder(): string { return $this->rateSortOrder; } @@ -383,11 +406,16 @@ public function getRequestedShipment(): array 'recipient' => $this->recipient->prepare(), 'pickupType' => $this->pickupType, 'requestedPackageLineItems' => $line_items, + 'smartPostInfoDetail' => $this->smart_post, ]; if (!empty($this->shipmentSpecialServices)) { $data['shipmentSpecialServices'] = $this->shipmentSpecialServices->prepare(); } + + if (!empty($this->customsClearanceDetail)) { + $data['customsClearanceDetail'] = $this->customsClearanceDetail->prepare(); + } if (!empty($this->serviceType)) { $data['serviceType'] = $this->serviceType; @@ -421,7 +449,7 @@ public function getRequestedShipment(): array } public function prepare(): array - { + { return [ 'accountNumber' => [ 'value' => $this->accountNumber, diff --git a/src/FedexRest/Services/Ship/Entity/Commodities.php b/src/FedexRest/Services/Ship/Entity/Commodities.php new file mode 100644 index 0000000..2f44df2 --- /dev/null +++ b/src/FedexRest/Services/Ship/Entity/Commodities.php @@ -0,0 +1,116 @@ +name = $name; + return $this; + } + + /** + * @param string $description + * @return $this + */ + public function setDescription(string $description): Commodities + { + $this->description = $description; + return $this; + } + + /** + * @param string $countryOfManufacture + * @return $this + */ + public function setCountryOfManufacture(string $countryOfManufacture): Commodities + { + $this->countryOfManufacture = $countryOfManufacture; + return $this; + } + + /** + * @param string $countryOfManufacture + * @return $this + */ + public function setQuantity(string $quantity): Commodities + { + $this->quantity = $quantity; + return $this; + } + + /** + * @param string $harmonizedCode + * @return $this + */ + public function setHarmonizedCode(string $harmonizedCode): Commodities + { + $this->harmonizedCode = $harmonizedCode; + return $this; + } + + /** + * @param Value $customsValue + * @return $this + */ + public function setCustomsValue(Value $customsValue): Commodities + { + $this->customsValue = $customsValue; + return $this; + } + + /** + * @param Weight $weight + * @return $this + */ + public function setWeight(Weight $weight): Commodities + { + $this->weight = $weight; + return $this; + } + + + public function prepare(): array { + $data = []; + if (!empty($this->name)) { + $data['name'] = ($this->name); + } + if (!empty($this->description)) { + $data['description'] = ($this->description); + } + if (!empty($this->countryOfManufacture)) { + $data['countryOfManufacture'] = ($this->countryOfManufacture); + } + if (!empty($this->quantity)) { + $data['quantity'] = ($this->quantity); + } + if (!empty($this->harmonizedCode)) { + $data['harmonizedCode'] = ($this->harmonizedCode); + } + if (!empty($this->weight)) { + $data['weight'] = ($this->weight); + } + if (!empty($this->customsValue)) { + $data['customsValue'] = ($this->customsValue); + } + return $data; + } + + +} diff --git a/src/FedexRest/Services/Ship/Entity/CustomsClearanceDetail.php b/src/FedexRest/Services/Ship/Entity/CustomsClearanceDetail.php new file mode 100644 index 0000000..3ec8021 --- /dev/null +++ b/src/FedexRest/Services/Ship/Entity/CustomsClearanceDetail.php @@ -0,0 +1,46 @@ +commodities = $commodities; + return $this; + } + + /** + * @param DutiesPayment $dutiesPayment + * @return $this + */ + public function setDutiesPayment(?DutiesPayment $dutiesPayment): CustomsClearanceDetail + { + $this->dutiesPayment = $dutiesPayment; + return $this; + } + + + public function prepare(): array { + $data = []; + if (!empty($this->commodities)) { + $data['commodities'] = (array($this->commodities->prepare())); + } + if (!empty($this->dutiesPayment)) { + $data['dutiesPayment'] = ($this->dutiesPayment); + } + return $data; + } + + +} diff --git a/src/FedexRest/Services/Ship/Entity/DutiesPayment.php b/src/FedexRest/Services/Ship/Entity/DutiesPayment.php new file mode 100644 index 0000000..b9423d7 --- /dev/null +++ b/src/FedexRest/Services/Ship/Entity/DutiesPayment.php @@ -0,0 +1,44 @@ +paymentType = $paymentType; + return $this; + } + + /** + * @param array $payor + * @return $this + */ + public function setPayor(string $payor = NULL): DutiesPayment + { + $this->payor = array('responsibleParty'=>$payor); + return $this; + } + + public function prepare(): array { + $data = []; + if (!empty($this->paymentType)) { + $data['paymentType'] = ($this->paymentType); + } + if (!empty($this->payor)) { + $data['payor'] = ($this->payor); + } + return $data; + } + + +} \ No newline at end of file diff --git a/src/FedexRest/Services/Ship/Type/AncillaryEncorsementType.php b/src/FedexRest/Services/Ship/Type/AncillaryEncorsementType.php new file mode 100644 index 0000000..15ab95f --- /dev/null +++ b/src/FedexRest/Services/Ship/Type/AncillaryEncorsementType.php @@ -0,0 +1,12 @@ +