Пример #1
0
 /**
  * Get Package Tracking Details
  * Gets the tracking details for a shipment package.
  *
  * @param mixed $request array of parameters for FBAOutboundServiceMWS_Model_GetPackageTrackingDetails request or FBAOutboundServiceMWS_Model_GetPackageTrackingDetails object itself
  * @see FBAOutboundServiceMWS_Model_GetPackageTrackingDetailsRequest
  * @return FBAOutboundServiceMWS_Model_GetPackageTrackingDetailsResponse
  *
  * @throws FBAOutboundServiceMWS_Exception
  */
 public function getPackageTrackingDetails($request)
 {
     if (!$request instanceof FBAOutboundServiceMWS_Model_GetPackageTrackingDetailsRequest) {
         $request = new FBAOutboundServiceMWS_Model_GetPackageTrackingDetailsRequest($request);
     }
     $parameters = $request->toQueryParameterArray();
     $parameters['Action'] = 'GetPackageTrackingDetails';
     $httpResponse = $this->_invoke($parameters);
     $response = FBAOutboundServiceMWS_Model_GetPackageTrackingDetailsResponse::fromXML($httpResponse['ResponseBody']);
     $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
     return $response;
 }
function GetAmzFBAOrderTracking($order_id)
{
    AmzFBA_Woo_Log("DEBUG", "Order", __FUNCTION__, "Entering");
    $MissingConfig = CheckForMissingConfig();
    if ($MissingConfig == true) {
        $returnmessage = 'Failed getting order tracking information from Amazon FBA. Required configuration missing in settings.';
        $order->add_order_note($returnmessage, 0);
        //Add to Log
        $level = "Bad";
        $category = "Order";
        $title = "Get Info Error - Order ID:" . $order_id;
        AmzFBA_Woo_Log($level, $category, $title, $returnmessage);
        return $returnmessage;
    }
    $UserSettings = get_option('woocommerce_amazonfba_settings');
    $ChosenMarketplace = $UserSettings['AmzFBA_Marketplace'];
    $MWSEndpointURL = GetMWSEndpointURL('FulfillmentOutboundShipment', $ChosenMarketplace);
    $config = array('ServiceURL' => $MWSEndpointURL, 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3);
    $service = new FBAOutboundServiceMWS_Client(ACCESS_KEY_ID, SECRET_ACCESS_KEY, $config, APPLICATION_NAME, APPLICATION_VERSION);
    $request = new FBAOutboundServiceMWS_Model_GetPackageTrackingDetailsRequest();
    $request->setSellerId(SELLER_ID);
    $PackageNumber = get_post_meta($order_id, "FBA_Package_Number", TRUE);
    $request->setPackageNumber($PackageNumber);
    invokeGetPackageTrackingDetails($service, $request);
    AmzFBA_Woo_Log("DEBUG", "Order", __FUNCTION__, "Exiting");
}
 * Uncomment to try out Mock Service that simulates FBAOutboundServiceMWS
 * responses without calling FBAOutboundServiceMWS service.
 *
 * Responses are loaded from local XML files. You can tweak XML files to
 * experiment with various outputs during development
 *
 * XML files available under FBAOutboundServiceMWS/Mock tree
 *
 ***********************************************************************/
// $service = new FBAOutboundServiceMWS_Mock();
/************************************************************************
 * Setup request parameters and uncomment invoke to try out
 * sample for Get Package Tracking Details Action
 ***********************************************************************/
// @TODO: set request. Action can be passed as FBAOutboundServiceMWS_Model_GetPackageTrackingDetails
$request = new FBAOutboundServiceMWS_Model_GetPackageTrackingDetailsRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeGetPackageTrackingDetails($service, $request);
/**
 * Get Get Package Tracking Details Action Sample
 * Gets competitive pricing and related information for a product identified by
 * the MarketplaceId and ASIN.
 *
 * @param FBAOutboundServiceMWS_Interface $service instance of FBAOutboundServiceMWS_Interface
 * @param mixed $request FBAOutboundServiceMWS_Model_GetPackageTrackingDetails or array of parameters
 */
function invokeGetPackageTrackingDetails(FBAOutboundServiceMWS_Interface $service, $request)
{
    try {
        $response = $service->GetPackageTrackingDetails($request);