protected function _setPaymentStatus( MShop_Order_Item_Interface $invoice, array $response )
	{
		if( !isset( $response['PAYMENTSTATUS'] ) ) {
			return;
		}

		switch ( $response['PAYMENTSTATUS'] )
		{
			case 'Pending':
				if( isset( $response['PENDINGREASON'] ) )
				{
					if( $response['PENDINGREASON'] === 'authorization' )
					{
						$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_AUTHORIZED );
						break;
					}

					$str = 'PayPal Express: order ID = ' . $invoice->getId() . ', PENDINGREASON = ' . $response['PENDINGREASON'];
					$this->_getContext()->getLogger()->log( $str, MW_Logger_Abstract::INFO );
				}

				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_PENDING );
				break;

			case 'In-Progress':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_PENDING );
				break;

			case 'Completed':
			case 'Processed':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_RECEIVED );
				break;

			case 'Failed':
			case 'Denied':
			case 'Expired':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_REFUSED );
				break;

			case 'Refunded':
			case 'Partially-Refunded':
			case 'Reversed':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_REFUND );
				break;

			case 'Canceled-Reversal':
			case 'Voided':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_CANCELED );
				break;

			default:
				$str = 'PayPal Express: order ID = ' . $invoice->getId() . ', response = ' . print_r( $response, true );
				$this->_getContext()->getLogger()->log( $str, MW_Logger_Abstract::INFO );
		}
	}
protected function _setPaymentStatus( MShop_Order_Item_Interface $invoice, array $response )
	{
		if( !isset( $response['PAYMENTSTATUS'] ) ) {
			return;
		}

		switch ( $response['PAYMENTSTATUS'] )
		{
			case 'Pending':
				if( isset( $response['PENDINGREASON'] ) )
				{
					if( $response['PENDINGREASON'] === 'authorization' )
					{
						$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_AUTHORIZED );
						break;
					}

					$str = 'PayPal Express: order ID = ' . $invoice->getId() . ', PENDINGREASON = ' . $response['PENDINGREASON'];
					$this->_getContext()->getLogger()->log( $str, MW_Logger_Abstract::INFO );
				}

				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_PENDING );
				break;

			case 'In-Progress':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_PENDING );
				break;

			case 'Completed':
			case 'Processed':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_RECEIVED );
				break;

			case 'Failed':
			case 'Denied':
			case 'Expired':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_REFUSED );
				break;

			case 'Refunded':
			case 'Partially-Refunded':
			case 'Reversed':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_REFUND );
				break;

			case 'Canceled-Reversal':
			case 'Voided':
				$invoice->setPaymentStatus( MShop_Order_Item_Abstract::PAY_CANCELED );
				break;

			default:
				$str = 'PayPal Express: order ID = ' . $invoice->getId() . ', response = ' . print_r( $response, true );
				$this->_getContext()->getLogger()->log( $str, MW_Logger_Abstract::INFO );
		}
	}
protected function _setPaymentStatus ( MShop_Order_Item_Interface $ invoice , array $ response ) { if ( ! isset ( $ response [ 'PAYMENTSTATUS' ] ) ) { return ; } switch ( $ response [ 'PAYMENTSTATUS' ] ) { case 'Pending' : if ( isset ( $ response [ 'PENDINGREASON' ] ) ) { if ( $ response [ 'PENDINGREASON' ] === 'authorization' ) { $ invoice -> setPaymentStatus ( MShop_Order_Item_Abstract :: PAY_AUTHORIZED ) ; break ; } $ str = 'PayPal Express: order ID = ' . $ invoice -> getId ( ) . ', PENDINGREASON = ' . $ response [ 'PENDINGREASON' ] ; $ this -> _getContext ( ) -> getLogger ( ) -> log ( $ str , MW_Logger_Abstract :: INFO ) ; } $ invoice -> setPaymentStatus ( MShop_Order_Item_Abstract :: PAY_PENDING ) ; break ; case 'In-Progress' : $ invoice -> setPaymentStatus ( MShop_Order_Item_Abstract :: PAY_PENDING ) ; break ; case 'Completed' : case 'Processed' : $ invoice -> setPaymentStatus ( MShop_Order_Item_Abstract :: PAY_RECEIVED ) ; break ; case 'Failed' : case 'Denied' : case 'Expired' : $ invoice -> setPaymentStatus ( MShop_Order_Item_Abstract :: PAY_REFUSED ) ; break ; case 'Refunded' : case 'Partially-Refunded' : case 'Reversed' : $ invoice -> setPaymentStatus ( MShop_Order_Item_Abstract :: PAY_REFUND ) ; break ; case 'Canceled-Reversal' : case 'Voided' : $ invoice -> setPaymentStatus ( MShop_Order_Item_Abstract :: PAY_CANCELED ) ; break ; default : $ str = 'PayPal Express: order ID = ' . $ invoice -> getId ( ) . ', response = ' . print_r ( $ response , true ) ; $ this -> _getContext ( ) -> getLogger ( ) -> log ( $ str , MW_Logger_Abstract :: INFO ) ; } }
Maps the PayPal status to the appropriate payment status and sets it in the order object.

@param MShop_Order_Item_Interface $invoice Order invoice object
@param array $response Associative list of key/value pairs containing the PayPal response
Maps the PayPal status to the appropriate payment status and sets it in the order object .