diff --git a/README.md b/README.md index f717ceb..13a8e9c 100644 --- a/README.md +++ b/README.md @@ -2,16 +2,32 @@ Adds Aramex Functionality to Laravel. -This repo is a rebuild of digitalcloud/aramex. +This repo is a full rebuild of DigitalCloud/aramex. ## Table of Contents -* Installation -* QuickStart - * Location - * Rate - * Shipping - * Tracking +* [Installation](#installation) +* [QuickStart](#quickstart) + * [Location](#location) + * [Fetch Countries](#fetch-countries) + * [Fetch Country](#fetch-country) + * [Fetch States](#fetch-states) + * [Fetch Cities](#fetch-cities) + * [Validate Address](#validate-address) + * [Rate](#rate) + * [Calculate Rate](#calculate-rate) + * [Shipping](#shipping) + * [Create Pickup](#create-pickup) + * [Cancel Pickup](#cancel-Pickup) + * [Create Shipments](#create-shipments) + * [Get Last Shipments Numbers Range](#get-last-shipments-numbers-range) + * [Print Label](#print-label) + * [Reserve Shipment Number Range](#reserve-shipment-number-range) + * [Schedule Delivery](#schedule-delivery) + * [Tracking](#tracking) + * [Track Pickup](#track-pickup) + * [Track Shipments](#track-shipments) +* [Credits](#credits) ## Installation @@ -24,68 +40,149 @@ Run the following command to install the latest applicable version of the packag ### Location #### Fetch Countries +This method allows users to get the world countries list. - Aramex::FetchCountries()->make(); + Aramex::fetchCountries()->run(); #### Fetch Country +This method allows users to get details of a certain country. - Aramex::FetchCountry()->make(); + Aramex::fetchCountry() + ->setCode('PS') + ->run(); #### Fetch States +This method allows users to get all the states within a certain country (country code). - Aramex::FetchStates()->make(); + Aramex::fetchStates() + ->setCountryCode('AE') + ->run(); #### Fetch Cities +This method allows users to get all the cities within a certain country (country code). And allows users to get list of the cities that start with a specific prefix. The required nodes to be filled are Client Info and Country Code. - Aramex::FetchCities()->make(); + Aramex::fetchCities() + ->setCountryCode('AE') + ->run(); #### Validate Address - - Aramex::ValidateAddress()->make(); +This method Allows users to search for certain addresses and make sure that the address structure is correct. + + Aramex::validateAddress() + ->setAddress( + (new Address()) ... + )->run(); ### Rate -### Calculate Rate +#### Calculate Rate +This method allows users to get rate for source/destinations shipment. + + $source = (new Address()) ... ; + + $destination = (new Address()) ...; - Aramex::CalculateRate()->make(); + $details = (new ShipmentDetails()) ...; + + Aramex::calculateRate() + ->setOriginalAddress($source) + ->setDestinationAddress($destination) + ->setShipmentDetails($details) + ->setPreferredCurrencyCode('USD') + ->run(); ### Shipping #### Create Pickup +This method allows users to create a pickup request. - Aramex::CreatePickup()->make(); + $source = (new Address()); + + $contact = (new Contact()); + + $pickupItem = (new PickupItem()); + + $pickup = (new Pickup()) + ->setPickupAddress($source) + ->setPickupContact($contact) + ->setPickupLocation('Reception') + ->setPickupDate(Carbon::now()->timestamp) + ->setReadyTime(Carbon::now()->timestamp) + ->setLastPickupTime(Carbon::now()->addDay()->timestamp) + ->setClosingTime(Carbon::now()->addDay()->timestamp) + ->setStatus('Pending') + ->setReference1('') + ->addPickupItem($pickupItem); + + $labelInfo = (new LabelInfo()) + ->setReportId(9201) + ->setReportType('URL'); + + Aramex::createPickup() + ->setLabelInfo($labelInfo) + ->setPickup($pickup) + ->run(); #### Cancel Pickup +This method allows you to cancel a pickup as long as it is un-assigned or pending details. - Aramex::CancelPickup()->make(); + Aramex::cancelPickup() + ->setPickupGUID('PICKUP_GUID') + ->run(); #### Create Shipments +This method allows users to create shipments on Aramex’s system. - Aramex::CreateShipments()->make(); + Aramex::createShipments()->run(); #### Get Last Shipments Numbers Range +This method allows you to inquire about the last reserved range using a specific entity and product group - Aramex::GetLastShipmentsNumbersRange()->make(); + Aramex::getLastShipmentsNumbersRange() + ->setEntity('ENTITY') + ->setProductGroup('PRODUCT_GROUP') + ->run(); #### Print Label +This method allows the user to print a label for an existing shipment. - Aramex::PrintLabel()->make(); + $labelInfo = (new \ExtremeSa\Aramex\API\Classes\LabelInfo()) + ->setReportId(9201) + ->setReportType('URL'); + + Aramex::printLabel() + ->setShipmentNumber('SHIPMENT_NO') + ->setLabelInfo() + ->run(); #### Reserve Shipment Number Range +This method allows you to reserve a range of shipment numbers. - Aramex::ReserveShipmentNumberRange()->make(); + Aramex::reserveShipmentNumberRange()->run(); #### Schedule Delivery +This method allows you to schedule the delivery of a shipment at a specified time and place (Longitude and Latitude) - Aramex::ScheduleDelivery()->make(); + Aramex::scheduleDelivery()->run(); ### Tracking #### Track Pickup +This method allows the user to track an existing pickup’s updates and latest status. - Aramex::TrackPickup()->make(); + Aramex::trackPickup() + ->setReference('PICKUP_NO') + ->setPickup('PICKUP') // any number + ->run(); #### Track Shipments +This method allows the user to track an existing shipment’s updates and latest status. - Aramex::TrackShipments()->make(); + Aramex::trackShipments() + ->setShipments(['SHIPMENT_NO']) + ->run(); + +## Credits +* [Ismail Ashour](https://github.com/drashoor/) +* All Contributors diff --git a/src/API/Classes/Country.php b/src/API/Classes/Country.php index 573e9cb..4a8db4d 100644 --- a/src/API/Classes/Country.php +++ b/src/API/Classes/Country.php @@ -31,6 +31,7 @@ public function getCode(): ?string /** * @param string|null $code + * @return Country */ public function setCode(string $code): Country { @@ -48,6 +49,7 @@ public function getName(): ?string /** * @param string|null $name + * @return Country */ public function setName(string $name): Country { @@ -65,6 +67,7 @@ public function getIsoCode(): ?string /** * @param string|null $isoCode + * @return Country */ public function setIsoCode(string $isoCode): Country { @@ -82,6 +85,7 @@ public function getStateRequired(): bool /** * @param bool $stateRequired + * @return Country */ public function setStateRequired(bool $stateRequired): Country { @@ -99,6 +103,7 @@ public function getPostCodeRequired(): bool /** * @param bool $postCodeRequired + * @return Country */ public function setPostCodeRequired(bool $postCodeRequired): Country { @@ -117,6 +122,7 @@ public function getPostCodeRegex(): ?array /** * @param array $postCodeRegex * todo + * @return Country */ public function setPostCodeRegex(array $postCodeRegex): Country { @@ -134,6 +140,7 @@ public function getInternationalCallingNumber(): ?string /** * @param string|null $internationalCallingNumber + * @return Country */ public function setInternationalCallingNumber(string $internationalCallingNumber): Country { diff --git a/src/API/Classes/DateTime.php b/src/API/Classes/DateTime.php index 9bb0359..967b801 100644 --- a/src/API/Classes/DateTime.php +++ b/src/API/Classes/DateTime.php @@ -21,10 +21,12 @@ public function getShippingDate() /** * The date Aramex receives the shipment to be shipped out. * @param mixed $shippingDate + * @return DateTime */ - public function setShippingDate($shippingDate): void + public function setShippingDate($shippingDate): DateTime { $this->shippingDate = $shippingDate; + return $this; } /** @@ -38,10 +40,12 @@ public function getDueDate() /** * The date specified for shipment to be delivered to the consignee. * @param mixed $dueDate + * @return DateTime */ - public function setDueDate($dueDate): void + public function setDueDate($dueDate): DateTime { $this->dueDate = $dueDate; + return $this; } diff --git a/src/API/Classes/Dimension.php b/src/API/Classes/Dimension.php index 5a6ebde..4527d5a 100644 --- a/src/API/Classes/Dimension.php +++ b/src/API/Classes/Dimension.php @@ -29,9 +29,9 @@ public function getLength() /** * Measurements required in calculating the Chargeable Weight, If any of the Dimensional values are filled then the rest must be filled. * @param float $length - * @return $this + * @return Dimension */ - public function setLength(float $length) + public function setLength(float $length): Dimension { $this->length = $length; return $this; @@ -48,9 +48,9 @@ public function getWidth() /** * Measurements required in calculating the Chargeable Weight, If any of the Dimensional values are filled then the rest must be filled. * @param float $width - * @return $this + * @return Dimension */ - public function setWidth(float $width) + public function setWidth(float $width): Dimension { $this->width = $width; return $this; @@ -67,9 +67,9 @@ public function getHeight() /** * Measurements required in calculating the Chargeable Weight, If any of the Dimensional values are filled then the rest must be filled. * @param float $height - * @return $this + * @return Dimension */ - public function setHeight(float $height) + public function setHeight(float $height): Dimension { $this->height = $height; return $this; @@ -88,9 +88,9 @@ public function getUnit() * CM = Centimeter * M = Meter * @param string $unit - * @return $this + * @return Dimension */ - public function setUnit(string $unit) + public function setUnit(string $unit): Dimension { $this->unit = $unit; return $this; @@ -98,20 +98,22 @@ public function setUnit(string $unit) /** * Centimeter - * @return $this + * @return Dimension */ - public function useCentimeterAsUnit() + public function useCentimeterAsUnit(): Dimension { - return $this->setUnit('CM'); + $this->setUnit('CM'); + return $this; } /** * Meter - * @return $this + * @return Dimension */ - public function useMeterAsUnit() + public function useMeterAsUnit(): Dimension { - return $this->setUnit('M'); + $this->setUnit('M'); + return $this; } public function normalize(): array diff --git a/src/API/Classes/LabelInfo.php b/src/API/Classes/LabelInfo.php index 25b4c72..8eb182e 100644 --- a/src/API/Classes/LabelInfo.php +++ b/src/API/Classes/LabelInfo.php @@ -30,7 +30,7 @@ public function getReportId(): int * @param int $reportId * @return $this */ - public function setReportId(int $reportId) + public function setReportId(int $reportId): LabelInfo { $this->reportId = $reportId; return $this; @@ -49,7 +49,7 @@ public function getReportType(): string * @param string $reportType : URL|RPT * @return $this */ - public function setReportType(string $reportType) + public function setReportType(string $reportType): LabelInfo { $this->reportType = $reportType; return $this; diff --git a/src/API/Classes/Money.php b/src/API/Classes/Money.php index 12a28fb..ce4945d 100644 --- a/src/API/Classes/Money.php +++ b/src/API/Classes/Money.php @@ -29,7 +29,7 @@ public function getCurrencyCode() * @param string $currencyCode * @return $this */ - public function setCurrencyCode(string $currencyCode) + public function setCurrencyCode(string $currencyCode): Money { $this->currencyCode = $currencyCode; return $this; @@ -39,9 +39,10 @@ public function setCurrencyCode(string $currencyCode) * United States Dollar * @return Money */ - public function useUnitedStatesDollarAsCurrency() + public function useUnitedStatesDollarAsCurrency(): Money { - return $this->setCurrencyCode('USD'); + $this->setCurrencyCode('USD'); + return $this; } /** @@ -55,9 +56,9 @@ public function getValue() /** * The Monetary value. * @param float $value - * @return $this + * @return Money */ - public function setValue(float $value) + public function setValue(float $value): Money { $this->value = $value; return $this; diff --git a/src/API/Classes/Notification.php b/src/API/Classes/Notification.php index ea423fe..5393702 100644 --- a/src/API/Classes/Notification.php +++ b/src/API/Classes/Notification.php @@ -26,9 +26,9 @@ public function getCode(): string * To Identify the notification category. * * @param string $code - * @return $this + * @return Notification */ - public function setCode(string $code) + public function setCode(string $code): Notification { $this->code = $code; return $this; @@ -46,9 +46,9 @@ public function getMessage(): string * Deeper description of the Notification. * * @param string $message - * @return $this + * @return Notification */ - public function setMessage(string $message) + public function setMessage(string $message): Notification { $this->message = $message; return $this; @@ -74,7 +74,7 @@ public static function parseArray($notificationsData) }, $notificationsData); } - public static function parse($item) + public static function parse($item): Notification { return (new self()) ->setCode(object_get($item, 'Code')) diff --git a/src/API/Classes/Office.php b/src/API/Classes/Office.php index 1be3238..d76c2eb 100644 --- a/src/API/Classes/Office.php +++ b/src/API/Classes/Office.php @@ -189,7 +189,15 @@ public function setLatitude(float $latitude): Office public function normalize(): array { return [ - 'Code' => $this->getCode(), + 'Entity' => $this->getEntity(), + 'EntityDescription' => $this->getEntityDescription(), + 'OfficeType' => $this->getOfficeType(), + 'Address' => $this->getAddress()->normalize(), + 'Telephone' => $this->getTelephone(), + 'WorkingDays' => $this->getWorkingDays(), + 'WorkingHours' => $this->getWorkingHours(), + 'Longtitude' => $this->getLongtitude(), + 'Latitude' => $this->getLatitude(), ]; } } \ No newline at end of file diff --git a/src/API/Classes/Party.php b/src/API/Classes/Party.php index eb63741..f1ddefd 100644 --- a/src/API/Classes/Party.php +++ b/src/API/Classes/Party.php @@ -75,7 +75,7 @@ public function getAccountNumber(): ?string * @param string $accountNumber * @return $this */ - public function setAccountNumber(string $accountNumber) + public function setAccountNumber(string $accountNumber): Party { $this->accountNumber = $accountNumber; return $this; @@ -116,7 +116,7 @@ public function getContact(): Contact * @param Contact $contact * @return Party */ - public function setContact(Contact $contact) + public function setContact(Contact $contact): Party { $this->contact = $contact; return $this; diff --git a/src/API/Classes/Pickup.php b/src/API/Classes/Pickup.php index e0f4071..7234d1f 100644 --- a/src/API/Classes/Pickup.php +++ b/src/API/Classes/Pickup.php @@ -51,7 +51,7 @@ public function getPickupAddress(): Address * @param Address $pickupAddress * @return Pickup */ - public function setPickupAddress(Address $pickupAddress) + public function setPickupAddress(Address $pickupAddress): Pickup { $this->pickupAddress = $pickupAddress; return $this; @@ -69,7 +69,7 @@ public function getPickupContact(): Contact * @param Contact $pickupContact * @return Pickup */ - public function setPickupContact(Contact $pickupContact) + public function setPickupContact(Contact $pickupContact): Pickup { $this->pickupContact = $pickupContact; return $this; @@ -87,7 +87,7 @@ public function getPickupLocation(): string * @param string $pickupLocation * @return Pickup */ - public function setPickupLocation(string $pickupLocation) + public function setPickupLocation(string $pickupLocation): Pickup { $this->pickupLocation = $pickupLocation; return $this; @@ -123,10 +123,10 @@ public function getReadyTime(): int * Ready time should always be before latest and closingtime. * Date should not be before the current day or more than seven days in advance of the current date. * - * @param string $readyTime + * @param int $readyTime * @return Pickup */ - public function setReadyTime(int $readyTime) + public function setReadyTime(int $readyTime): Pickup { $this->readyTime = $readyTime; return $this; @@ -180,7 +180,7 @@ public function getComments(): ?string * @param string $comments * @return Pickup */ - public function setComments(string $comments) + public function setComments(string $comments): Pickup { $this->comments = $comments; return $this; @@ -200,7 +200,7 @@ public function getReference1(): string * @param string $reference1 * @return Pickup */ - public function setReference1(string $reference1) + public function setReference1(string $reference1): Pickup { $this->reference1 = $reference1; return $this; @@ -220,7 +220,7 @@ public function getReference2(): ?string * @param string $reference2 * @return Pickup */ - public function setReference2(string $reference2) + public function setReference2(string $reference2): Pickup { $this->reference2 = $reference2; return $this; @@ -258,7 +258,7 @@ public function getShipments(): ?array * @param Shipment[] $shipments * @return Pickup */ - public function setShipments(array $shipments) + public function setShipments(array $shipments): Pickup { $this->shipments = $shipments; return $this; @@ -286,7 +286,7 @@ public function getPickItems(): array * @param PickupItem[] $pickItems * @return Pickup */ - public function setPickItems(array $pickItems) + public function setPickItems(array $pickItems): Pickup { $this->pickItems = $pickItems; return $this; diff --git a/src/API/Classes/Shipment.php b/src/API/Classes/Shipment.php index 124d584..748e199 100644 --- a/src/API/Classes/Shipment.php +++ b/src/API/Classes/Shipment.php @@ -46,7 +46,7 @@ public function getReference1(): string * @param string $reference1 * @return $this */ - public function setReference1(string $reference1) + public function setReference1(string $reference1): Shipment { $this->reference1 = $reference1; return $this; @@ -66,7 +66,7 @@ public function getReference2(): ?string * @param string $reference2 * @return $this */ - public function setReference2(string $reference2) + public function setReference2(string $reference2): Shipment { $this->reference2 = $reference2; return $this; @@ -86,7 +86,7 @@ public function getReference3(): ?string * @param string $reference3 * @return $this */ - public function setReference3(string $reference3) + public function setReference3(string $reference3): Shipment { $this->reference3 = $reference3; return $this; @@ -104,7 +104,7 @@ public function getShipper(): Party * @param Party $shipper * @return $this */ - public function setShipper(Party $shipper) + public function setShipper(Party $shipper): Shipment { $this->shipper = $shipper; return $this; @@ -122,7 +122,7 @@ public function getConsignee(): Party * @param Party $consignee * @return $this */ - public function setConsignee(Party $consignee) + public function setConsignee(Party $consignee): Shipment { $this->consignee = $consignee; return $this; @@ -140,7 +140,7 @@ public function getThirdParty(): ?Party * @param Party $thirdParty * @return $this */ - public function setThirdParty(Party $thirdParty) + public function setThirdParty(Party $thirdParty): Shipment { $this->thirdParty = $thirdParty; return $this; @@ -160,7 +160,7 @@ public function getShippingDateTime() * @param int $shippingDateTime * @return $this */ - public function setShippingDateTime(int $shippingDateTime) + public function setShippingDateTime(int $shippingDateTime): Shipment { $this->shippingDateTime = $shippingDateTime; return $this; @@ -180,7 +180,7 @@ public function getDueDate() * @param int $dueDate * @return $this */ - public function setDueDate(int $dueDate) + public function setDueDate(int $dueDate): Shipment { $this->dueDate = $dueDate; return $this; @@ -200,7 +200,7 @@ public function getComments(): ?string * @param string $comments * @return $this */ - public function setComments(string $comments) + public function setComments(string $comments): Shipment { $this->comments = $comments; return $this; @@ -220,7 +220,7 @@ public function getPickupLocation(): string * @param string $pickupLocation * @return $this */ - public function setPickupLocation(string $pickupLocation) + public function setPickupLocation(string $pickupLocation): Shipment { $this->pickupLocation = $pickupLocation; return $this; @@ -240,7 +240,7 @@ public function getOperationsInstructions(): ?string * @param string $operationsInstructions * @return $this */ - public function setOperationsInstructions(string $operationsInstructions) + public function setOperationsInstructions(string $operationsInstructions): Shipment { $this->operationsInstructions = $operationsInstructions; return $this; @@ -260,7 +260,7 @@ public function getAccountingInstructions(): ?string * @param string $accountingInstructions * @return $this */ - public function setAccountingInstructions(string $accountingInstructions) + public function setAccountingInstructions(string $accountingInstructions): Shipment { $this->accountingInstructions = $accountingInstructions; return $this; @@ -278,7 +278,7 @@ public function getDetails(): ShipmentDetails * @param ShipmentDetails $details * @return $this */ - public function setDetails(ShipmentDetails $details) + public function setDetails(ShipmentDetails $details): Shipment { $this->details = $details; return $this; @@ -297,7 +297,7 @@ public function getAttachments(): ?array * @param array $attachments * @return $this */ - public function setAttachments(array $attachments) + public function setAttachments(array $attachments): Shipment { $this->attachments = $attachments; return $this; @@ -307,7 +307,7 @@ public function setAttachments(array $attachments) * @param Attachment $attachment * @return $this */ - public function addAttachment(Attachment $attachment) + public function addAttachment(Attachment $attachment): Shipment { $this->attachments[] = $attachment; return $this; @@ -327,7 +327,7 @@ public function getForeignHAWB(): ?string * @param string $foreignHAWB * @return $this */ - public function setForeignHAWB(string $foreignHAWB) + public function setForeignHAWB(string $foreignHAWB): Shipment { $this->foreignHAWB = $foreignHAWB; return $this; @@ -347,7 +347,7 @@ public function getTransportType(): int * @param int $transportType * @return $this */ - public function setTransportType(int $transportType) + public function setTransportType(int $transportType): Shipment { $this->transportType = $transportType; return $this; @@ -370,7 +370,7 @@ public function getNumber(): ?string * @param string $number * @return $this */ - public function setNumber(string $number) + public function setNumber(string $number): Shipment { $this->number = $number; return $this; @@ -392,7 +392,7 @@ public function getPickupGUID(): ?string * @param string $pickupGUID * @return $this */ - public function setPickupGUID(string $pickupGUID) + public function setPickupGUID(string $pickupGUID): Shipment { $this->pickupGUID = $pickupGUID; return $this; diff --git a/src/API/Classes/ShipmentDetails.php b/src/API/Classes/ShipmentDetails.php index 8e02318..7bd68d6 100644 --- a/src/API/Classes/ShipmentDetails.php +++ b/src/API/Classes/ShipmentDetails.php @@ -38,9 +38,9 @@ public function getDimensions() /** * Measurements required in calculating the Chargeable Weight, If any of the dimensional values are filled then the rest must be filled. * @param Dimension $dimensions - * @return $this + * @return ShipmentDetails */ - public function setDimensions(Dimension $dimensions) + public function setDimensions(Dimension $dimensions): ShipmentDetails { $this->dimensions = $dimensions; return $this; @@ -57,9 +57,9 @@ public function getActualWeight() /** * Total actual shipment weight. If the Dimensions are filled, charging weight is compared to actual and the highest value is filled here. * @param Weight $actualWeight - * @return $this + * @return ShipmentDetails */ - public function setActualWeight(Weight $actualWeight) + public function setActualWeight(Weight $actualWeight): ShipmentDetails { $this->actualWeight = $actualWeight; return $this; @@ -75,9 +75,9 @@ public function getChargeableWeight() /** * @param Weight $chargeableWeight - * @return $this + * @return ShipmentDetails */ - public function setChargeableWeight(Weight $chargeableWeight) + public function setChargeableWeight(Weight $chargeableWeight): ShipmentDetails { $this->chargeableWeight = $chargeableWeight; return $this; @@ -94,9 +94,9 @@ public function getDescriptionOfGoods() /** * The Nature of Shipment Contents. Example: Clothes, Electronic * @param string $descriptionOfGoods - * @return $this + * @return ShipmentDetails */ - public function setDescriptionOfGoods(string $descriptionOfGoods) + public function setDescriptionOfGoods(string $descriptionOfGoods): ShipmentDetails { $this->descriptionOfGoods = $descriptionOfGoods; return $this; @@ -113,9 +113,9 @@ public function getGoodsOriginCountry() /** * The Origin of which the product in the shipment came from * @param string $goodsOriginCountry - * @return $this + * @return ShipmentDetails */ - public function setGoodsOriginCountry(string $goodsOriginCountry) + public function setGoodsOriginCountry(string $goodsOriginCountry): ShipmentDetails { $this->goodsOriginCountry = $goodsOriginCountry; return $this; @@ -132,9 +132,9 @@ public function getNumberOfPieces() /** * Number of shipment pieces * @param int $numberOfPieces - * @return $this + * @return ShipmentDetails */ - public function setNumberOfPieces(int $numberOfPieces) + public function setNumberOfPieces(int $numberOfPieces): ShipmentDetails { $this->numberOfPieces = $numberOfPieces; return $this; @@ -151,26 +151,27 @@ public function getProductGroup() /** * EXP = Express DOM = Domestic * @param string $productGroup - * @return $this + * @return ShipmentDetails */ - public function setProductGroup(string $productGroup) + public function setProductGroup(string $productGroup): ShipmentDetails { $this->productGroup = $productGroup; return $this; } /** - * @return $this + * @return ShipmentDetails */ - public function useExpressAsProductGroup() + public function useExpressAsProductGroup(): ShipmentDetails { return $this->setProductGroup('EXP'); + } /** - * @return $this + * @return ShipmentDetails */ - public function useDomesticAsProductGroup() + public function useDomesticAsProductGroup(): ShipmentDetails { return $this->setProductGroup('DOM'); } @@ -186,9 +187,9 @@ public function getProductType() /** * Priority Document Express. * Urgent, time sensitive consignments containing printed matter or document material. - * @return $this + * @return ShipmentDetails */ - public function usePriorityDocumentExpressAsProductType() + public function usePriorityDocumentExpressAsProductType(): ShipmentDetails { return $this->setProductType('PDX'); } @@ -196,9 +197,9 @@ public function usePriorityDocumentExpressAsProductType() /** * Priority Parcel Express. * Urgent, time sensitive consignments containing non-printed matter or non-document material. - * @return $this + * @return ShipmentDetails */ - public function usePriorityParcelExpressAsProductType() + public function usePriorityParcelExpressAsProductType(): ShipmentDetails { return $this->setProductType('PPX'); } @@ -206,9 +207,9 @@ public function usePriorityParcelExpressAsProductType() /** * Priority Letter Express. * Urgent, time sensitive consignments containing printed matter of weight less than 0.5 kg. - * @return $this + * @return ShipmentDetails */ - public function usePriorityLetterExpressAsProductType() + public function usePriorityLetterExpressAsProductType(): ShipmentDetails { return $this->setProductType('PLX'); } @@ -216,9 +217,9 @@ public function usePriorityLetterExpressAsProductType() /** * Deferred Document Express. * 2nd Day Delivery consignments containing printed matter or document material. - * @return $this + * @return ShipmentDetails */ - public function useDeferredDocumentExpressAsProductType() + public function useDeferredDocumentExpressAsProductType(): ShipmentDetails { return $this->setProductType('DDX'); } @@ -226,9 +227,9 @@ public function useDeferredDocumentExpressAsProductType() /** * Deferred Parcel Express. * 2nd Day Delivery consignments containing non-printed matter or non-document material. - * @return $this + * @return ShipmentDetails */ - public function setDeferredParcelExpressProductType() + public function setDeferredParcelExpressProductType(): ShipmentDetails { return $this->setProductType('DPX'); } @@ -236,9 +237,9 @@ public function setDeferredParcelExpressProductType() /** * Ground Document Express. * Ground delivery consignments containing printed matter or document material. - * @return $this + * @return ShipmentDetails */ - public function setGroundDocumentExpressProductType() + public function setGroundDocumentExpressProductType(): ShipmentDetails { return $this->setProductType('GDX'); } @@ -246,20 +247,19 @@ public function setGroundDocumentExpressProductType() /** * Ground Parcel Express. * Ground Delivery consignments containing non-printed matter or non-document material. - * @return $this + * @return ShipmentDetails */ - public function setGroundParcelExpressProductType() + public function setGroundParcelExpressProductType(): ShipmentDetails { return $this->setProductType('GPX'); } - /** * Product Type involves the specification of certain features concerning the delivery of the product * @param string $productType - * @return $this + * @return ShipmentDetails */ - public function setProductType(string $productType) + public function setProductType(string $productType): ShipmentDetails { $this->productType = $productType; return $this; @@ -275,9 +275,9 @@ public function getCustomsValueAmount() /** * @param Money $customsValueAmount - * @return $this + * @return ShipmentDetails */ - public function setCustomsValueAmount(Money $customsValueAmount) + public function setCustomsValueAmount(Money $customsValueAmount): ShipmentDetails { $this->customsValueAmount = $customsValueAmount; return $this; @@ -294,9 +294,9 @@ public function getCashOnDeliveryAmount() /** * Amount of Cash that is paid by the receiver of the package. Conditional - Based on the Services "COD" being filled. * @param Money $cashOnDeliveryAmount - * @return $this + * @return ShipmentDetails */ - public function setCashOnDeliveryAmount(Money $cashOnDeliveryAmount) + public function setCashOnDeliveryAmount(Money $cashOnDeliveryAmount): ShipmentDetails { $this->cashOnDeliveryAmount = $cashOnDeliveryAmount; return $this; @@ -313,9 +313,9 @@ public function getInsuranceAmount() /** * Insurance Amount charged on shipment. * @param Money $insuranceAmount - * @return $this + * @return ShipmentDetails */ - public function setInsuranceAmount(Money $insuranceAmount) + public function setInsuranceAmount(Money $insuranceAmount): ShipmentDetails { $this->insuranceAmount = $insuranceAmount; return $this; @@ -332,9 +332,9 @@ public function getCashAdditionalAmount() /** * Additional Cash that can be required for miscellaneous purposes. * @param Money $cashAdditionalAmount - * @return $this + * @return ShipmentDetails */ - public function setCashAdditionalAmount(Money $cashAdditionalAmount) + public function setCashAdditionalAmount(Money $cashAdditionalAmount): ShipmentDetails { $this->cashAdditionalAmount = $cashAdditionalAmount; return $this; @@ -351,9 +351,9 @@ public function getServices() /** * Additional Services used in shipping the package, Separate by comma when selecting multiple services. * @param string $services - * @return $this + * @return ShipmentDetails */ - public function setServices(string $services) + public function setServices(string $services): ShipmentDetails { $this->services = $services; return $this; @@ -362,9 +362,9 @@ public function setServices(string $services) /** * Cash on Delivery. * Receiver pays the cost of the goods - * @return $this + * @return ShipmentDetails */ - public function useCashOnDeliveryService() + public function useCashOnDeliveryService(): ShipmentDetails { return $this->setServices('COD'); } @@ -374,27 +374,27 @@ public function useCashOnDeliveryService() * Committed delivery time at destination country. * @return $this */ - public function useFirstAsService() + public function useFirstAsService(): ShipmentDetails { return $this->setServices('FIRST'); } - public function useFreeDomicileAsService() + public function useFreeDomicileAsService(): ShipmentDetails { return $this->setServices('FRDOM'); } - public function useHoldForPickupAsService() + public function useHoldForPickupAsService(): ShipmentDetails { return $this->setServices('HFPU'); } - public function useNoonDeliveryAsService() + public function useNoonDeliveryAsService(): ShipmentDetails { return $this->setServices('NOON'); } - public function useSignatureRequiredAsService() + public function useSignatureRequiredAsService(): ShipmentDetails { return $this->setServices('SIG'); } @@ -410,9 +410,9 @@ public function getItems() /** * Details of the Items within a shipment. Several items can be added for a single shipment. * @param $items - * @return $this + * @return ShipmentDetails */ - public function setItems($items) + public function setItems($items): ShipmentDetails { $this->items = $items; return $this; @@ -420,9 +420,9 @@ public function setItems($items) /** * @param ShipmentItem $item - * @return $this + * @return ShipmentDetails */ - public function addItem(ShipmentItem $item) + public function addItem(ShipmentItem $item): ShipmentDetails { $this->items[] = $item; return $this; @@ -439,9 +439,9 @@ public function getPaymentType() /** * Method of payment for shipment. * @param string $paymentType - * @return $this + * @return ShipmentDetails */ - public function setPaymentType(string $paymentType) + public function setPaymentType(string $paymentType): ShipmentDetails { $this->paymentType = $paymentType; return $this; @@ -450,9 +450,9 @@ public function setPaymentType(string $paymentType) /** * Prepaid. * Transportation Charges payable by shipper. - * @return $this + * @return ShipmentDetails */ - public function usePrepaidAsPaymentType() + public function usePrepaidAsPaymentType(): ShipmentDetails { return $this->setPaymentType('P'); } @@ -460,9 +460,9 @@ public function usePrepaidAsPaymentType() /** * Collect. * Transportation Charges payable by consignee. - * @return $this + * @return ShipmentDetails */ - public function useCollectAsPaymentType() + public function useCollectAsPaymentType(): ShipmentDetails { return $this->setPaymentType('C'); } @@ -470,9 +470,9 @@ public function useCollectAsPaymentType() /** * Third Party. * Transportation Charges payable by third party. Note: in case of 3rd Party all third party details must be filled including a valid Aramex Account Number for Billing Party. - * @return $this + * @return ShipmentDetails */ - public function useThirdPartyAsPaymentType() + public function useThirdPartyAsPaymentType(): ShipmentDetails { return $this->setPaymentType('T'); } diff --git a/src/API/Classes/ShipmentItem.php b/src/API/Classes/ShipmentItem.php index ba9bc02..e721f2e 100644 --- a/src/API/Classes/ShipmentItem.php +++ b/src/API/Classes/ShipmentItem.php @@ -31,9 +31,9 @@ public function getPackageType(): string /** * Type of packaging, for example. Cans, bottles, degradable Plastic. Conditional: If any of the Item element values are filled then the rest must be filled. * @param string $packageType - * @return $this + * @return ShipmentItem */ - public function setPackageType(string $packageType) + public function setPackageType(string $packageType): ShipmentItem { $this->packageType = $packageType; return $this; @@ -50,9 +50,9 @@ public function getQuantity(): int /** * Number of items * @param int $quantity - * @return $this + * @return ShipmentItem */ - public function setQuantity(int $quantity) + public function setQuantity(int $quantity): ShipmentItem { $this->quantity = $quantity; return $this; @@ -69,9 +69,9 @@ public function getWeight(): Weight /** * Total Weight of the Items * @param Weight $weight - * @return $this + * @return ShipmentItem */ - public function setWeight(Weight $weight) + public function setWeight(Weight $weight): ShipmentItem { $this->weight = $weight; return $this; @@ -88,9 +88,9 @@ public function getComments(): string /** * Additional Comments or Information about the items * @param string $comments - * @return $this + * @return ShipmentItem */ - public function setComments(string $comments) + public function setComments(string $comments): ShipmentItem { $this->comments = $comments; return $this; @@ -106,9 +106,9 @@ public function getReference(): string /** * @param string $reference - * @return $this + * @return ShipmentItem */ - public function setReference(string $reference) + public function setReference(string $reference): ShipmentItem { $this->reference = $reference; return $this; diff --git a/src/API/Classes/State.php b/src/API/Classes/State.php index 24a6a20..1202c68 100644 --- a/src/API/Classes/State.php +++ b/src/API/Classes/State.php @@ -26,6 +26,7 @@ public function getCode(): ?string /** * @param string|null $code + * @return State */ public function setCode(string $code): State { @@ -43,6 +44,7 @@ public function getName(): ?string /** * @param string|null $name + * @return State */ public function setName(string $name): State { diff --git a/src/API/Classes/Track.php b/src/API/Classes/Track.php index b4380d3..52f4285 100644 --- a/src/API/Classes/Track.php +++ b/src/API/Classes/Track.php @@ -27,9 +27,9 @@ public function getId() /** * @param string $id - * @return $this + * @return Track */ - public function setId(string $id) + public function setId(string $id): Track { $this->id = $id; return $this; @@ -45,9 +45,9 @@ public function getUpdateCode() /** * @param string $updateCode - * @return $this + * @return Track */ - public function setUpdateCode(string $updateCode) + public function setUpdateCode(string $updateCode): Track { $this->updateCode = $updateCode; return $this; @@ -63,9 +63,9 @@ public function getUpdateDescription() /** * @param string $updateDescription - * @return $this + * @return Track */ - public function setUpdateDescription(string $updateDescription) + public function setUpdateDescription(string $updateDescription): Track { $this->updateDescription = $updateDescription; return $this; @@ -81,9 +81,9 @@ public function getUpdateDateTime() /** * @param string $updateDateTime - * @return $this + * @return Track */ - public function setUpdateDateTime(string $updateDateTime) + public function setUpdateDateTime(string $updateDateTime): Track { $this->updateDateTime = $updateDateTime; return $this; @@ -99,9 +99,9 @@ public function getUpdateLocation() /** * @param string $updateLocation - * @return $this + * @return Track */ - public function setUpdateLocation(string $updateLocation) + public function setUpdateLocation(string $updateLocation): Track { $this->updateLocation = $updateLocation; return $this; @@ -117,9 +117,9 @@ public function getComments() /** * @param string $comments - * @return $this + * @return Track */ - public function setComments(string $comments) + public function setComments(string $comments): Track { $this->comments = $comments; return $this; @@ -135,9 +135,9 @@ public function getProblemCode() /** * @param string $problemCode - * @return $this + * @return Track */ - public function setProblemCode(string $problemCode) + public function setProblemCode(string $problemCode): Track { $this->problemCode = $problemCode; return $this; @@ -153,9 +153,9 @@ public function getGrossWeight() /** * @param string $grossWeight - * @return $this + * @return Track */ - public function setGrossWeight(string $grossWeight) + public function setGrossWeight(string $grossWeight): Track { $this->grossWeight = $grossWeight; return $this; @@ -171,9 +171,9 @@ public function getChargeableWeight() /** * @param string $chargeableWeight - * @return $this + * @return Track */ - public function setChargeableWeight(string $chargeableWeight) + public function setChargeableWeight(string $chargeableWeight): Track { $this->chargeableWeight = $chargeableWeight; return $this; @@ -189,9 +189,9 @@ public function getWeightUnit() /** * @param string $weightUnit - * @return $this + * @return Track */ - public function setWeightUnit(string $weightUnit) + public function setWeightUnit(string $weightUnit): Track { $this->weightUnit = $weightUnit; return $this; diff --git a/src/API/Classes/TrackingResult.php b/src/API/Classes/TrackingResult.php index 54b1456..e66f960 100644 --- a/src/API/Classes/TrackingResult.php +++ b/src/API/Classes/TrackingResult.php @@ -32,7 +32,7 @@ public function getWaybillNumber(): string } /** - * @param string $id + * @param string $waybillNumber * @return TrackingResult */ public function setWaybillNumber(string $waybillNumber): TrackingResult diff --git a/src/API/Classes/Volume.php b/src/API/Classes/Volume.php index 31495c1..228608d 100644 --- a/src/API/Classes/Volume.php +++ b/src/API/Classes/Volume.php @@ -29,9 +29,9 @@ public function getUnit() * Options: Cm3, Inch3 * * @param string $unit - * @return $this + * @return Volume */ - public function setUnit(string $unit) + public function setUnit(string $unit): Volume { $this->unit = $unit; return $this; @@ -49,9 +49,9 @@ public function getValue(): float * Shipment Volume * * @param float $value - * @return $this + * @return Volume */ - public function setValue(float $value) + public function setValue(float $value): Volume { $this->value = $value; return $this; @@ -61,7 +61,7 @@ public function setValue(float $value) * Centimeters * @return Volume */ - public function useCentimetersAsUnit() + public function useCentimetersAsUnit(): Volume { return $this->setUnit('Cm3'); } @@ -70,7 +70,7 @@ public function useCentimetersAsUnit() * Inches * @return Volume */ - public function useInchesAsUnit() + public function useInchesAsUnit(): Volume { return $this->setUnit('Inch3'); } diff --git a/src/API/Classes/Weight.php b/src/API/Classes/Weight.php index ee2de65..71f4eaa 100644 --- a/src/API/Classes/Weight.php +++ b/src/API/Classes/Weight.php @@ -27,9 +27,9 @@ public function getUnit() /** * Unit of the weight * @param string $unit - * @return $this + * @return Weight */ - public function setUnit(string $unit) + public function setUnit(string $unit): Weight { $this->unit = $unit; return $this; @@ -46,10 +46,11 @@ public function getValue() /** * Shipment weight. * If the Data Entity ‘Dimensions’ are filled, charging weight is compared to actual and the highest value is filled here. + * * @param float $value - * @return $this + * @return Weight */ - public function setValue(float $value) + public function setValue(float $value): Weight { $this->value = $value; return $this; @@ -59,7 +60,7 @@ public function setValue(float $value) * Kilogram * @return Weight */ - public function useKilogramAsUnit() + public function useKilogramAsUnit(): Weight { return $this->setUnit('KG'); } @@ -68,7 +69,7 @@ public function useKilogramAsUnit() * Pound * @return Weight */ - public function usePoundAsUnit() + public function usePoundAsUnit(): Weight { return $this->setUnit('LB'); } diff --git a/src/API/Requests/API.php b/src/API/Requests/API.php index 2937d3e..8bcb11c 100644 --- a/src/API/Requests/API.php +++ b/src/API/Requests/API.php @@ -20,16 +20,14 @@ abstract class API implements Normalize protected $live_wsdl; protected $environment; - public function __construct($environment = null) + public function __construct() { - if ($environment) { - $this->setEnvironment($environment); + if ($this->environment) { + $this->setEnvironment($this->environment); } else { config('aramex.mode') === 'live' ? $this->useLiveAsEnvironment() : $this->useTestAsEnvironment(); } - dd($this->environment); - $this->fillClientInfoFromEnv(); $this->soapClient = new \SoapClient($this->getWsdlAccordingToEnvironment(), array('trace' => 1)); diff --git a/src/API/Requests/Location/FetchCities.php b/src/API/Requests/Location/FetchCities.php index c199fa0..ecea12a 100644 --- a/src/API/Requests/Location/FetchCities.php +++ b/src/API/Requests/Location/FetchCities.php @@ -27,7 +27,7 @@ class FetchCities extends API implements Normalize * @return CitiesFetchingResponse * @throws \Exception */ - public function make() + public function run() { $this->validate(); diff --git a/src/API/Requests/Location/FetchCountries.php b/src/API/Requests/Location/FetchCountries.php index fb91337..c44889c 100644 --- a/src/API/Requests/Location/FetchCountries.php +++ b/src/API/Requests/Location/FetchCountries.php @@ -6,6 +6,12 @@ use ExtremeSa\Aramex\API\Requests\API; use ExtremeSa\Aramex\API\Response\Location\CountriesFetchingResponse; +/** + * This method allows users to get the world countries list. + * + * Class FetchCountries + * @package ExtremeSa\Aramex\API\Requests\Location + */ class FetchCountries extends API implements Normalize { protected $live_wsdl = 'https://ws.aramex.net/shippingapi.v2/location/service_1_0.svc?wsdl'; @@ -15,7 +21,7 @@ class FetchCountries extends API implements Normalize * @return CountriesFetchingResponse * @throws \Exception */ - public function make() + public function run() { $this->validate(); diff --git a/src/API/Requests/Location/FetchCountry.php b/src/API/Requests/Location/FetchCountry.php index da0489e..e836643 100644 --- a/src/API/Requests/Location/FetchCountry.php +++ b/src/API/Requests/Location/FetchCountry.php @@ -7,6 +7,12 @@ use ExtremeSa\Aramex\API\Requests\API; use ExtremeSa\Aramex\API\Response\Location\CountryFetchingResponse; +/** + * This method allows users to get details of a certain country. + * + * Class FetchCountry + * @package ExtremeSa\Aramex\API\Requests\Location + */ class FetchCountry extends API implements Normalize { protected $live_wsdl = 'https://ws.aramex.net/shippingapi.v2/location/service_1_0.svc?wsdl'; @@ -18,7 +24,7 @@ class FetchCountry extends API implements Normalize * @return CountryFetchingResponse * @throws Exception */ - public function make() + public function run() { $this->validate(); diff --git a/src/API/Requests/Location/FetchOffices.php b/src/API/Requests/Location/FetchOffices.php index 9d33119..1c7c963 100644 --- a/src/API/Requests/Location/FetchOffices.php +++ b/src/API/Requests/Location/FetchOffices.php @@ -25,7 +25,7 @@ class FetchOffices extends API implements Normalize * @return OfficesFetchingResponse * @throws Exception */ - public function make() + public function run() { $this->validate(); diff --git a/src/API/Requests/Location/FetchStates.php b/src/API/Requests/Location/FetchStates.php index b6c5ae5..2319a5a 100644 --- a/src/API/Requests/Location/FetchStates.php +++ b/src/API/Requests/Location/FetchStates.php @@ -18,7 +18,7 @@ class FetchStates extends API implements Normalize * @return StatesFetchingResponse * @throws Exception */ - public function make() + public function run() { $this->validate(); diff --git a/src/API/Requests/Location/ValidateAddress.php b/src/API/Requests/Location/ValidateAddress.php index 2033fca..85c90dd 100644 --- a/src/API/Requests/Location/ValidateAddress.php +++ b/src/API/Requests/Location/ValidateAddress.php @@ -25,7 +25,7 @@ class ValidateAddress extends API implements Normalize * @return AddressValidationResponse * @throws \Exception */ - public function make() + public function run() { $this->validate(); diff --git a/src/API/Requests/Rate/CalculateRate.php b/src/API/Requests/Rate/CalculateRate.php index 1ff2058..7356133 100644 --- a/src/API/Requests/Rate/CalculateRate.php +++ b/src/API/Requests/Rate/CalculateRate.php @@ -22,14 +22,16 @@ class CalculateRate extends API implements Normalize public function __construct() { - parent::__construct('live'); + $this->useLiveAsEnvironment(); + + parent::__construct(); } /** * @return RateCalculatorResponse * @throws Exception */ - public function make() + public function run() { $this->validate(); diff --git a/src/API/Requests/Shipping/CancelPickup.php b/src/API/Requests/Shipping/CancelPickup.php index e0bdb84..3219421 100644 --- a/src/API/Requests/Shipping/CancelPickup.php +++ b/src/API/Requests/Shipping/CancelPickup.php @@ -25,7 +25,7 @@ class CancelPickup extends API implements Normalize * @return PickupCancellationResponse * @throws Exception */ - public function make(): PickupCancellationResponse + public function run(): PickupCancellationResponse { $this->validate(); diff --git a/src/API/Requests/Shipping/CreatePickup.php b/src/API/Requests/Shipping/CreatePickup.php index ff889a9..1344d05 100644 --- a/src/API/Requests/Shipping/CreatePickup.php +++ b/src/API/Requests/Shipping/CreatePickup.php @@ -28,7 +28,7 @@ class CreatePickup extends API implements Normalize * @return PickupCreationResponse * @throws Exception */ - public function make(): PickupCreationResponse + public function run(): PickupCreationResponse { $this->validate(); diff --git a/src/API/Requests/Shipping/CreateShipments.php b/src/API/Requests/Shipping/CreateShipments.php index 2e5dabe..f2efd4e 100644 --- a/src/API/Requests/Shipping/CreateShipments.php +++ b/src/API/Requests/Shipping/CreateShipments.php @@ -28,7 +28,7 @@ class CreateShipments extends API implements Normalize * @return ShipmentCreationResponse * @throws Exception */ - public function make(): ShipmentCreationResponse + public function run(): ShipmentCreationResponse { $this->validate(); diff --git a/src/API/Requests/Shipping/GetLastShipmentsNumbersRange.php b/src/API/Requests/Shipping/GetLastShipmentsNumbersRange.php index 4292a5e..452e3da 100644 --- a/src/API/Requests/Shipping/GetLastShipmentsNumbersRange.php +++ b/src/API/Requests/Shipping/GetLastShipmentsNumbersRange.php @@ -25,7 +25,7 @@ class GetLastShipmentsNumbersRange extends API implements Normalize * @return LastReservedShipmentNumberRangeResponse * @throws Exception */ - public function make(): LastReservedShipmentNumberRangeResponse + public function run(): LastReservedShipmentNumberRangeResponse { $this->validate(); diff --git a/src/API/Requests/Shipping/PrintLabel.php b/src/API/Requests/Shipping/PrintLabel.php index f939d91..b9ebebc 100644 --- a/src/API/Requests/Shipping/PrintLabel.php +++ b/src/API/Requests/Shipping/PrintLabel.php @@ -31,7 +31,7 @@ class PrintLabel extends API implements Normalize * @return LabelPrintingResponse * @throws Exception */ - public function make(): LabelPrintingResponse + public function run(): LabelPrintingResponse { $this->validate(); diff --git a/src/API/Requests/Shipping/ReserveShipmentNumberRange.php b/src/API/Requests/Shipping/ReserveShipmentNumberRange.php index 781874d..e2f61e0 100644 --- a/src/API/Requests/Shipping/ReserveShipmentNumberRange.php +++ b/src/API/Requests/Shipping/ReserveShipmentNumberRange.php @@ -26,7 +26,7 @@ class ReserveShipmentNumberRange extends API implements Normalize * @return ReserveRangeResponse * @throws Exception */ - public function make(): ReserveRangeResponse + public function run(): ReserveRangeResponse { $this->validate(); diff --git a/src/API/Requests/Shipping/ScheduleDelivery.php b/src/API/Requests/Shipping/ScheduleDelivery.php index ffc0552..1da1238 100644 --- a/src/API/Requests/Shipping/ScheduleDelivery.php +++ b/src/API/Requests/Shipping/ScheduleDelivery.php @@ -36,7 +36,7 @@ class ScheduleDelivery extends API implements Normalize * @return ScheduledDeliveryResponse * @throws Exception */ - public function make(): ScheduledDeliveryResponse + public function run(): ScheduledDeliveryResponse { $this->validate(); diff --git a/src/API/Requests/Tracking/TrackPickup.php b/src/API/Requests/Tracking/TrackPickup.php index 7c57951..fcf6838 100644 --- a/src/API/Requests/Tracking/TrackPickup.php +++ b/src/API/Requests/Tracking/TrackPickup.php @@ -6,8 +6,13 @@ use ExtremeSa\Aramex\API\Interfaces\Normalize; use ExtremeSa\Aramex\API\Requests\API; use ExtremeSa\Aramex\API\Response\Tracking\PickupTrackingResponse; -use ExtremeSa\Aramex\API\Response\Tracking\RateResponse; +/** + * This method allows the user to track an existing pickup’s updates and latest status. + * + * Class TrackPickup + * @package ExtremeSa\Aramex\API\Requests\Tracking + */ class TrackPickup extends API implements Normalize { protected $live_wsdl = 'https://ws.aramex.net/ShippingAPI.V2/tracking/Service_1_0.svc?wsdl'; @@ -21,7 +26,7 @@ class TrackPickup extends API implements Normalize * @return PickupTrackingResponse * @throws Exception */ - public function make() + public function run() { $this->validate(); diff --git a/src/API/Requests/Tracking/TrackShipments.php b/src/API/Requests/Tracking/TrackShipments.php index 01b9c0c..a62924b 100644 --- a/src/API/Requests/Tracking/TrackShipments.php +++ b/src/API/Requests/Tracking/TrackShipments.php @@ -5,7 +5,6 @@ use Exception; use ExtremeSa\Aramex\API\Interfaces\Normalize; use ExtremeSa\Aramex\API\Requests\API; -use ExtremeSa\Aramex\API\Response\Tracking\RateResponse; use ExtremeSa\Aramex\API\Response\Tracking\ShipmentTrackingResponse; /** @@ -26,7 +25,7 @@ class TrackShipments extends API implements Normalize * @return ShipmentTrackingResponse * @throws Exception */ - public function make() + public function run() { $this->validate(); diff --git a/src/Aramex.php b/src/Aramex.php index 06bd18c..fff360a 100644 --- a/src/Aramex.php +++ b/src/Aramex.php @@ -23,90 +23,90 @@ class Aramex { // Location - public static function FetchCities() + public static function fetchCities() { return new FetchCities(); } - public static function FetchCountries() + public static function fetchCountries() { return new FetchCountries(); } - public static function FetchCountry() + public static function fetchCountry() { return new FetchCountry(); } - public static function FetchDropOffLocations() + public static function fetchDropOffLocations() { return new FetchDropOffLocations(); } - public static function FetchOffices() + public static function fetchOffices() { return new FetchOffices(); } - public static function FetchStates() + public static function fetchStates() { return new FetchStates(); } - public static function ValidateAddress() + public static function validateAddress() { return new ValidateAddress(); } // Rate - public static function CalculateRate() + public static function calculateRate() { return new CalculateRate(); } // Shipping - public static function CancelPickup() + public static function cancelPickup() { return new CancelPickup(); } - public static function CreatePickup() + public static function createPickup() { return new CreatePickup(); } - public static function CreateShipments() + public static function createShipments() { return new CreateShipments(); } - public static function GetLastShipmentsNumbersRange() + public static function getLastShipmentsNumbersRange() { return new GetLastShipmentsNumbersRange(); } - public static function PrintLabel() + public static function printLabel() { return new PrintLabel(); } - public static function ReserveShipmentNumberRange() + public static function reserveShipmentNumberRange() { return new ReserveShipmentNumberRange(); } - public static function ScheduleDelivery() + public static function scheduleDelivery() { return new ScheduleDelivery(); } // Tracking - public static function TrackPickup() + public static function trackPickup() { return new TrackPickup(); } - public static function TrackShipments() + public static function trackShipments() { return new TrackShipments(); } diff --git a/src/AramexFacade.php b/src/AramexFacade.php new file mode 100644 index 0000000..59217fb --- /dev/null +++ b/src/AramexFacade.php @@ -0,0 +1,57 @@ +