Exemplo n.º 1
0
 * 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);
        echo "Service Response\n";
        echo "=============================================================================\n";
        $dom = new DOMDocument();
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;
}