function GetAmzFBAOrderDetails($order_id)
{
    AmzFBA_Woo_Log("DEBUG", "Order", __FUNCTION__, "Entering");
    $level = "Neutral";
    $category = "Order";
    $title = "Order Status - ID:" . $order_id;
    $MissingConfig = CheckForMissingConfig();
    if ($MissingConfig == true) {
        $returnmessage = 'Failed getting order 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_GetFulfillmentOrderRequest();
    $request->setSellerId(SELLER_ID);
    $FBAOrderID = get_post_meta($order_id, "FBA_OrderId", TRUE);
    if (empty($FBAOrderID)) {
        AmzFBA_Woo_Log("Error", $category, __FUNCTION__, "Order does not have FBA Order id - putting it on hold");
        $order = new WC_Order($order_id);
        $order->update_status('on-hold');
        return;
    }
    $FBAStatus = get_post_meta($order_id, "FBA_Status", TRUE);
    if (!in_array(strtolower($FBAStatus), array('false', 'received', 'planning', 'processing', 'cancelling'))) {
        AmzFBA_Woo_Log("Error", $category, __FUNCTION__, "FBA Status = " . $FBAStatus . " is unexpected - putting order on hold");
        $order = new WC_Order($order_id);
        $order->update_status('on-hold');
        return;
    }
    AmzFBA_Woo_Log($level, $category, $title, "Checking order status for " . $order_id . " FBA order id = " . $FBAOrderID);
    $request->setSellerFulfillmentOrderId($FBAOrderID);
    invokeGetFulfillmentOrder($service, $request, $order_id);
}
 * 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 Fulfillment Order Action
 ***********************************************************************/
// @TODO: set request. Action can be passed as FBAOutboundServiceMWS_Model_GetFulfillmentOrder
$request = new FBAOutboundServiceMWS_Model_GetFulfillmentOrderRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeGetFulfillmentOrder($service, $request);
/**
 * Get Get Fulfillment Order 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_GetFulfillmentOrder or array of parameters
 */
function invokeGetFulfillmentOrder(FBAOutboundServiceMWS_Interface $service, $request)
{
    try {
        $response = $service->GetFulfillmentOrder($request);
示例#3
0
 /**
  * Get Fulfillment Order
  * Get detailed information about a FulfillmentOrder.  This includes the
  *   original fulfillment order request, the status of the order and its
  *   items in Amazon's fulfillment network, and the shipments that have been
  *   generated to fulfill the order.
  *
  * @param mixed $request array of parameters for FBAOutboundServiceMWS_Model_GetFulfillmentOrder request or FBAOutboundServiceMWS_Model_GetFulfillmentOrder object itself
  * @see FBAOutboundServiceMWS_Model_GetFulfillmentOrderRequest
  * @return FBAOutboundServiceMWS_Model_GetFulfillmentOrderResponse
  *
  * @throws FBAOutboundServiceMWS_Exception
  */
 public function getFulfillmentOrder($request)
 {
     if (!$request instanceof FBAOutboundServiceMWS_Model_GetFulfillmentOrderRequest) {
         $request = new FBAOutboundServiceMWS_Model_GetFulfillmentOrderRequest($request);
     }
     $parameters = $request->toQueryParameterArray();
     $parameters['Action'] = 'GetFulfillmentOrder';
     $httpResponse = $this->_invoke($parameters);
     $response = FBAOutboundServiceMWS_Model_GetFulfillmentOrderResponse::fromXML($httpResponse['ResponseBody']);
     $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
     return $response;
 }
function GetAmzFBAOrderDetails($order_id)
{
    if (CheckForMissingConfig() != '') {
        $returnmessage = 'Failed getting order information from Amazon FBA. Required configuration missing in settings.';
        $note = "Failed getting order information from Amazon FBA. Required configuration missing in settings.";
        $order->add_order_note($note, 0);
        //Add to Log
        $level = "Bad";
        $category = "Order";
        $title = "Get Info Error - Order ID:" . $order_id;
        $info = "Failed getting order information from Amazon FBA. Required configuration missing in settings..";
        AmzFBA_Woo_Log($level, $category, $title, $info);
        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_GetFulfillmentOrderRequest();
    $request->setSellerId(SELLER_ID);
    $FBAOrderID = get_post_meta($order_id, "FBA_OrderID", TRUE);
    $request->setSellerFulfillmentOrderId($FBAOrderID);
    invokeGetFulfillmentOrder($service, $request, $order_id);
}