src/Client.php
public function getResponse(Request $request, $maxTries = 3)
	{
		$request->validate();

		$response = $this->getProvider()
		                 ->getResponse($request, $canSafelyTryAgain);

		if ($canSafelyTryAgain) {
			if ($response->getTransactionReference() !== NULL) {
				if ($maxTries > 0) {
					$response = $this->getResponse($this->status($response->getTransactionReference()), $maxTries - 1);
				} else {
					throw new TransactionFailedException($request, $response, $maxTries);
				}
			} else {
				if ($maxTries > 0) {
					return $this->getResponse($request, $maxTries - 1);
				} else {
					throw new TransactionFailedException($request, $response, $maxTries);
				}
			}
		} else {
			if ($response->isCodeInProgress()) {
				if ($maxTries > 0) {
					if ($request->isTransactionTypeStatus()) {
						$response = $this->getResponse($request, $maxTries - 1);
					} else {
						$response = $this->getResponse($this->status($response->getTransactionReference()), $maxTries - 1);
					}
				} else {
					throw new TransactionInProgressException($request, $response, $maxTries);
				}
			}
		}

		return $response;
	}
public function getResponse(Request $request, $maxTries = 3)
	{
		$request->validate();

		$response = $this->getProvider()
		                 ->getResponse($request, $canSafelyTryAgain);

		if ($canSafelyTryAgain) {
			if ($response->getTransactionReference() !== NULL) {
				if ($maxTries > 0) {
					$response = $this->getResponse($this->status($response->getTransactionReference()), $maxTries - 1);
				} else {
					throw new TransactionFailedException($request, $response, $maxTries);
				}
			} else {
				if ($maxTries > 0) {
					return $this->getResponse($request, $maxTries - 1);
				} else {
					throw new TransactionFailedException($request, $response, $maxTries);
				}
			}
		} else {
			if ($response->isCodeInProgress()) {
				if ($maxTries > 0) {
					if ($request->isTransactionTypeStatus()) {
						$response = $this->getResponse($request, $maxTries - 1);
					} else {
						$response = $this->getResponse($this->status($response->getTransactionReference()), $maxTries - 1);
					}
				} else {
					throw new TransactionInProgressException($request, $response, $maxTries);
				}
			}
		}

		return $response;
	}
public function getResponse ( Request $ request , $ maxTries = 3 ) { $ request -> validate ( ) ; $ response = $ this -> getProvider ( ) -> getResponse ( $ request , $ canSafelyTryAgain ) ; if ( $ canSafelyTryAgain ) { if ( $ response -> getTransactionReference ( ) !== NULL ) { if ( $ maxTries > 0 ) { $ response = $ this -> getResponse ( $ this -> status ( $ response -> getTransactionReference ( ) ) , $ maxTries - 1 ) ; } else { throw new TransactionFailedException ( $ request , $ response , $ maxTries ) ; } } else { if ( $ maxTries > 0 ) { return $ this -> getResponse ( $ request , $ maxTries - 1 ) ; } else { throw new TransactionFailedException ( $ request , $ response , $ maxTries ) ; } } } else { if ( $ response -> isCodeInProgress ( ) ) { if ( $ maxTries > 0 ) { if ( $ request -> isTransactionTypeStatus ( ) ) { $ response = $ this -> getResponse ( $ request , $ maxTries - 1 ) ; } else { $ response = $ this -> getResponse ( $ this -> status ( $ response -> getTransactionReference ( ) ) , $ maxTries - 1 ) ; } } else { throw new TransactionInProgressException ( $ request , $ response , $ maxTries ) ; } } } return $ response ; }
Get a response for the given request, following the flow diagram provided by St.George.

@param \StGeorgeIPG\Request $request
@param integer              $maxTries

@return \StGeorgeIPG\Response
@throws \StGeorgeIPG\Exceptions\TransactionFailedException
@throws \StGeorgeIPG\Exceptions\TransactionInProgressException
Get a response for the given request following the flow diagram provided by St . George .