src/AmazonPaymentBundle/lib/amazon/OffAmazonPaymentsNotifications/Impl/XmlNotificationParser.php
private static function _createNotificationForNotificationType(
        Message $ipnMsg,
        $xmlDocumentElement
    ) {           
        // Construct an instance of the notification class
        switch ($ipnMsg->getMandatoryField("NotificationType")) {
        case "OrderReferenceNotification":
            $notification
                = new OffAmazonPaymentsNotifications_Model_OrderReferenceNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        case "BillingAgreementNotification":
            $notification
                = new OffAmazonPaymentsNotifications_Model_BillingAgreementNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        case "PaymentAuthorize":
            $notification
                = new OffAmazonPaymentsNotifications_Model_AuthorizationNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        case "PaymentCapture":
            $notification
                = new OffAmazonPaymentsNotifications_Model_CaptureNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        case "PaymentRefund":
            $notification
                = new OffAmazonPaymentsNotifications_Model_RefundNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        default:
            throw new OffAmazonPaymentsNotifications_InvalidMessageException(
                "Error with IPN notification - unknown notification " .
                $ipnMsg->getMandatoryField("NotificationType")
            );
        }
        
        return $notification;
    }
private static function _createNotificationForNotificationType(
        Message $ipnMsg,
        $xmlDocumentElement
    ) {           
        // Construct an instance of the notification class
        switch ($ipnMsg->getMandatoryField("NotificationType")) {
        case "OrderReferenceNotification":
            $notification
                = new OffAmazonPaymentsNotifications_Model_OrderReferenceNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        case "BillingAgreementNotification":
            $notification
                = new OffAmazonPaymentsNotifications_Model_BillingAgreementNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        case "PaymentAuthorize":
            $notification
                = new OffAmazonPaymentsNotifications_Model_AuthorizationNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        case "PaymentCapture":
            $notification
                = new OffAmazonPaymentsNotifications_Model_CaptureNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        case "PaymentRefund":
            $notification
                = new OffAmazonPaymentsNotifications_Model_RefundNotification(
                    $ipnMsg->getNotificationMetadata(),
                    $xmlDocumentElement
                );
            break;
        default:
            throw new OffAmazonPaymentsNotifications_InvalidMessageException(
                "Error with IPN notification - unknown notification " .
                $ipnMsg->getMandatoryField("NotificationType")
            );
        }
        
        return $notification;
    }
private static function _createNotificationForNotificationType ( Message $ ipnMsg , $ xmlDocumentElement ) { // Construct an instance of the notification class switch ( $ ipnMsg -> getMandatoryField ( "NotificationType" ) ) { case "OrderReferenceNotification" : $ notification = new OffAmazonPaymentsNotifications_Model_OrderReferenceNotification ( $ ipnMsg -> getNotificationMetadata ( ) , $ xmlDocumentElement ) ; break ; case "BillingAgreementNotification" : $ notification = new OffAmazonPaymentsNotifications_Model_BillingAgreementNotification ( $ ipnMsg -> getNotificationMetadata ( ) , $ xmlDocumentElement ) ; break ; case "PaymentAuthorize" : $ notification = new OffAmazonPaymentsNotifications_Model_AuthorizationNotification ( $ ipnMsg -> getNotificationMetadata ( ) , $ xmlDocumentElement ) ; break ; case "PaymentCapture" : $ notification = new OffAmazonPaymentsNotifications_Model_CaptureNotification ( $ ipnMsg -> getNotificationMetadata ( ) , $ xmlDocumentElement ) ; break ; case "PaymentRefund" : $ notification = new OffAmazonPaymentsNotifications_Model_RefundNotification ( $ ipnMsg -> getNotificationMetadata ( ) , $ xmlDocumentElement ) ; break ; default : throw new OffAmazonPaymentsNotifications_InvalidMessageException ( "Error with IPN notification - unknown notification " . $ ipnMsg -> getMandatoryField ( "NotificationType" ) ) ; } return $ notification ; }
Return a notification object initialised by the xml

@param Message $ipnMsg             ipn message
@param XmlNode $xmlDocumentElement xml message

@throws OffAmazonPaymentsNotifications_InvalidMessageException

@return OffAmazonPaymentsNotifications_Notification
Return a notification object initialised by the xml