QuickBooks/MerchantService.php
protected function _doQBMS($type, $path, $xml, $CreditCard = null, $Transaction = null)
	{
		$errnum = QuickBooks_MerchantService::ERROR_OK;
		$errmsg = '';
		$response = $this->_request($xml, $errnum, $errmsg);
		
		if ($errnum)
		{
			$this->_setError(QuickBooks_MerchantService::ERROR_SOCKET, $errnum . ': ' . $errmsg);
			return false;
		}
		
		$signon_code = $this->_extractAttribute('statusCode', $response, 0);
		$signon_message = '';
		$signon_severity = $this->_extractAttribute('statusSeverity', $response, 0);
		
		if ($signon_code != QuickBooks_MerchantService::ERROR_OK)
		{
			$signon_message = $this->_extractAttribute('statusMessage', $response, 0);
		}
		
		$this->_log('SignOn (with session) response: ' . $signon_severity . '/' . $signon_code . ': ' . $signon_message, QUICKBOOKS_LOG_DEBUG);
		
		if ($signon_code != QuickBooks_MerchantService::ERROR_OK)
		{
			$this->_setError($signon_code, $signon_message);
			return false;
		}		
		
		$qbms_code = $this->_extractAttribute('statusCode', $response, 1);
		$qbms_message = $this->_extractAttribute('statusMessage', $response, 0);	// 0th instance, because QBMS doesn't return a statusMessage for the first sucessful request
		$qbms_severity = $this->_extractAttribute('statusSeverity', $response, 1);
		
		$this->_log('QBMS Response: ' . $qbms_severity . '/' . $qbms_code . ': ' . $qbms_message, QUICKBOOKS_LOG_DEBUG);
		
		//if ($qbms_code != QuickBooks_MerchantService::ERROR_OK)
		if (!$qbms_severity or $qbms_severity == QuickBooks_MerchantService::SEVERITY_ERROR)
		{
			$this->_setError($qbms_code, $qbms_message);
			return false;
		}
		else if ($qbms_severity == QuickBooks_MerchantService::SEVERITY_WARN)
		{
			$this->_setWarning($qbms_code, $qbms_message);
			// return false;		// DO NOT RETURN HERE (it's just a warning)
		}
		else if ($qbms_severity == QuickBooks_MerchantService::SEVERITY_INFO)
		{
			; // Do nothing...
		}
		else
		{
			// If we get here, something has gone really wrong... no statusSeverity code indicating pass/fail/warn was returned???
			$this->_setError(QuickBooks_MerchantService::ERROR_INTERNAL, 'Could not locate a statusSeverity="..." attribute in returned stream: ' . $response);
			return false;
		}
		
		// Create a transaction result 
		$xml_errnum = 0;
		$xml_errmsg = '';
		if ($NewTransaction = $this->_parseResponse($type, $path, $response, $xml_errnum, $xml_errmsg))
		{
			if ($CreditCard instanceof QuickBooks_MerchantService_CreditCard)
			{
				$NewTransaction->setExtraData(
					$qbms_code, 
					$qbms_message, 
					$CreditCard->getNumber(true), 
					$CreditCard->getExpirationMonth(), 
					$CreditCard->getExpirationYear(), 
					$CreditCard->getName(), 
					$CreditCard->getAddress(), 
					$CreditCard->getPostalCode());
			}
			else if ($Transaction instanceof QuickBooks_MerchantService_Transaction)
			{
				$tmp = $Transaction->toArray();

				$NewTransaction->setExtraData(
					$qbms_code, 
					$qbms_message, 
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_CreditCardNumber'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_ExpirationMonth'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_ExpirationYear'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_NameOnCard'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_CreditCardAddress'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_CreditCardPostalCode']
					);

				$NewTransaction->setAVSStreet($tmp['CreditCardTxnInfo_CreditCardTxnResultInfo_AVSStreet']);
				$NewTransaction->setAVSZip($tmp['CreditCardTxnInfo_CreditCardTxnResultInfo_AVSZip']);
				$NewTransaction->setCardSecurityCodeMatch($tmp['CreditCardTxnInfo_CreditCardTxnResultInfo_CardSecurityCodeMatch']);
			}
			
			return $NewTransaction;
		}
		
		$this->_setError(QuickBooks_MerchantService::ERROR_XML, $xml_errnum . ': ' . $xml_errmsg);
		return false;		
	}
