src/Request.php
public function validate()
	{
		$this->validateAttributes([
			Request::ATTRIBUTE_INTERFACE,
			Request::ATTRIBUTE_TRANSACTION_TYPE,
		]);

		$transactionType = $this->getTransactionType();

		switch ($transactionType) {
			case Request::TRANSACTION_TYPE_PURCHASE:
			case Request::TRANSACTION_TYPE_PRE_AUTH: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
				], [
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTHORISATION_CODE,
					Request::ATTRIBUTE_AUTHORISATION_NUMBER,
				]);

				break;
			}

			case Request::TRANSACTION_TYPE_REFUND: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
				], [
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTHORISATION_CODE,
					Request::ATTRIBUTE_AUTHORISATION_NUMBER,
				]);

				break;
			}

			case Request::TRANSACTION_TYPE_COMPLETION: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					[
						Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
						Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					],
					[
						Request::ATTRIBUTE_AUTH_CODE,
						Request::ATTRIBUTE_AUTH_NUMBER,
						Request::ATTRIBUTE_AUTHORISATION_CODE,
						Request::ATTRIBUTE_AUTHORISATION_NUMBER,
					],
				], [
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
				]);

				break;
			}

			case Request::TRANSACTION_TYPE_STATUS: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
				], [
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					Request::ATTRIBUTE_TAX_AMOUNT,
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
					Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTH_CODE,
					Request::ATTRIBUTE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTHORISATION_CODE,
					Request::ATTRIBUTE_AUTHORISATION_NUMBER,
					Request::ATTRIBUTE_CLIENT_REFERENCE,
					Request::ATTRIBUTE_COMMENT,
					Request::ATTRIBUTE_MERCHANT_CARD_HOLDER_NAME,
					Request::ATTRIBUTE_MERCHANT_DESCRIPTION,
					Request::ATTRIBUTE_TERMINAL_TYPE,
					Request::ATTRIBUTE_CVC2,
				]);

				break;
			}
		}

		return TRUE;
	}
public function validate()
	{
		$this->validateAttributes([
			Request::ATTRIBUTE_INTERFACE,
			Request::ATTRIBUTE_TRANSACTION_TYPE,
		]);

		$transactionType = $this->getTransactionType();

		switch ($transactionType) {
			case Request::TRANSACTION_TYPE_PURCHASE:
			case Request::TRANSACTION_TYPE_PRE_AUTH: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
				], [
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTHORISATION_CODE,
					Request::ATTRIBUTE_AUTHORISATION_NUMBER,
				]);

				break;
			}

			case Request::TRANSACTION_TYPE_REFUND: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
				], [
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTHORISATION_CODE,
					Request::ATTRIBUTE_AUTHORISATION_NUMBER,
				]);

				break;
			}

			case Request::TRANSACTION_TYPE_COMPLETION: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					[
						Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
						Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					],
					[
						Request::ATTRIBUTE_AUTH_CODE,
						Request::ATTRIBUTE_AUTH_NUMBER,
						Request::ATTRIBUTE_AUTHORISATION_CODE,
						Request::ATTRIBUTE_AUTHORISATION_NUMBER,
					],
				], [
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
				]);

				break;
			}

			case Request::TRANSACTION_TYPE_STATUS: {
				$this->validateAttributes([
					Request::ATTRIBUTE_TRANSACTION_REFERENCE,
				], [
					Request::ATTRIBUTE_TOTAL_AMOUNT,
					Request::ATTRIBUTE_TAX_AMOUNT,
					Request::ATTRIBUTE_CARD_DATA,
					Request::ATTRIBUTE_CARD_EXPIRY_DATE,
					Request::ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE,
					Request::ATTRIBUTE_PRE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTH_CODE,
					Request::ATTRIBUTE_AUTH_NUMBER,
					Request::ATTRIBUTE_AUTHORISATION_CODE,
					Request::ATTRIBUTE_AUTHORISATION_NUMBER,
					Request::ATTRIBUTE_CLIENT_REFERENCE,
					Request::ATTRIBUTE_COMMENT,
					Request::ATTRIBUTE_MERCHANT_CARD_HOLDER_NAME,
					Request::ATTRIBUTE_MERCHANT_DESCRIPTION,
					Request::ATTRIBUTE_TERMINAL_TYPE,
					Request::ATTRIBUTE_CVC2,
				]);

				break;
			}
		}

		return TRUE;
	}
