Skip to content

Commit

Permalink
Merge pull request #89 from JeremyDunn/update-services
Browse files Browse the repository at this point in the history
Update services
  • Loading branch information
JeremyDunn authored Dec 27, 2018
2 parents 04f1e87 + 6831160 commit 6b74650
Show file tree
Hide file tree
Showing 911 changed files with 36,116 additions and 17,776 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,36 @@
# CHANGELOG

## 3.0 (released 2018-12-27)
- Updated Upload Document Service
- Updated Pickup Service
- Updated Ship Service
- Updated Address Validation Service
- Updated Rate Service
- Updated Track Service
- Updated Locations Service
- Added Country Service
- Added/updated usage examples

|Service|Version|
|---|---|
|Address Validation|4|
|Close|5|
|Courier Dispatch|3|
|Locations|9|
|Package Movement Information|5|
|Pickup|17|
|Rate|24|
|Return Tag|1|
|Ship|23|
|Track|16|
|Upload Document|11|
|Open Ship|15|
|Validation Availability and Commitment Service|8|
|ASYNC Transaction Service|4|
|In Flight Shipment Service|1|
|DGLD Service|1|
|DGDS Service|3|

## 2.6 (released 2017-11-02)
- Added Dangerous Goods Data Service

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Each web service has it's own class namespace. See the official FedEx web servic
* [Address Validation Service](src/FedEx/AddressValidationService)
* [Close Service](src/FedEx/CloseService)
* [Courier Dispatch Service](src/FedEx/CourierDispatchService)
* [Locator Service](src/FedEx/LocatorService)
* [Locations Service](src/FedEx/LocationsService)
* [Package Movement Information Service](src/FedEx/PackageMovementInformationService)
* [Pickup Service](src/FedEx/PickupService)
* [Rate Service](src/FedEx/RateService)
Expand Down
Binary file added examples/CommercialInvoice.xls
Binary file not shown.
80 changes: 23 additions & 57 deletions examples/address-validation.php
Original file line number Diff line number Diff line change
@@ -1,71 +1,37 @@
<?php
/**
* This test will send the same test data as in FedEx's documentation:
* /php/RateAvailableServices/RateAvailableServices.php5
*/

//remember to copy example.credentials.php as credentials.php replace 'FEDEX_KEY', 'FEDEX_PASSWORD', 'FEDEX_ACCOUNT_NUMBER', and 'FEDEX_METER_NUMBER'
require_once 'credentials.php';
require_once 'bootstrap.php';

use FedEx\AddressValidationService;
use FedEx\AddressValidationService\Request;
use FedEx\AddressValidationService\ComplexType;
use FedEx\AddressValidationService\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(2)
->setIntermediate(0)
->setMinor(0)
->setServiceId('aval');

$options = new ComplexType\AddressValidationOptions();
$options
->setCheckResidentialStatus(true)
->setVerifyAddresses(true)
->setConvertToUpperCase(true)
->setDirectionalAccuracy(SimpleType\AddressValidationAccuracyType::_MEDIUM);

$addresses = array();

$address1 = new ComplexType\Address();
$address1
->setStreetLines(array('12345 Main Street'))
->setCity('Anytown')
->setStateOrProvinceCode('NY')
->setPostalCode('47711')
->setCountryCode('US');
$addressValidationRequest = new ComplexType\AddressValidationRequest();

$addressToValidate1 = new ComplexType\AddressToValidate();
$addressToValidate1
->setAddress($address1)
->setAddressId(1);
// User Credentials
$addressValidationRequest->WebAuthenticationDetail->UserCredential->Key = FEDEX_KEY;
$addressValidationRequest->WebAuthenticationDetail->UserCredential->Password = FEDEX_PASSWORD;

$addresses[] = $addressToValidate1;
// Client Detail
$addressValidationRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
$addressValidationRequest->ClientDetail->MeterNumber = FEDEX_METER_NUMBER;

$addressValidationRequest = new ComplexType\AddressValidationRequest();
$addressValidationRequest->setWebAuthenticationDetail($webAuthenticationDetail);
$addressValidationRequest->setClientDetail($clientDetail);
$addressValidationRequest->setVersion($version);
$addressValidationRequest->setRequestTimestamp(date('c'));
$addressValidationRequest->setOptions($options);
$addressValidationRequest->setAddressesToValidate($addresses);
// Version
$addressValidationRequest->Version->ServiceId = 'aval';
$addressValidationRequest->Version->Major = 4;
$addressValidationRequest->Version->Intermediate = 0;
$addressValidationRequest->Version->Minor = 0;

