So I'm using the unofficial ebay PHP SDK and updating shipment information works fine. However, it takes ages, literally about a minute and a half for the page to finally respond. After some debugging it seems the progress tracker is the issue. Every 5 / 6 seconds it checks the status, which is 'InProcess'. This gets checked around 11 times which amounts to over a minute. My question is, is it supposed to take that long to update tracking courier name and tracking number for one order?
This is the portion of code that gets the status
$getJobStatusRequest = new BulkDataExchange\Types\GetJobStatusRequest();
$getJobStatusRequest->jobId = $createUploadJobResponse->jobId;
$done = false;
while (!$done) {
$getJobStatusResponse = $exchangeService->getJobStatus($getJobStatusRequest);
if (isset($getJobStatusResponse->errorMessage)) {
foreach ($getJobStatusResponse->errorMessage->error as $error) {
printf(
"%s: %s\n\n",
$error->severity === BulkDataExchange\Enums\ErrorSeverity::C_ERROR ? 'Error' : 'Warning',
$error->message
);
}
}
if ($getJobStatusResponse->ack !== 'Failure') {
printf("Status is %s\n".' ** TIME: '.date('H:i:s').'. **', $getJobStatusResponse->jobProfile[0]->jobStatus);
switch ($getJobStatusResponse->jobProfile[0]->jobStatus) {
case BulkDataExchange\Enums\JobStatus::C_COMPLETED:
$downloadFileReferenceId = $getJobStatusResponse->jobProfile[0]->fileReferenceId;
$done = true;
break;
case BulkDataExchange\Enums\JobStatus::C_ABORTED:
case BulkDataExchange\Enums\JobStatus::C_FAILED:
$done = true;
break;
default:
sleep(5);
break;
}
} else {
$done = true;
}
}
Let me know if posting the whole script may be useful.
Thank you
There's something I don't understand. If you are updating just one order, why are you using BulkDataExchange? Why not just use the Trading\Types\CompleteSaleRequestType? There you can use
...
$request->Shipment = new Trading\Types\ShipmentType();
$data = new Trading\Types\ShipmentTrackingDetailsType();
$data->ShipmentTrackingNumber = $track;
$data->ShippingCarrierUsed = $carrier;
$request->Shipment->ShipmentTrackingDetails = [$data];
$response = $service->CompleteSale($request);
and then you can check the ack to see if it was updated or not.
if($response->Ack != 'Failure'){
// Failed
} else {
// Updated. There might be warnings (The Ack would be Warning)
}
That's what I am using to update the trackings to my orders, and it takes 1, maybe 2 seconds. One thing is very clear. Updating one order should not take that long...
This is the entire call I use:
$service = new TradingServices\TradingService([
'credentials' => [
'appId' => 'MY_APP_ID',
'devId' => 'MY_DEV_ID',
'certId' => 'MY_CERT_ID',
],
'sandbox' => false,
'siteId' => $siteId,
]);
$request = new TradingTypes\CompleteSaleRequestType();
$request->RequesterCredentials = new TradingTypes\CustomSecurityHeaderType();
$request->RequesterCredentials->eBayAuthToken = $token;
$request->ItemID = $itemid;
$request->Shipped = true;
$request->TransactionID = $transid;
if( (!empty( $track ) ) && !empty( $shipper ) ){
$request->Shipment = new TradingTypes\ShipmentType();
$data = new TradingTypes\ShipmentTrackingDetailsType();
$data->ShipmentTrackingNumber = $track;
$data->ShippingCarrierUsed = $shipper;
$request->Shipment->ShipmentTrackingDetails = [$data];
}
$response = $service->CompleteSale($request);