public function validate ( ) { $ this -> validateAttributes ( [ Request :: ATTRIBUTE_INTERFACE , Request :: ATTRIBUTE_TRANSACTION_TYPE , ] ) ; $ transactionType = $ this -> getTransactionType ( ) ; switch ( $ transactionType ) { case Request :: TRANSACTION_TYPE_PURCHASE : case Request :: TRANSACTION_TYPE_PRE_AUTH : { $ this -> validateAttributes ( [ Request :: ATTRIBUTE_TOTAL_AMOUNT , Request :: ATTRIBUTE_CARD_DATA , Request :: ATTRIBUTE_CARD_EXPIRY_DATE , ] , [ Request :: ATTRIBUTE_TRANSACTION_REFERENCE , Request :: ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE , Request :: ATTRIBUTE_PRE_AUTH_NUMBER , Request :: ATTRIBUTE_AUTH_NUMBER , Request :: ATTRIBUTE_AUTHORISATION_CODE , Request :: ATTRIBUTE_AUTHORISATION_NUMBER , ] ) ; break ; } case Request :: TRANSACTION_TYPE_REFUND : { $ this -> validateAttributes ( [ Request :: ATTRIBUTE_TOTAL_AMOUNT , Request :: ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE , ] , [ Request :: ATTRIBUTE_CARD_DATA , Request :: ATTRIBUTE_CARD_EXPIRY_DATE , Request :: ATTRIBUTE_TRANSACTION_REFERENCE , Request :: ATTRIBUTE_PRE_AUTH_NUMBER , Request :: ATTRIBUTE_AUTH_NUMBER , Request :: ATTRIBUTE_AUTHORISATION_CODE , Request :: ATTRIBUTE_AUTHORISATION_NUMBER , ] ) ; break ; } case Request :: TRANSACTION_TYPE_COMPLETION : { $ this -> validateAttributes ( [ Request :: ATTRIBUTE_TOTAL_AMOUNT , [ Request :: ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE , Request :: ATTRIBUTE_PRE_AUTH_NUMBER , ] , [ Request :: ATTRIBUTE_AUTH_CODE , Request :: ATTRIBUTE_AUTH_NUMBER , Request :: ATTRIBUTE_AUTHORISATION_CODE , Request :: ATTRIBUTE_AUTHORISATION_NUMBER , ] , ] , [ Request :: ATTRIBUTE_CARD_DATA , Request :: ATTRIBUTE_CARD_EXPIRY_DATE , Request :: ATTRIBUTE_TRANSACTION_REFERENCE , ] ) ; break ; } case Request :: TRANSACTION_TYPE_STATUS : { $ this -> validateAttributes ( [ Request :: ATTRIBUTE_TRANSACTION_REFERENCE , ] , [ Request :: ATTRIBUTE_TOTAL_AMOUNT , Request :: ATTRIBUTE_TAX_AMOUNT , Request :: ATTRIBUTE_CARD_DATA , Request :: ATTRIBUTE_CARD_EXPIRY_DATE , Request :: ATTRIBUTE_ORIGINAL_TRANSACTION_REFERENCE , Request :: ATTRIBUTE_PRE_AUTH_NUMBER , Request :: ATTRIBUTE_AUTH_CODE , Request :: ATTRIBUTE_AUTH_NUMBER , Request :: ATTRIBUTE_AUTHORISATION_CODE , Request :: ATTRIBUTE_AUTHORISATION_NUMBER , Request :: ATTRIBUTE_CLIENT_REFERENCE , Request :: ATTRIBUTE_COMMENT , Request :: ATTRIBUTE_MERCHANT_CARD_HOLDER_NAME , Request :: ATTRIBUTE_MERCHANT_DESCRIPTION , Request :: ATTRIBUTE_TERMINAL_TYPE , Request :: ATTRIBUTE_CVC2 , ] ) ; break ; } } return TRUE ; }
Validates the request attributes based on the transaction type, and the rules specified by St.George.

@return boolean
@throws \StGeorgeIPG\Exceptions\InvalidAttributeValueException
Validates the request attributes based on the transaction type and the rules specified by St . George .