protected function _checkIPN( $baseManager, $basket, $additional )
	{
		$attrManager = MShop_Factory::createManager( $this->_getContext(), 'order/base/service/attribute' );

		if( $this->_getConfigValue( array( 'paypalexpress.AccountEmail' ) ) !== $additional['receiver_email'] )
		{
			$msg = sprintf( 'PayPal Express: Wrong receiver email "%1$s"', $additional['receiver_email'] );
			throw new MShop_Service_Exception( $msg );
		}

		$price = $basket->getPrice();
		$amount = $price->getValue() + $price->getCosts();
		if( $amount != $additional['payment_amount'] )
		{
			$msg = sprintf( 'PayPal Express: Wrong payment amount "%1$s" for order ID "%2$s"', $additional['payment_amount'], $additional['invoice'] );
			throw new MShop_Service_Exception( $msg );
		}

		$search = $attrManager->createSearch();
		$expr = array(
			$search->compare( '==', 'order.base.service.attribute.code', $additional['txn_id'] ),
			$search->compare( '==', 'order.base.service.attribute.value', $additional['payment_status'] ),
		);

		$search->setConditions( $search->combine( '&&', $expr ) );
		$results = $attrManager->searchItems( $search );

		if ( ( $attr = reset( $results ) ) !== false )
		{
			$msg = sprintf( 'PayPal Express: Duplicate transaction with ID "%1$s" and status "%2$s" ', $additional['txn_id'], $additional['txn_status'] );
			throw new MShop_Service_Exception( $msg );
		}
	}
protected function _checkIPN( $baseManager, $basket, $additional )
	{
		$attrManager = MShop_Factory::createManager( $this->_getContext(), 'order/base/service/attribute' );

		if( $this->_getConfigValue( array( 'paypalexpress.AccountEmail' ) ) !== $additional['receiver_email'] )
		{
			$msg = sprintf( 'PayPal Express: Wrong receiver email "%1$s"', $additional['receiver_email'] );
			throw new MShop_Service_Exception( $msg );
		}

		$price = $basket->getPrice();
		$amount = $price->getValue() + $price->getCosts();
		if( $amount != $additional['payment_amount'] )
		{
			$msg = sprintf( 'PayPal Express: Wrong payment amount "%1$s" for order ID "%2$s"', $additional['payment_amount'], $additional['invoice'] );
			throw new MShop_Service_Exception( $msg );
		}

		$search = $attrManager->createSearch();
		$expr = array(
			$search->compare( '==', 'order.base.service.attribute.code', $additional['txn_id'] ),
			$search->compare( '==', 'order.base.service.attribute.value', $additional['payment_status'] ),
		);

		$search->setConditions( $search->combine( '&&', $expr ) );
		$results = $attrManager->searchItems( $search );

		if ( ( $attr = reset( $results ) ) !== false )
		{
			$msg = sprintf( 'PayPal Express: Duplicate transaction with ID "%1$s" and status "%2$s" ', $additional['txn_id'], $additional['txn_status'] );
			throw new MShop_Service_Exception( $msg );
		}
	}
protected function _checkIPN ( $ baseManager , $ basket , $ additional ) { $ attrManager = MShop_Factory :: createManager ( $ this -> _getContext ( ) , 'order/base/service/attribute' ) ; if ( $ this -> _getConfigValue ( array ( 'paypalexpress.AccountEmail' ) ) !== $ additional [ 'receiver_email' ] ) { $ msg = sprintf ( 'PayPal Express: Wrong receiver email "%1$s"' , $ additional [ 'receiver_email' ] ) ; throw new MShop_Service_Exception ( $ msg ) ; } $ price = $ basket -> getPrice ( ) ; $ amount = $ price -> getValue ( ) + $ price -> getCosts ( ) ; if ( $ amount != $ additional [ 'payment_amount' ] ) { $ msg = sprintf ( 'PayPal Express: Wrong payment amount "%1$s" for order ID "%2$s"' , $ additional [ 'payment_amount' ] , $ additional [ 'invoice' ] ) ; throw new MShop_Service_Exception ( $ msg ) ; } $ search = $ attrManager -> createSearch ( ) ; $ expr = array ( $ search -> compare ( '==' , 'order.base.service.attribute.code' , $ additional [ 'txn_id' ] ) , $ search -> compare ( '==' , 'order.base.service.attribute.value' , $ additional [ 'payment_status' ] ) , ) ; $ search -> setConditions ( $ search -> combine ( '&&' , $ expr ) ) ; $ results = $ attrManager -> searchItems ( $ search ) ; if ( ( $ attr = reset ( $ results ) ) !== false ) { $ msg = sprintf ( 'PayPal Express: Duplicate transaction with ID "%1$s" and status "%2$s" ' , $ additional [ 'txn_id' ] , $ additional [ 'txn_status' ] ) ; throw new MShop_Service_Exception ( $ msg ) ; } }
Checks if IPN message from paypal is valid.

@param MShop_Order_Manager_Base_Interface $baseManager
@param MShop_Order_Item_Base_Interface $basket
@param array $additional
@todo 2016.03 Remove $baseManager parameter
Checks if IPN message from paypal is valid .