Example #1
0
 /**
  * Cancel Shipment
  * Cancels an existing shipment.  This will only succeed if the cancellation window has not passed and if the shipment
  *     has not been cancelled already.
  *
  * @param mixed $request array of parameters for MWSMerchantFulfillmentService_Model_CancelShipment request or MWSMerchantFulfillmentService_Model_CancelShipment object itself
  * @see MWSMerchantFulfillmentService_Model_CancelShipmentRequest
  * @return MWSMerchantFulfillmentService_Model_CancelShipmentResponse
  *
  * @throws MWSMerchantFulfillmentService_Exception
  */
 public function cancelShipment($request)
 {
     if (!$request instanceof MWSMerchantFulfillmentService_Model_CancelShipmentRequest) {
         require_once dirname(__FILE__) . '/Model/CancelShipmentRequest.php';
         $request = new MWSMerchantFulfillmentService_Model_CancelShipmentRequest($request);
     }
     $parameters = $request->toQueryParameterArray();
     $parameters['Action'] = 'CancelShipment';
     $httpResponse = $this->_invoke($parameters);
     require_once dirname(__FILE__) . '/Model/CancelShipmentResponse.php';
     $response = MWSMerchantFulfillmentService_Model_CancelShipmentResponse::fromXML($httpResponse['ResponseBody']);
     $response->setResponseHeaderMetadata($httpResponse['ResponseHeaderMetadata']);
     return $response;
 }
 * Uncomment to try out Mock Service that simulates MWSMerchantFulfillmentService
 * responses without calling MWSMerchantFulfillmentService service.
 *
 * Responses are loaded from local XML files. You can tweak XML files to
 * experiment with various outputs during development
 *
 * XML files available under MWSMerchantFulfillmentService/Mock tree
 *
 ***********************************************************************/
// $service = new MWSMerchantFulfillmentService_Mock();
/************************************************************************
 * Setup request parameters and uncomment invoke to try out
 * sample for Cancel Shipment Action
 ***********************************************************************/
// @TODO: set request. Action can be passed as MWSMerchantFulfillmentService_Model_CancelShipment
$request = new MWSMerchantFulfillmentService_Model_CancelShipmentRequest();
$request->setSellerId(MERCHANT_ID);
// object or array of parameters
invokeCancelShipment($service, $request);
/**
 * Get Cancel Shipment Action Sample
 * Gets competitive pricing and related information for a product identified by
 * the MarketplaceId and ASIN.
 *
 * @param MWSMerchantFulfillmentService_Interface $service instance of MWSMerchantFulfillmentService_Interface
 * @param mixed $request MWSMerchantFulfillmentService_Model_CancelShipment or array of parameters
 */
function invokeCancelShipment(MWSMerchantFulfillmentService_Interface $service, $request)
{
    try {
        $response = $service->CancelShipment($request);