private function CompleteSale($token, $transactionId, $itemId, $shipmentMethod, $shippedOn, $postalReferenceNo) { $session = $this->configEbay($token); try { $client = new eBaySOAP($session); /* if(!empty($postalReferenceNo)){ switch ($shipmentMethod){ case "M": $ShippingCarrierUsed = "UPS"; break; case "U": $ShippingCarrierUsed = "UPS"; break; default: $ShippingCarrierUsed = "Other"; break; } $Shipment = array("ShipmentTrackingNumber"=>$postalReferenceNo, "ShippedTime"=>$shippedOn, "ShippingCarrierUsed"=>$ShippingCarrierUsed); $params = array("Version"=>"607", "ItemID"=>$itemId, "Paid"=> true, "Shipment"=>$Shipment, "Shipped"=>true, "TransactionID"=>$transactionId); print_r($params); $results = $client->CompleteSale($params); }else{ $params = array("Version"=>"607", "ItemID"=>$itemId, "Paid"=> true, "Shipped"=>true, "TransactionID"=>$transactionId); print_r($params); $results = $client->CompleteSale($params); } */ $params = array("Version" => "607", "ItemID" => $itemId, "Paid" => true, "Shipped" => true, "TransactionID" => $transactionId); print_r($params); $results = $client->CompleteSale($params); //print_r($results); if (!empty($results->Ack) && $results->Ack == "Success") { $this->updateEbayShipStatus($transactionId, $itemId); } else { if (!empty($results->Errors)) { print_r($results->Errors); } else { echo $results->faultstring; } $this->updateEbayShipStatus($transactionId, $itemId); } //exit; sleep(1); } catch (SOAPFault $f) { print $f; // error handling } }
private function CompleteSale($token, $transactionId, $itemId, $shipmentMethod, $shippedOn, $postalReferenceNo) { global $argv; $session = $this->configEbay($token); try { $client = new eBaySOAP($session); /* if(!empty($postalReferenceNo)){ switch ($shipmentMethod){ case "M": $ShippingCarrierUsed = "UPS"; break; case "U": $ShippingCarrierUsed = "UPS"; break; default: $ShippingCarrierUsed = "Other"; break; } $Shipment = array("ShipmentTrackingNumber"=>$postalReferenceNo, "ShippedTime"=>$shippedOn, "ShippingCarrierUsed"=>$ShippingCarrierUsed); $params = array("Version"=>"607", "ItemID"=>$itemId, "Paid"=> true, "Shipment"=>$Shipment, "Shipped"=>true, "TransactionID"=>$transactionId); print_r($params); $results = $client->CompleteSale($params); }else{ $params = array("Version"=>"607", "ItemID"=>$itemId, "Paid"=> true, "Shipped"=>true, "TransactionID"=>$transactionId); print_r($params); $results = $client->CompleteSale($params); } */ $tmp = strtotime($shippedOn); $shippedOn = date("Y-m-d\\TH:i:s.000\\Z", $tmp - 8 * 60 * 60); $Shipment = array("ShippedTime" => $shippedOn); $params = array("Version" => "607", "ItemID" => $itemId, "Paid" => true, "Shipment" => $Shipment, "Shipped" => true, "TransactionID" => $transactionId); $this->log("synceBayShipped", print_r($params, true)); $results = $client->CompleteSale($params); if ($argv[3] == "debug") { print_r($results); file_put_contents($this->config['log']['shipments'] . "CompleteSale_Request.xml", $client->__getLastRequest()); file_put_contents($this->config['log']['shipments'] . "CompleteSale_Response.xml", $client->__getLastResponse()); } if (!empty($results->Ack) && $results->Ack == "Success") { $this->log("synceBayShipped", "Success"); $this->updateEbayShipStatus($transactionId, $itemId, 1); } else { /* if(!empty($results->Errors)){ print_r($results->Errors); }else{ echo $results->faultstring; } */ @$this->log("synceBayShipped", "Error:" . $results->Errors->LongMessage); $this->updateEbayShipStatus($transactionId, $itemId, 2); } //exit; //sleep(1); } catch (SOAPFault $f) { print $f; // error handling } }