function receiveReturningCustomer($input = null) {

		$returnDataNames = array(
			"payId",
			"dttm",
			"resultCode",
			"resultMessage",
			"paymentStatus",
			"?authCode",
			"merchantData",
			// "signature"
		);

		if (!$input) {
			if (isset($_GET["payId"])) $input = $_GET;
			elseif (isset($_POST["payId"])) $input = $_POST;
		}

		if (!$input) {
			return null;
		}

		$this->writeToTraceLog("Received data from returning customer: ".str_replace("\n", " ", print_r($input, true)));

		$nullFields = array_fill_keys($returnDataNames, null);
		$input += $nullFields;

		$signatureOk = $this->verifyResponseSignature($input, $input["signature"], $returnDataNames);

		if (!$signatureOk) {
			$this->writeToTraceLog("Signature is invalid.");
			$this->writeToLog("Returning customer: payId $input[payId], has invalid signature.");
			throw new Exception("Signature is invalid.");
		}

		$merch = @base64_decode($input["merchantData"]);
		if ($merch) {
			$input["merchantData"] = $merch;
		}

		$mess = "Returning customer: payId ".$input["payId"].", authCode " . (isset($input["authCode"]) ? $input["authCode"] : '(not set)') . ", payment status ".$input["paymentStatus"];
		if ($input["merchantData"]) {
			$mess .= ", merchantData ".$input["merchantData"];
		}
		$this->writeToLog($mess);

		return $input;

	}
function receiveReturningCustomer($input = null) {

		$returnDataNames = array(
			"payId",
			"dttm",
			"resultCode",
			"resultMessage",
			"paymentStatus",
			"?authCode",
			"merchantData",
			// "signature"
		);

		if (!$input) {
			if (isset($_GET["payId"])) $input = $_GET;
			elseif (isset($_POST["payId"])) $input = $_POST;
		}

		if (!$input) {
			return null;
		}

		$this->writeToTraceLog("Received data from returning customer: ".str_replace("\n", " ", print_r($input, true)));

		$nullFields = array_fill_keys($returnDataNames, null);
		$input += $nullFields;

		$signatureOk = $this->verifyResponseSignature($input, $input["signature"], $returnDataNames);

		if (!$signatureOk) {
			$this->writeToTraceLog("Signature is invalid.");
			$this->writeToLog("Returning customer: payId $input[payId], has invalid signature.");
			throw new Exception("Signature is invalid.");
		}

		$merch = @base64_decode($input["merchantData"]);
		if ($merch) {
			$input["merchantData"] = $merch;
		}

		$mess = "Returning customer: payId ".$input["payId"].", authCode " . (isset($input["authCode"]) ? $input["authCode"] : '(not set)') . ", payment status ".$input["paymentStatus"];
		if ($input["merchantData"]) {
			$mess .= ", merchantData ".$input["merchantData"];
		}
		$this->writeToLog($mess);

		return $input;

	}
function receiveReturningCustomer ( $ input = null ) { $ returnDataNames = array ( "payId" , "dttm" , "resultCode" , "resultMessage" , "paymentStatus" , "?authCode" , "merchantData" , // "signature" ) ; if ( ! $ input ) { if ( isset ( $ _GET [ "payId" ] ) ) $ input = $ _GET ; elseif ( isset ( $ _POST [ "payId" ] ) ) $ input = $ _POST ; } if ( ! $ input ) { return null ; } $ this -> writeToTraceLog ( "Received data from returning customer: " . str_replace ( "\n" , " " , print_r ( $ input , true ) ) ) ; $ nullFields = array_fill_keys ( $ returnDataNames , null ) ; $ input += $ nullFields ; $ signatureOk = $ this -> verifyResponseSignature ( $ input , $ input [ "signature" ] , $ returnDataNames ) ; if ( ! $ signatureOk ) { $ this -> writeToTraceLog ( "Signature is invalid." ) ; $ this -> writeToLog ( "Returning customer: payId $input[payId], has invalid signature." ) ; throw new Exception ( "Signature is invalid." ) ; } $ merch = @ base64_decode ( $ input [ "merchantData" ] ) ; if ( $ merch ) { $ input [ "merchantData" ] = $ merch ; } $ mess = "Returning customer: payId " . $ input [ "payId" ] . ", authCode " . ( isset ( $ input [ "authCode" ] ) ? $ input [ "authCode" ] : '(not set)' ) . ", payment status " . $ input [ "paymentStatus" ] ; if ( $ input [ "merchantData" ] ) { $ mess .= ", merchantData " . $ input [ "merchantData" ] ; } $ this -> writeToLog ( $ mess ) ; return $ input ; }
Processes the data that are sent together with customer when he
returns back from payment gateway.

Call this method on your returnUrl to extract all data from request,
validate signature, decode merchant data from base64 and return
it all as an array. Method automatically reads data from GET or POST.


@param array|null $input If return data is not in GET or POST, supply
your own array with accordingly named variables.
@return array|null Array with received data or null if no data is present.
@throws Exception When data is present but signature is incorrect.
Processes the data that are sent together with customer when he returns back from payment gateway .