// Address(es) to validate.
$addressValidationRequest->AddressesToValidate = [new ComplexType\AddressToValidate()]; // just validating 1 address in this example.
$addressValidationRequest->AddressesToValidate[0]->Address->StreetLines = ['12345 Main Street'];
$addressValidationRequest->AddressesToValidate[0]->Address->City = 'Anytown';
$addressValidationRequest->AddressesToValidate[0]->Address->StateOrProvinceCode = 'NY';
$addressValidationRequest->AddressesToValidate[0]->Address->PostalCode = 47711;
$addressValidationRequest->AddressesToValidate[0]->Address->CountryCode = 'US';

$validateShipmentRequest = new AddressValidationService\Request();
$result = $validateShipmentRequest->getAddressValidationReply($addressValidationRequest);
$request = new Request();
$addressValidationReply = $request->getAddressValidationReply($addressValidationRequest);

var_dump($result);
var_dump($addressValidationReply);
35 changes: 35 additions & 0 deletions examples/async-retrieve-job-results.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
//remember to copy example.credentials.php as credentials.php replace 'FEDEX_KEY', 'FEDEX_PASSWORD', 'FEDEX_ACCOUNT_NUMBER', and 'FEDEX_METER_NUMBER'
require_once 'credentials.php';
require_once 'bootstrap.php';

use FedEx\AsyncService\Request;
use FedEx\AsyncService\ComplexType;
use FedEx\AsyncService\SimpleType;

$retrieveJobResultsRequest = new ComplexType\RetrieveJobResultsRequest();

// Authentication & client details.
$retrieveJobResultsRequest->WebAuthenticationDetail->UserCredential->Key = FEDEX_KEY;
$retrieveJobResultsRequest->WebAuthenticationDetail->UserCredential->Password = FEDEX_PASSWORD;
$retrieveJobResultsRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
$retrieveJobResultsRequest->ClientDetail->MeterNumber = FEDEX_METER_NUMBER;

$retrieveJobResultsRequest->TransactionDetail->CustomerTransactionId = 'testing async service';

// Version.
$retrieveJobResultsRequest->Version->ServiceId = 'async';
$retrieveJobResultsRequest->Version->Major = 4;
$retrieveJobResultsRequest->Version->Intermediate = 0;
$retrieveJobResultsRequest->Version->Minor = 0;

$retrieveJobResultsRequest->JobId = 'your job id';


$request = new Request();
try {
$retrieveJobResultsReply = $request->getRetrieveJobResultsReply($retrieveJobResultsRequest);
} catch (\Exception $e) {
echo $request->getSoapClient()->__getLastResponse();
}

50 changes: 50 additions & 0 deletions examples/close-service.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php
//remember to copy example.credentials.php as credentials.php replace 'FEDEX_KEY', 'FEDEX_PASSWORD', 'FEDEX_ACCOUNT_NUMBER', and 'FEDEX_METER_NUMBER'
require_once 'credentials.php';
require_once 'bootstrap.php';

use FedEx\CloseService\Request;
use FedEx\CloseService\ComplexType;
use FedEx\CloseService\SimpleType;

$closeWithDocumentsRequest = new ComplexType\CloseWithDocumentsRequest();

// Authentication & client details.
$closeWithDocumentsRequest->WebAuthenticationDetail->UserCredential->Key = FEDEX_KEY;
$closeWithDocumentsRequest->WebAuthenticationDetail->UserCredential->Password = FEDEX_PASSWORD;
$closeWithDocumentsRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
$closeWithDocumentsRequest->ClientDetail->MeterNumber = FEDEX_METER_NUMBER;

$closeWithDocumentsRequest->TransactionDetail->CustomerTransactionId = 'ground close with documents test';

// Version.
$closeWithDocumentsRequest->Version->ServiceId = 'clos';
$closeWithDocumentsRequest->Version->Major = 5;
$closeWithDocumentsRequest->Version->Intermediate = 0;
$closeWithDocumentsRequest->Version->Minor = 0;

