/**
  * Perform the capture for a single shipment
  *
  * @param int    $shipmentNumber        order item index to capture
  * @param string $amazonAuthorizationId authorization to capture
  *
  */
 private function _performCaptureForShipment($shipmentNumber, $amazonAuthorizationId)
 {
     $response = $this->callStepAndCheckForException('performCaptureForShipment', array($shipmentNumber, $amazonAuthorizationId));
     validateThatCaptureIsCompleted($response->getCaptureResult());
     printCaptureResponse($response);
 }
 /**
  * Perform the capture call for the order
  * Throw an exception if the capture is not processed, as this is the
  * expected result
  *
  * @param float  $captureAmount         amount to capture from the buyer
  * @param string $amazonAuthorizationId auth id to perform the capture on
  *
  * @return no response
  */
 private function _capturePaymentAmount($captureAmount, $amazonAuthorizationId)
 {
     $response = $this->callStepAndCheckForException('captureOrderAmount', array($captureAmount, $amazonAuthorizationId, $this->currencyCode));
     $captureId = $response->getCaptureResult()->getCaptureDetails()->getAmazonCaptureId();
     // Check for the presence of the ipn notification
     $this->waitForNotificationToBeProcessedBeforeContinuing($captureId, "CaptureNotification");
     $response = $this->callStepAndCheckForException('getCaptureDetails', array($captureId));
     validateThatCaptureIsCompleted($response->getGetCaptureDetailsResult());
     $this->printResponseToWebpage("printGetCaptureDetailsResponse", array($response));
 }
 private function _waitForProviderCreditSummaryList($captureResponse)
 {
     $amazonCaptureId = $captureResponse->getCaptureResult()->getCaptureDetails()->getAmazonCaptureId();
     $maxSleepTime = 60;
     $getCaptureDetailsResponse = null;
     $providerCreditSummaryList = null;
     while (is_null($providerCreditSummaryList) && $maxSleepTime > 0) {
         sleep(5);
         $maxSleepTime -= 5;
         $getCaptureDetailsResponse = $this->callStepAndCheckForException('getCaptureDetails', array($amazonCaptureId));
         $providerCreditSummaryList = $getCaptureDetailsResponse->getGetCaptureDetailsResult()->getCaptureDetails()->getProviderCreditSummaryList();
     }
     validateThatCaptureIsCompleted($getCaptureDetailsResponse->getGetCaptureDetailsResult());
     $this->printResponseToWebpage("printGetCaptureDetailsResponse", array($getCaptureDetailsResponse));
     if (is_null($providerCreditSummaryList)) {
         throw new ErrorException("No providerCreditSummaryList found in getCaptureDetails response");
     }
     return $providerCreditSummaryList;
 }
 /**
  * Perform the capture call for the order
  * Throw an exception if the capture is not processed, as this is the
  * expected result
  *
  * @param float $captureAmount
  *            amount to capture from the buyer
  * @param string $amazonAuthorizationId
  *            auth id to perform the capture on
  *            
  * @return no response
  */
 private function _captureOrderAmount($captureAmount, $amazonAuthorizationId)
 {
     $response = $this->callStepAndCheckForException('captureOrderAmount', array($captureAmount, $amazonAuthorizationId));
     validateThatCaptureIsCompleted($response->getCaptureResult());
     printCaptureResponse($response);
 }