protected function _doQBMS($type, $path, $xml, $CreditCard = null, $Transaction = null)
	{
		$errnum = QuickBooks_MerchantService::ERROR_OK;
		$errmsg = '';
		$response = $this->_request($xml, $errnum, $errmsg);
		
		if ($errnum)
		{
			$this->_setError(QuickBooks_MerchantService::ERROR_SOCKET, $errnum . ': ' . $errmsg);
			return false;
		}
		
		$signon_code = $this->_extractAttribute('statusCode', $response, 0);
		$signon_message = '';
		$signon_severity = $this->_extractAttribute('statusSeverity', $response, 0);
		
		if ($signon_code != QuickBooks_MerchantService::ERROR_OK)
		{
			$signon_message = $this->_extractAttribute('statusMessage', $response, 0);
		}
		
		$this->_log('SignOn (with session) response: ' . $signon_severity . '/' . $signon_code . ': ' . $signon_message, QUICKBOOKS_LOG_DEBUG);
		
		if ($signon_code != QuickBooks_MerchantService::ERROR_OK)
		{
			$this->_setError($signon_code, $signon_message);
			return false;
		}		
		
		$qbms_code = $this->_extractAttribute('statusCode', $response, 1);
		$qbms_message = $this->_extractAttribute('statusMessage', $response, 0);	// 0th instance, because QBMS doesn't return a statusMessage for the first sucessful request
		$qbms_severity = $this->_extractAttribute('statusSeverity', $response, 1);
		
		$this->_log('QBMS Response: ' . $qbms_severity . '/' . $qbms_code . ': ' . $qbms_message, QUICKBOOKS_LOG_DEBUG);
		
		//if ($qbms_code != QuickBooks_MerchantService::ERROR_OK)
		if (!$qbms_severity or $qbms_severity == QuickBooks_MerchantService::SEVERITY_ERROR)
		{
			$this->_setError($qbms_code, $qbms_message);
			return false;
		}
		else if ($qbms_severity == QuickBooks_MerchantService::SEVERITY_WARN)
		{
			$this->_setWarning($qbms_code, $qbms_message);
			// return false;		// DO NOT RETURN HERE (it's just a warning)
		}
		else if ($qbms_severity == QuickBooks_MerchantService::SEVERITY_INFO)
		{
			; // Do nothing...
		}
		else
		{
			// If we get here, something has gone really wrong... no statusSeverity code indicating pass/fail/warn was returned???
			$this->_setError(QuickBooks_MerchantService::ERROR_INTERNAL, 'Could not locate a statusSeverity="..." attribute in returned stream: ' . $response);
			return false;
		}
		
		// Create a transaction result 
		$xml_errnum = 0;
		$xml_errmsg = '';
		if ($NewTransaction = $this->_parseResponse($type, $path, $response, $xml_errnum, $xml_errmsg))
		{
			if ($CreditCard instanceof QuickBooks_MerchantService_CreditCard)
			{
				$NewTransaction->setExtraData(
					$qbms_code, 
					$qbms_message, 
					$CreditCard->getNumber(true), 
					$CreditCard->getExpirationMonth(), 
					$CreditCard->getExpirationYear(), 
					$CreditCard->getName(), 
					$CreditCard->getAddress(), 
					$CreditCard->getPostalCode());
			}
			else if ($Transaction instanceof QuickBooks_MerchantService_Transaction)
			{
				$tmp = $Transaction->toArray();

				$NewTransaction->setExtraData(
					$qbms_code, 
					$qbms_message, 
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_CreditCardNumber'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_ExpirationMonth'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_ExpirationYear'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_NameOnCard'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_CreditCardAddress'],
					$tmp['CreditCardTxnInfo_CreditCardTxnInputInfo_CreditCardPostalCode']
					);

				$NewTransaction->setAVSStreet($tmp['CreditCardTxnInfo_CreditCardTxnResultInfo_AVSStreet']);
				$NewTransaction->setAVSZip($tmp['CreditCardTxnInfo_CreditCardTxnResultInfo_AVSZip']);
				$NewTransaction->setCardSecurityCodeMatch($tmp['CreditCardTxnInfo_CreditCardTxnResultInfo_CardSecurityCodeMatch']);
			}
			
			return $NewTransaction;
		}
		
		$this->_setError(QuickBooks_MerchantService::ERROR_XML, $xml_errnum . ': ' . $xml_errmsg);
		return false;		
	}
Do a QuickBooks Merchant Service request and fetch the response

@param string $type
@param string $path
@param string $xml
@param object $Creditcard
@return QuickBooks_MerchantService_Transaction