src/icepay_api_base.php
public function validate()
    {
        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
            $this->_logger->log("Invalid request method", Icepay_Api_Logger::ERROR);
            return false;
        };

        $this->_logger->log(sprintf("Postback: %s", serialize($_POST)), Icepay_Api_Logger::TRANSACTION);

        /* @since version 1.0.2 */
        foreach ($this->getPostbackResponseFields() as $obj => $param) {
            $this->data->$obj = (isset($_POST[$param])) ? $_POST[$param] : "";
        }

        if ($this->isVersionCheck())
            return false;

        if (!Icepay_Parameter_Validation::merchantID($this->data->merchant)) {
            $this->_logger->log("Merchant ID is not numeric: {$this->data->merchant}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if (!Icepay_Parameter_Validation::amount($this->data->amount)) {
            $this->_logger->log("Amount is not numeric: {$this->data->amount}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if ($this->_merchantID != $this->data->merchant) {
            $this->_logger->log("Invalid Merchant ID: {$this->data->merchant}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if (!in_array(strtoupper($this->data->status), array(
                    Icepay_StatusCode::OPEN,
                    Icepay_StatusCode::AUTHORIZED,
                    Icepay_StatusCode::SUCCESS,
                    Icepay_StatusCode::ERROR,
                    Icepay_StatusCode::REFUND,
                    Icepay_StatusCode::CHARGEBACK
                ))) {
            $this->_logger->log("Unknown status: {$this->data->status}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if ($this->generateChecksumForPostback() != $this->data->checksum) {
            $this->_logger->log("Checksum does not match", Icepay_Api_Logger::ERROR);
            return false;
        }
        return true;
    }
public function validate()
    {
        if ($_SERVER['REQUEST_METHOD'] != 'POST') {
            $this->_logger->log("Invalid request method", Icepay_Api_Logger::ERROR);
            return false;
        };

        $this->_logger->log(sprintf("Postback: %s", serialize($_POST)), Icepay_Api_Logger::TRANSACTION);

        /* @since version 1.0.2 */
        foreach ($this->getPostbackResponseFields() as $obj => $param) {
            $this->data->$obj = (isset($_POST[$param])) ? $_POST[$param] : "";
        }

        if ($this->isVersionCheck())
            return false;

        if (!Icepay_Parameter_Validation::merchantID($this->data->merchant)) {
            $this->_logger->log("Merchant ID is not numeric: {$this->data->merchant}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if (!Icepay_Parameter_Validation::amount($this->data->amount)) {
            $this->_logger->log("Amount is not numeric: {$this->data->amount}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if ($this->_merchantID != $this->data->merchant) {
            $this->_logger->log("Invalid Merchant ID: {$this->data->merchant}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if (!in_array(strtoupper($this->data->status), array(
                    Icepay_StatusCode::OPEN,
                    Icepay_StatusCode::AUTHORIZED,
                    Icepay_StatusCode::SUCCESS,
                    Icepay_StatusCode::ERROR,
                    Icepay_StatusCode::REFUND,
                    Icepay_StatusCode::CHARGEBACK
                ))) {
            $this->_logger->log("Unknown status: {$this->data->status}", Icepay_Api_Logger::ERROR);
            return false;
        }

        if ($this->generateChecksumForPostback() != $this->data->checksum) {
            $this->_logger->log("Checksum does not match", Icepay_Api_Logger::ERROR);
            return false;
        }
        return true;
    }
public function validate ( ) { if ( $ _SERVER [ 'REQUEST_METHOD' ] != 'POST' ) { $ this -> _logger -> log ( "Invalid request method" , Icepay_Api_Logger :: ERROR ) ; return false ; } ; $ this -> _logger -> log ( sprintf ( "Postback: %s" , serialize ( $ _POST ) ) , Icepay_Api_Logger :: TRANSACTION ) ; /* @since version 1.0.2 */ foreach ( $ this -> getPostbackResponseFields ( ) as $ obj => $ param ) { $ this -> data -> $ obj = ( isset ( $ _POST [ $ param ] ) ) ? $ _POST [ $ param ] : "" ; } if ( $ this -> isVersionCheck ( ) ) return false ; if ( ! Icepay_Parameter_Validation :: merchantID ( $ this -> data -> merchant ) ) { $ this -> _logger -> log ( "Merchant ID is not numeric: {$this->data->merchant}" , Icepay_Api_Logger :: ERROR ) ; return false ; } if ( ! Icepay_Parameter_Validation :: amount ( $ this -> data -> amount ) ) { $ this -> _logger -> log ( "Amount is not numeric: {$this->data->amount}" , Icepay_Api_Logger :: ERROR ) ; return false ; } if ( $ this -> _merchantID != $ this -> data -> merchant ) { $ this -> _logger -> log ( "Invalid Merchant ID: {$this->data->merchant}" , Icepay_Api_Logger :: ERROR ) ; return false ; } if ( ! in_array ( strtoupper ( $ this -> data -> status ) , array ( Icepay_StatusCode :: OPEN , Icepay_StatusCode :: AUTHORIZED , Icepay_StatusCode :: SUCCESS , Icepay_StatusCode :: ERROR , Icepay_StatusCode :: REFUND , Icepay_StatusCode :: CHARGEBACK ) ) ) { $ this -> _logger -> log ( "Unknown status: {$this->data->status}" , Icepay_Api_Logger :: ERROR ) ; return false ; } if ( $ this -> generateChecksumForPostback ( ) != $ this -> data -> checksum ) { $ this -> _logger -> log ( "Checksum does not match" , Icepay_Api_Logger :: ERROR ) ; return false ; } return true ; }
Validate the postback data
@since version 1.0.0
@access public
@return boolean
Validate the postback data