Example #1
0
 /**
  * List Carts
  * Returns a list of customer records based on the criteria in the
  *         request. In the case there are more cart results than can be returned
  *         in a single response, a next token is provided which can be used
  *         to obtain more results via ListCartsByNextToken.
  *
  * @param mixed $request array of parameters for Cart_Model_ListCarts request or Cart_Model_ListCarts object itself
  * @see Cart_Model_ListCartsRequest
  * @return Cart_Model_ListCartsResponse
  *
  * @throws Cart_Exception
  */
 public function listCarts($request)
 {
     if (!$request instanceof Model\Cart_Model_ListCartsRequest) {
         //            //require_once (dirname(__FILE__) . '/Model/ListCartsRequest.php');
         $request = new Cart_Model_ListCartsRequest($request);
     }
     $parameters = $request->toQueryParameterArray();
     $parameters['Action'] = 'ListCarts';
     $httpResponse = $this->_invoke($parameters);
     //        //require_once (dirname(__FILE__) . '/Model/ListCartsResponse.php');
     $response = Model\Cart_Model_ListCartsResponse::fromXML($httpResponse['ResponseBody']);
     $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
     return $response;
 }
 * Uncomment to try out Mock Service that simulates MWSCartService
 * responses without calling MWSCartService service.
 *
 * Responses are loaded from local XML files. You can tweak XML files to
 * experiment with various outputs during development
 *
 * XML files available under MWSCartService/Mock tree
 *
 ***********************************************************************/
// $service = new MWSCartService_Mock();
/************************************************************************
 * Setup request parameters and uncomment invoke to try out
 * sample for List Carts Action
 ***********************************************************************/
// @TODO: set request. Action can be passed as Cart_Model_ListCarts
$request = new Cart_Model_ListCartsRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeListCarts($service, $request);
/**
 * Get List Carts Action Sample
 * Gets competitive pricing and related information for a product identified by
 * the MarketplaceId and ASIN.
 *
 * @param MWSCartService_Interface $service instance of MWSCartService_Interface
 * @param mixed $request Cart_Model_ListCarts or array of parameters
 */
function invokeListCarts(MWSCartService_Interface $service, $request)
{
    try {
        $response = $service->ListCarts($request);