<?php require_once 'credentials.php'; require_once 'bootstrap.php'; use FedEx\ShipService, FedEx\ShipService\ComplexType, FedEx\ShipService\SimpleType; $userCredential = new ComplexType\WebAuthenticationCredential(); $userCredential->setKey(FEDEX_KEY)->setPassword(FEDEX_PASSWORD); $webAuthenticationDetail = new ComplexType\WebAuthenticationDetail(); $webAuthenticationDetail->setUserCredential($userCredential); $clientDetail = new ComplexType\ClientDetail(); $clientDetail->setAccountNumber(FEDEX_ACCOUNT_NUMBER)->setMeterNumber(FEDEX_METER_NUMBER); $version = new ComplexType\VersionId(); $version->setServiceId('ship')->setMajor(12)->setIntermediate(1)->setMinor(0); $trackingId = new ComplexType\TrackingId(); $trackingId->setTrackingNumber('12345')->setTrackingIdType(SimpleType\TrackingIdType::_FEDEX); $deleteShipmentRequest = new ComplexType\DeleteShipmentRequest(); $deleteShipmentRequest->setWebAuthenticationDetail($webAuthenticationDetail); $deleteShipmentRequest->setClientDetail($clientDetail); $deleteShipmentRequest->setVersion($version); $deleteShipmentRequest->setTrackingId($trackingId); $deleteShipmentRequest->setDeletionControl(SimpleType\DeletionControlType::_DELETE_ALL_PACKAGES); $validateShipmentRequest = new ShipService\Request(); $validateShipmentRequest->getSoapClient()->__setLocation('https://ws.fedex.com:443/web-services/ship'); $response = $validateShipmentRequest->getDeleteShipmentReply($deleteShipmentRequest); var_dump($response);
/** * This test will send the same test data as in FedEx's documentation: * /php/RateAvailableServices/RateAvailableServices.php5 */ //remember to update credentials.php or replace 'FEDEX_KEY', 'FEDEX_PASSWORD', 'FEDEX_ACCOUNT_NUMBER', and 'FEDEX_METER_NUMBER' require_once 'credentials.php'; require_once 'bootstrap.php'; use FedEx\ShipService, FedEx\ShipService\ComplexType, FedEx\ShipService\SimpleType; $userCredential = new ComplexType\WebAuthenticationCredential(); $userCredential->setKey(FEDEX_KEY)->setPassword(FEDEX_PASSWORD); $webAuthenticationDetail = new ComplexType\WebAuthenticationDetail(); $webAuthenticationDetail->setUserCredential($userCredential); $clientDetail = new ComplexType\ClientDetail(); $clientDetail->setAccountNumber(FEDEX_ACCOUNT_NUMBER)->setMeterNumber(FEDEX_METER_NUMBER); $version = new ComplexType\VersionId(); $version->setMajor(10)->setIntermediate(0)->setMinor(0)->setServiceId('ship'); $shipperAddress = new ComplexType\Address(); $shipperAddress->setStreetLines(array('12345 Main Street', 'STE 810'))->setCity('Anytown')->setStateOrProvinceCode('NY')->setPostalCode('12345')->setCountryCode('US'); $shipperContact = new ComplexType\Contact(); $shipperContact->setCompanyName('Company Name')->setEMailAddress('*****@*****.**')->setPersonName('Person Name')->setPhoneNumber('123-123-1234'); $shipper = new ComplexType\Party(); $shipper->setAccountNumber(FEDEX_ACCOUNT_NUMBER)->setAddress($shipperAddress)->setContact($shipperContact); $recipientAddress = new ComplexType\Address(); $recipientAddress->setStreetLines(array('54312 1st Ave'))->setCity('Anytown')->setStateOrProvinceCode('NY')->setPostalCode('12345')->setCountryCode('US'); $recipientContact = new ComplexType\Contact(); $recipientContact->setPersonName('Contact Name'); $recipient = new ComplexType\Party(); $recipient->setAddress($recipientAddress)->setContact($recipientContact); $labelSpecification = new ComplexType\LabelSpecification(); $labelSpecification->setLabelStockType(new SimpleType\LabelStockType(SimpleType\LabelStockType::_PAPER_7X4point75))->setImageType(new SimpleType\ShippingDocumentImageType(SimpleType\ShippingDocumentImageType::_PDF))->setLabelFormatType(new SimpleType\LabelFormatType(SimpleType\LabelFormatType::_COMMON2D));