How to send multiple tracking number to get details, FedEx support up to 30 tracking numbers, so I send like this is there a way to send simply up to 30 tracking numbers
public function testTrackingMultiple()
{
$trackRequest = new ComplexType\TrackRequest();
// User Credential
$trackRequest->WebAuthenticationDetail->UserCredential->Key = env('FEDEX_KEY');
$trackRequest->WebAuthenticationDetail->UserCredential->Password = env('FEDEX_PASSWORD');
// Client Detail
$trackRequest->ClientDetail->AccountNumber = env('FEDEX_ACCOUNT_NUMBER');
$trackRequest->ClientDetail->MeterNumber = env('FEDEX_METER_NUMBER');
// Version
$trackRequest->Version->ServiceId = 'trck';
$trackRequest->Version->Major = 19;
$trackRequest->Version->Intermediate = 0;
$trackRequest->Version->Minor = 0;
// Track shipments up to 30
$trackingData = [1234456778900, 12211313000, 30009999999, 131313131300, 131313114400, 90908989800];
$trackCount = sizeof($trackingData);
switch ($trackCount) {
case '1':
$trackRequest->SelectionDetails = [new ComplexType\TrackSelectionDetail()];
break;
case '2':
$trackRequest->SelectionDetails = [new ComplexType\TrackSelectionDetail(), new ComplexType\TrackSelectionDetail()];
break;
// .........
case '5':
$trackRequest->SelectionDetails = [new ComplexType\TrackSelectionDetail(), new ComplexType\TrackSelectionDetail(), new ComplexType\TrackSelectionDetail(), new ComplexType\TrackSelectionDetail(), new ComplexType\TrackSelectionDetail()];
break;
case '30':
// ......
break;
default:
$trackRequest->SelectionDetails = [new ComplexType\TrackSelectionDetail()];
break;
}
$trackRequest->ProcessingOptions = [SimpleType\TrackRequestProcessingOptionType::_INCLUDE_DETAILED_SCANS];
for ($i=0; $i < $trackCount; $i++) {
$trackRequest->SelectionDetails[$i]->PackageIdentifier->Value = $trackingData[$i];
$trackRequest->SelectionDetails[$i]->PackageIdentifier->Type = SimpleType\TrackIdentifierType::_TRACKING_NUMBER_OR_DOORTAG;
}
$request = new Request();
$trackReply = $request->getTrackReply($trackRequest);
return $shipment = $trackReply->toArray();
}
How to send multiple tracking number to get details, FedEx support up to 30 tracking numbers, so I send like this is there a way to send simply up to 30 tracking numbers
Thanks in advance.