예제 #1
0
 /**
  * List Inventory Supply
  * Get information about the supply of seller-owned inventory in
  *     Amazon's fulfillment network. "Supply" is inventory that is available
  *     for fulfilling (a.k.a. Multi-Channel Fulfillment) orders. In general
  *     this includes all sellable inventory that has been received by Amazon,
  *     that is not reserved for existing orders or for internal FC processes,
  *     and also inventory expected to be received from inbound shipments.
  *
  *     This operation provides 2 typical usages by setting different
  *     ListInventorySupplyRequest value:
  *
  *     1. Set value to SellerSkus and not set value to QueryStartDateTime,
  *     this operation will return all sellable inventory that has been received
  *     by Amazon's fulfillment network for these SellerSkus.
  *
  *     2. Not set value to SellerSkus and set value to QueryStartDateTime,
  *     This operation will return information about the supply of all seller-owned
  *     inventory in Amazon's fulfillment network, for inventory items that may have had
  *     recent changes in inventory levels. It provides the most efficient mechanism
  *     for clients to maintain local copies of inventory supply data.
  *
  *     Only 1 of these 2 parameters (SellerSkus and QueryStartDateTime) can be set value for 1 request.
  *     If both with values or neither with values, an exception will be thrown.
  *
  *     This operation is used with ListInventorySupplyByNextToken
  *     to paginate over the resultset. Begin pagination by invoking the
  *     ListInventorySupply operation, and retrieve the first set of
  *     results. If more results are available,continuing iteratively requesting further
  *     pages results by invoking the ListInventorySupplyByNextToken operation (each time
  *     passing in the NextToken value from the previous result), until the returned NextToken
  *     is null, indicating no further results are available.
  *
  * @param mixed $request array of parameters for FBAInventoryServiceMWS_Model_ListInventorySupply request or FBAInventoryServiceMWS_Model_ListInventorySupply object itself
  * @see FBAInventoryServiceMWS_Model_ListInventorySupplyRequest
  * @return FBAInventoryServiceMWS_Model_ListInventorySupplyResponse
  *
  * @throws FBAInventoryServiceMWS_Exception
  */
 public function listInventorySupply($request)
 {
     if (!$request instanceof FBAInventoryServiceMWS_Model_ListInventorySupplyRequest) {
         $request = new FBAInventoryServiceMWS_Model_ListInventorySupplyRequest($request);
     }
     $parameters = $request->toQueryParameterArray();
     $parameters['Action'] = 'ListInventorySupply';
     $httpResponse = $this->_invoke($parameters);
     $response = FBAInventoryServiceMWS_Model_ListInventorySupplyResponse::fromXML($httpResponse['ResponseBody']);
     $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
     return $response;
 }
예제 #2
0
 * Uncomment to try out Mock Service that simulates FBAInventoryServiceMWS
 * responses without calling FBAInventoryServiceMWS service.
 *
 * Responses are loaded from local XML files. You can tweak XML files to
 * experiment with various outputs during development
 *
 * XML files available under FBAInventoryServiceMWS/Mock tree
 *
 ***********************************************************************/
// $service = new FBAInventoryServiceMWS_Mock();
/************************************************************************
 * Setup request parameters and uncomment invoke to try out
 * sample for List Inventory Supply Action
 ***********************************************************************/
// @TODO: set request. Action can be passed as FBAInventoryServiceMWS_Model_ListInventorySupply
$request = new FBAInventoryServiceMWS_Model_ListInventorySupplyRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeListInventorySupply($service, $request);
/**
 * Get List Inventory Supply Action Sample
 * Gets competitive pricing and related information for a product identified by
 * the MarketplaceId and ASIN.
 *
 * @param FBAInventoryServiceMWS_Interface $service instance of FBAInventoryServiceMWS_Interface
 * @param mixed $request FBAInventoryServiceMWS_Model_ListInventorySupply or array of parameters
 */
function invokeListInventorySupply(FBAInventoryServiceMWS_Interface $service, $request)
{
    try {
        $response = $service->ListInventorySupply($request);
function ListInventorySupply()
{
    AmzFBA_Woo_Log("DEBUG", "Inventory", __FUNCTION__, "Entering");
    $MissingConfig = CheckForMissingConfig();
    if ($MissingConfig == true) {
        $returnmessage = 'Inventory retrieval failed. Amazon FBA configuration is not completed in your settings.';
        $level = "Bad";
        $category = "Inventory";
        $title = "Failed - Update Inventory";
        AmzFBA_Woo_Log($level, $category, $title, $returnmessage);
        return $returnmessage;
    }
    $UserSettings = get_option('woocommerce_amazonfba_settings');
    $ChosenMarketplace = $UserSettings['AmzFBA_Marketplace'];
    $MWSEndpointURL = GetMWSEndpointURL('FulfillmentInventory', $ChosenMarketplace);
    $config = array('ServiceURL' => $MWSEndpointURL, 'ProxyHost' => null, 'ProxyPort' => -1, 'MaxErrorRetry' => 3);
    $service = new FBAInventoryServiceMWS_Client(ACCESS_KEY_ID, SECRET_ACCESS_KEY, $config, APPLICATION_NAME, APPLICATION_VERSION);
    $request = new FBAInventoryServiceMWS_Model_ListInventorySupplyRequest();
    $request->setSellerId(SELLER_ID);
    $request->setQueryStartDateTime(2001 - 10 - 10);
    invokeListInventorySupply($service, $request);
    $returnmessage = "Retrieving inventory from Amazon process begun. Please see logs for progress.";
    AmzFBA_Woo_Log("DEBUG", "Inventory", __FUNCTION__, "Exiting");
    return $returnmessage;
}