private function GetErrorMessage($httpParsedResponseAr)
	{
		/* SAMPLE RETURN VALUE
		(
		    [TIMESTAMP] => 2012%2d03%2d23T01%3a47%3a01Z
		    [CORRELATIONID] => c9dcc0b7acd94
		    [ACK] => Failure
		    [VERSION] => 62%2e0
		    [BUILD] => 2649250
		    [L_ERRORCODE0] => 10507
		    [L_SHORTMESSAGE0] => Invalid%20Configuration
		    [L_LONGMESSAGE0] => This%20transaction%20cannot%20be%20processed%2e%20Please%20contact%20PayPal%20Customer%20Service%2e
		    [L_SEVERITYCODE0] => Error
		    [AMT] => 103%2e00
		    [CURRENCYCODE] => USD
		)
		*/

		$errmsg = $this->GetArrayVal($httpParsedResponseAr,"L_SHORTMESSAGE0") . ": ";

		// figure out the message as PayPal reports it
		$longmessage = $this->GetArrayVal($httpParsedResponseAr,"L_LONGMESSAGE0");

		// paypal prepends this to every message, so strip it out
		$longmessage = str_replace("This%20transaction%20cannot%20be%20processed%2e","", $longmessage );

		if ($longmessage != "")
		{
			// this will generally be the best description of the error
			$errmsg .= $longmessage;
		}
		else
		{
			// paypal didn't give a simple error description so we have to try to decipher the gateway response

			// this is the response code from the gateway
			$processor_code = $this->GetArrayVal($httpParsedResponseAr,"L_ERRORPARAMVALUE0");

			if ($processor_code)
			{
				// this will usually be "ProcessorResponse" in which case we don't need to display it
				$processor_prefix = $this->GetArrayVal($httpParsedResponseAr,"L_ERRORPARAMID0");
				$processor_prefix = ($processor_prefix == "ProcessorResponse")
				? ''
				: $processor_prefix . ' - ';

				$processor_message =  $processor_prefix . $this->getProcessorResponseDescription($processor_code);

				$errmsg .= $processor_message;
			}
		}

		return urldecode($errmsg);
	}
private function GetErrorMessage($httpParsedResponseAr)
	{
		/* SAMPLE RETURN VALUE
		(
		    [TIMESTAMP] => 2012%2d03%2d23T01%3a47%3a01Z
		    [CORRELATIONID] => c9dcc0b7acd94
		    [ACK] => Failure
		    [VERSION] => 62%2e0
		    [BUILD] => 2649250
		    [L_ERRORCODE0] => 10507
		    [L_SHORTMESSAGE0] => Invalid%20Configuration
		    [L_LONGMESSAGE0] => This%20transaction%20cannot%20be%20processed%2e%20Please%20contact%20PayPal%20Customer%20Service%2e
		    [L_SEVERITYCODE0] => Error
		    [AMT] => 103%2e00
		    [CURRENCYCODE] => USD
		)
		*/

		$errmsg = $this->GetArrayVal($httpParsedResponseAr,"L_SHORTMESSAGE0") . ": ";

		// figure out the message as PayPal reports it
		$longmessage = $this->GetArrayVal($httpParsedResponseAr,"L_LONGMESSAGE0");

		// paypal prepends this to every message, so strip it out
		$longmessage = str_replace("This%20transaction%20cannot%20be%20processed%2e","", $longmessage );

		if ($longmessage != "")
		{
			// this will generally be the best description of the error
			$errmsg .= $longmessage;
		}
		else
		{
			// paypal didn't give a simple error description so we have to try to decipher the gateway response

			// this is the response code from the gateway
			$processor_code = $this->GetArrayVal($httpParsedResponseAr,"L_ERRORPARAMVALUE0");

			if ($processor_code)
			{
				// this will usually be "ProcessorResponse" in which case we don't need to display it
				$processor_prefix = $this->GetArrayVal($httpParsedResponseAr,"L_ERRORPARAMID0");
				$processor_prefix = ($processor_prefix == "ProcessorResponse")
				? ''
				: $processor_prefix . ' - ';

				$processor_message =  $processor_prefix . $this->getProcessorResponseDescription($processor_code);

				$errmsg .= $processor_message;
			}
		}

		return urldecode($errmsg);
	}
private function GetErrorMessage ( $ httpParsedResponseAr ) { /* SAMPLE RETURN VALUE
		(
		    [TIMESTAMP] => 2012%2d03%2d23T01%3a47%3a01Z
		    [CORRELATIONID] => c9dcc0b7acd94
		    [ACK] => Failure
		    [VERSION] => 62%2e0
		    [BUILD] => 2649250
		    [L_ERRORCODE0] => 10507
		    [L_SHORTMESSAGE0] => Invalid%20Configuration
		    [L_LONGMESSAGE0] => This%20transaction%20cannot%20be%20processed%2e%20Please%20contact%20PayPal%20Customer%20Service%2e
		    [L_SEVERITYCODE0] => Error
		    [AMT] => 103%2e00
		    [CURRENCYCODE] => USD
		)
		*/ $ errmsg = $ this -> GetArrayVal ( $ httpParsedResponseAr , "L_SHORTMESSAGE0" ) . ": " ; // figure out the message as PayPal reports it $ longmessage = $ this -> GetArrayVal ( $ httpParsedResponseAr , "L_LONGMESSAGE0" ) ; // paypal prepends this to every message, so strip it out $ longmessage = str_replace ( "This%20transaction%20cannot%20be%20processed%2e" , "" , $ longmessage ) ; if ( $ longmessage != "" ) { // this will generally be the best description of the error $ errmsg .= $ longmessage ; } else { // paypal didn't give a simple error description so we have to try to decipher the gateway response // this is the response code from the gateway $ processor_code = $ this -> GetArrayVal ( $ httpParsedResponseAr , "L_ERRORPARAMVALUE0" ) ; if ( $ processor_code ) { // this will usually be "ProcessorResponse" in which case we don't need to display it $ processor_prefix = $ this -> GetArrayVal ( $ httpParsedResponseAr , "L_ERRORPARAMID0" ) ; $ processor_prefix = ( $ processor_prefix == "ProcessorResponse" ) ? '' : $ processor_prefix . ' - ' ; $ processor_message = $ processor_prefix . $ this -> getProcessorResponseDescription ( $ processor_code ) ; $ errmsg .= $ processor_message ; } } return urldecode ( $ errmsg ) ; }
Given a response array, attempt to return the most sensible error message.
@param array $httpParsedResponseAr
Given a response array attempt to return the most sensible error message .