src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Samples/WebServerExample.php
protected function waitForNotificationToBeProcessedBeforeContinuing(
        $identifier, 
        $notificationType
    ) {
        $fileName = $this->folderPath . $identifier . "_" . $notificationType . ".txt";
        // timeout after 1 minute
        $totalChecks = 0;
        while (!file_exists($fileName) && $totalChecks < 20) {
            sleep(5);
            $totalChecks += 1;
        }
        
        if ($totalChecks >= 20) {
            throw new ErrorException(
                "IPN has not been received within timeout period exiting sample"
            );
        }    
    }
protected function waitForNotificationToBeProcessedBeforeContinuing(
        $identifier, 
        $notificationType
    ) {
        $fileName = $this->folderPath . $identifier . "_" . $notificationType . ".txt";
        // timeout after 1 minute
        $totalChecks = 0;
        while (!file_exists($fileName) && $totalChecks < 20) {
            sleep(5);
            $totalChecks += 1;
        }
        
        if ($totalChecks >= 20) {
            throw new ErrorException(
                "IPN has not been received within timeout period exiting sample"
            );
        }    
    }
protected function waitForNotificationToBeProcessedBeforeContinuing ( $ identifier , $ notificationType ) { $ fileName = $ this -> folderPath . $ identifier . "_" . $ notificationType . ".txt" ; // timeout after 1 minute $ totalChecks = 0 ; while ( ! file_exists ( $ fileName ) && $ totalChecks < 20 ) { sleep ( 5 ) ; $ totalChecks += 1 ; } if ( $ totalChecks >= 20 ) { throw new ErrorException ( "IPN has not been received within timeout period exiting sample" ) ; } }
Check that we have received an IPN notification for the defined event

For PHP, there is an IPN handler that will write the contents of the IPN to
a file in the format of
<amazonOrderReferenceId>_<amazonAuthorizationId>_Authorization.
This method will check for the presnece of this file
and will loop/timeout until the notification has been handled.

Merchants can use alternative approaches such as memory caches,
shared memory or database storage so that scripts serving user
pages are able to check on the status of a notification

@param string $identifier       transaction      that we are waiting to query
@param string $notificationType notificationType notification type
that we expect

@return void
Check that we have received an IPN notification for the defined event