// Action type.
$closeWithDocumentsRequest->ActionType = SimpleType\CloseActionType::_CLOSE;

// Processing options.
$closeWithDocumentsRequest->ProcessingOptions->Options = [SimpleType\CloseWithDocumentsProcessingOptionType::_ERROR_IF_OPEN_SHIPMENTS_FOUND];

// Carrier code.
$closeWithDocumentsRequest->CarrierCode = SimpleType\CarrierCodeType::_FDXE;

// Reprint close date.
$closeWithDocumentsRequest->ReprintCloseDate = date('c');

// Manifest reference detail.
$closeWithDocumentsRequest->CloseDocumentSpecification->CloseDocumentTypes = [SimpleType\CloseDocumentType::_MANIFEST];


$closeSerivceRequest = new Request();
$closeWithDocumentsReply = $closeSerivceRequest->getCloseWithDocumentsReply($closeWithDocumentsRequest);

var_dump($closeWithDocumentsReply);





44 changes: 44 additions & 0 deletions examples/country-service.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
//remember to copy example.credentials.php as credentials.php replace 'FEDEX_KEY', 'FEDEX_PASSWORD', 'FEDEX_ACCOUNT_NUMBER', and 'FEDEX_METER_NUMBER'
require_once 'credentials.php';
require_once 'bootstrap.php';

use FedEx\CountryService\Request;
use FedEx\CountryService\ComplexType;
use FedEx\CountryService\SimpleType;

$validatePostalRequest = new ComplexType\ValidatePostalRequest();

// Authentication and client details.
$validatePostalRequest->WebAuthenticationDetail->UserCredential->Key = FEDEX_KEY;
$validatePostalRequest->WebAuthenticationDetail->UserCredential->Password = FEDEX_PASSWORD;
$validatePostalRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
$validatePostalRequest->ClientDetail->MeterNumber = FEDEX_METER_NUMBER;

// Version.
$validatePostalRequest->Version->ServiceId = 'cnty';
$validatePostalRequest->Version->Major = 8;
$validatePostalRequest->Version->Intermediate = 0;
$validatePostalRequest->Version->Minor = 0;

// Address.
$validatePostalRequest->Address->PostalCode = 96813;
$validatePostalRequest->Address->CountryCode = 'US';

$validatePostalRequest->CarrierCode = SimpleType\CarrierCodeType::_FDXE;

// Get Validate Postal reply.
$countryServiceRequest = new Request();
$validatePostalReply = $countryServiceRequest->getValidatePostalReply($validatePostalRequest);

echo '<h1>Postal Detail</h1>';
echo "<h2>Country Code: {$validatePostalReply->PostalDetail->CountryCode}</h2>";
echo "<h2>State or Province Code: {$validatePostalReply->PostalDetail->StateOrProvinceCode}</h2>";
echo "<h2>City First Initials: {$validatePostalReply->PostalDetail->CityFirstInitials}</h2>";
echo "<h2>Cleaned Postal Code: {$validatePostalReply->PostalDetail->CleanedPostalCode}</h2>";
echo '<h2> Location Descriptions: </h2>';
if (!empty($validatePostalReply->PostalDetail->LocationDescriptions)) {
foreach ($validatePostalReply->PostalDetail->LocationDescriptions as $locationDescription) {
var_dump($locationDescription->toArray());
}
}
2 changes: 1 addition & 1 deletion examples/create-open-shipment.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$createOpenShipmentRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
// version
$createOpenShipmentRequest->Version->ServiceId = 'ship';
$createOpenShipmentRequest->Version->Major = 11;
$createOpenShipmentRequest->Version->Major = 15;
$createOpenShipmentRequest->Version->Intermediate = 0;
$createOpenShipmentRequest->Version->Minor = 0;

Expand Down
75 changes: 75 additions & 0 deletions examples/create-pickup.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php
//remember to copy example.credentials.php as credentials.php replace 'FEDEX_KEY', 'FEDEX_PASSWORD', 'FEDEX_ACCOUNT_NUMBER', and 'FEDEX_METER_NUMBER'
require_once 'credentials.php';
require_once 'bootstrap.php';

use FedEx\PickupService\Request;
use FedEx\PickupService\ComplexType;
use FedEx\PickupService\SimpleType;

$createPickupRequest = new ComplexType\CreatePickupRequest();

