public static function generateSignData(array $data, $algorithm = 'SHA-256', $merchantPosId = '', $signatureKey = '')
    {
        if (empty($signatureKey))
            throw new OpenPayU_Exception_Configuration('Merchant Signature Key should not be null or empty.');

        if (empty($merchantPosId))
            throw new OpenPayU_Exception_Configuration('MerchantPosId should not be null or empty.');

        $contentForSign = '';
        ksort($data);

        foreach ($data as $key => $value) {
            $contentForSign .= $key . '=' . urlencode($value) . '&';
        }

        if (in_array($algorithm, array('SHA-256', 'SHA'))) {
            $hashAlgorithm = 'sha256';
            $algorithm = 'SHA-256';
        } else if ($algorithm == 'SHA-384') {
            $hashAlgorithm = 'sha384';
            $algorithm = 'SHA-384';
        } else if ($algorithm == 'SHA-512') {
            $hashAlgorithm = 'sha512';
            $algorithm = 'SHA-512';
        }

        $signature = hash($hashAlgorithm, $contentForSign . $signatureKey);

        $signData = 'sender=' . $merchantPosId . ';algorithm=' . $algorithm . ';signature=' . $signature;

        return $signData;
    }
public static function generateSignData(array $data, $algorithm = 'SHA-256', $merchantPosId = '', $signatureKey = '')
    {
        if (empty($signatureKey))
            throw new OpenPayU_Exception_Configuration('Merchant Signature Key should not be null or empty.');

        if (empty($merchantPosId))
            throw new OpenPayU_Exception_Configuration('MerchantPosId should not be null or empty.');

        $contentForSign = '';
        ksort($data);

        foreach ($data as $key => $value) {
            $contentForSign .= $key . '=' . urlencode($value) . '&';
        }

        if (in_array($algorithm, array('SHA-256', 'SHA'))) {
            $hashAlgorithm = 'sha256';
            $algorithm = 'SHA-256';
        } else if ($algorithm == 'SHA-384') {
            $hashAlgorithm = 'sha384';
            $algorithm = 'SHA-384';
        } else if ($algorithm == 'SHA-512') {
            $hashAlgorithm = 'sha512';
            $algorithm = 'SHA-512';
        }

        $signature = hash($hashAlgorithm, $contentForSign . $signatureKey);

        $signData = 'sender=' . $merchantPosId . ';algorithm=' . $algorithm . ';signature=' . $signature;

        return $signData;
    }
public static function generateSignData ( array $ data , $ algorithm = 'SHA-256' , $ merchantPosId = '' , $ signatureKey = '' ) { if ( empty ( $ signatureKey ) ) throw new OpenPayU_Exception_Configuration ( 'Merchant Signature Key should not be null or empty.' ) ; if ( empty ( $ merchantPosId ) ) throw new OpenPayU_Exception_Configuration ( 'MerchantPosId should not be null or empty.' ) ; $ contentForSign = '' ; ksort ( $ data ) ; foreach ( $ data as $ key => $ value ) { $ contentForSign .= $ key . '=' . urlencode ( $ value ) . '&' ; } if ( in_array ( $ algorithm , array ( 'SHA-256' , 'SHA' ) ) ) { $ hashAlgorithm = 'sha256' ; $ algorithm = 'SHA-256' ; } else if ( $ algorithm == 'SHA-384' ) { $ hashAlgorithm = 'sha384' ; $ algorithm = 'SHA-384' ; } else if ( $ algorithm == 'SHA-512' ) { $ hashAlgorithm = 'sha512' ; $ algorithm = 'SHA-512' ; } $ signature = hash ( $ hashAlgorithm , $ contentForSign . $ signatureKey ) ; $ signData = 'sender=' . $ merchantPosId . ';algorithm=' . $ algorithm . ';signature=' . $ signature ; return $ signData ; }
Function generate sign data

@param array $data
@param string $algorithm
@param string $merchantPosId
@param string $signatureKey

@return string

@throws OpenPayU_Exception_Configuration
Function generate sign data