src/main/php/com-realexpayments-hpp-sdk/domain/HppRequest.php
public function hash( $secret ) {

		//check for any null values and set them to empty string for hashing
		$timeStamp        = null == $this->timeStamp ? "" : $this->timeStamp;
		$merchantId       = null == $this->merchantId ? "" : $this->merchantId;
		$orderId          = null == $this->orderId ? "" : $this->orderId;
		$amount           = null == $this->amount ? "" : $this->amount;
		$currency         = null == $this->currency ? "" : $this->currency;
		$payerReference   = null == $this->payerReference ? "" : $this->payerReference;
		$paymentReference = null == $this->paymentReference ? "" : $this->paymentReference;
		$hppSelectStoredCard = null == $this->hppSelectStoredCard ? "" : $this->hppSelectStoredCard;


        // Override payerRef with hppSelectStoredCard if present.
		$payRefORStoredCard =  empty($hppSelectStoredCard) ?  $payerReference : $hppSelectStoredCard;

        //create String to hash
		if ( $this->cardStorageEnable ) {
			$toHash = $timeStamp
				. "."
				. $merchantId
				. "."
				. $orderId
				. "."
				. $amount
				. "."
				. $currency
				. "."
				. $payerReference
				. "."
				. $paymentReference;
		} else	if ($payRefORStoredCard && empty($paymentReference) ) {
			$toHash = $timeStamp
			. "."
			. $merchantId
			. "."
			. $orderId
			. "."
			. $amount
			. "."
			. $currency
			. "."
			. $payRefORStoredCard
			. ".";

		} else	if ( $payRefORStoredCard && !empty($paymentReference) ) {
			$toHash = $timeStamp
			. "."
			. $merchantId
			. "."
			. $orderId
			. "."
			. $amount
			. "."
			. $currency
			. "."
			. $payRefORStoredCard
			. "."
			. $paymentReference;

		}else {
			$toHash = $timeStamp
				. "."
				. $merchantId
				. "."
				. $orderId
				. "."
				. $amount
				. "."
				. $currency;
		}

		$this->hash = GenerationUtils::generateHash( $toHash, $secret );

		return $this;

	}
public function hash( $secret ) {

		//check for any null values and set them to empty string for hashing
		$timeStamp        = null == $this->timeStamp ? "" : $this->timeStamp;
		$merchantId       = null == $this->merchantId ? "" : $this->merchantId;
		$orderId          = null == $this->orderId ? "" : $this->orderId;
		$amount           = null == $this->amount ? "" : $this->amount;
		$currency         = null == $this->currency ? "" : $this->currency;
		$payerReference   = null == $this->payerReference ? "" : $this->payerReference;
		$paymentReference = null == $this->paymentReference ? "" : $this->paymentReference;
		$hppSelectStoredCard = null == $this->hppSelectStoredCard ? "" : $this->hppSelectStoredCard;


        // Override payerRef with hppSelectStoredCard if present.
		$payRefORStoredCard =  empty($hppSelectStoredCard) ?  $payerReference : $hppSelectStoredCard;

        //create String to hash
		if ( $this->cardStorageEnable ) {
			$toHash = $timeStamp
				. "."
				. $merchantId
				. "."
				. $orderId
				. "."
				. $amount
				. "."
				. $currency
				. "."
				. $payerReference
				. "."
				. $paymentReference;
		} else	if ($payRefORStoredCard && empty($paymentReference) ) {
			$toHash = $timeStamp
			. "."
			. $merchantId
			. "."
			. $orderId
			. "."
			. $amount
			. "."
			. $currency
			. "."
			. $payRefORStoredCard
			. ".";

		} else	if ( $payRefORStoredCard && !empty($paymentReference) ) {
			$toHash = $timeStamp
			. "."
			. $merchantId
			. "."
			. $orderId
			. "."
			. $amount
			. "."
			. $currency
			. "."
			. $payRefORStoredCard
			. "."
			. $paymentReference;

		}else {
			$toHash = $timeStamp
				. "."
				. $merchantId
				. "."
				. $orderId
				. "."
				. $amount
				. "."
				. $currency;
		}

		$this->hash = GenerationUtils::generateHash( $toHash, $secret );

		return $this;

	}
Creates the security hash from a number of fields and the shared secret.

@param string $secret

@return HppRequest