// Authentication & client details.
$createPickupRequest->WebAuthenticationDetail->UserCredential->Key = FEDEX_KEY;
$createPickupRequest->WebAuthenticationDetail->UserCredential->Password = FEDEX_PASSWORD;
$createPickupRequest->ClientDetail->AccountNumber = FEDEX_ACCOUNT_NUMBER;
$createPickupRequest->ClientDetail->MeterNumber = FEDEX_METER_NUMBER;

// Version.
$createPickupRequest->Version->ServiceId = 'disp';
$createPickupRequest->Version->Major = 17;
$createPickupRequest->Version->Intermediate = 0;
$createPickupRequest->Version->Minor = 0;

$createPickupRequest->TransactionDetail->CustomerTransactionId = 'create pickup request example';
$createPickupRequest->TransactionDetail->Localization->LanguageCode = 'EN';
$createPickupRequest->TransactionDetail->Localization->LocaleCode = 'ES';

// Associated account number.
$createPickupRequest->AssociatedAccountNumber->Type = SimpleType\AssociatedAccountNumberType::_FEDEX_EXPRESS;
$createPickupRequest->AssociatedAccountNumber->AccountNumber = FEDEX_ACCOUNT_NUMBER;

// Origin detail contact.
$createPickupRequest->OriginDetail->PickupLocation->Contact->ContactId = 'KR1059';
$createPickupRequest->OriginDetail->PickupLocation->Contact->PersonName = 'INPUT YOUR INFORMATION';
$createPickupRequest->OriginDetail->PickupLocation->Contact->Title = 'Mr.';
$createPickupRequest->OriginDetail->PickupLocation->Contact->CompanyName = 'DEOYAROHIT0905$';
$createPickupRequest->OriginDetail->PickupLocation->Contact->PhoneNumber = 'INPUT YOUR INFORMATION';
$createPickupRequest->OriginDetail->PickupLocation->Contact->PhoneExtension = 'INPUT YOUR INFORMATION';
$createPickupRequest->OriginDetail->PickupLocation->Contact->PagerNumber = '9962308621';
$createPickupRequest->OriginDetail->PickupLocation->Contact->FaxNumber = '9962308621';
$createPickupRequest->OriginDetail->PickupLocation->Contact->EMailAddress = '[email protected]';

// Origin detail address.
$createPickupRequest->OriginDetail->PickupLocation->Address->StreetLines = ['INPUT YOUR INFORMATION'];
$createPickupRequest->OriginDetail->PickupLocation->Address->City = 'Memphis';
$createPickupRequest->OriginDetail->PickupLocation->Address->StateOrProvinceCode = 'TN';
$createPickupRequest->OriginDetail->PickupLocation->Address->PostalCode = '38125';
$createPickupRequest->OriginDetail->PickupLocation->Address->CountryCode = 'US';

$createPickupRequest->OriginDetail->PackageLocation = SimpleType\PickupBuildingLocationType::_FRONT;
$createPickupRequest->OriginDetail->BuildingPart = SimpleType\BuildingPartCode::_DEPARTMENT;
$createPickupRequest->OriginDetail->BuildingPartDescription = 'Building part description';
$createPickupRequest->OriginDetail->ReadyTimestamp = date('c');
$createPickupRequest->OriginDetail->CompanyCloseTime = '19:00:00';
$createPickupRequest->OriginDetail->Location = 'NQAA';
$createPickupRequest->OriginDetail->SuppliesRequested = 'supplies requested';

$createPickupRequest->PackageCount = 1;
$createPickupRequest->TotalWeight->Units = SimpleType\WeightUnits::_LB;
$createPickupRequest->TotalWeight->Value = 50;

$createPickupRequest->CarrierCode = SimpleType\CarrierCodeType::_FDXE;
$createPickupRequest->OversizePackageCount = 0;
$createPickupRequest->Remarks = 'remarks';
$createPickupRequest->CommodityDescription = 'test environment - please do not process pickup';
$createPickupRequest->CountryRelationship = SimpleType\CountryRelationshipType::_DOMESTIC;


$request = new Request();
try {
$createPickupReply = $request->getCreatePickupReply($createPickupRequest);
var_dump($createPickupReply);
} catch (\Exception $e) {
echo $request->getSoapClient()->__getLastResponse();
}
Loading

0 comments on commit 6b74650

Please sign in to comment.