简体   繁体   English

错误代码108 ccavenue

[英]error code 108 ccavenue

i am integrating ccavenue with my ecommerce site. 我正在将ccavenue与我的电子商务网站集成。 in some cases, i am getting this error: Error Code: 108 Error Description: Checksum+mismatch. 在某些情况下,我会收到此错误:错误代码:108错误描述:Checksum + mismatch。

How to rectify this one?Can anybody help me 如何纠正这一问题?有人可以帮助我吗?

I solved this problem.. The checksum was indeed incorrect. 我解决了这个问题。校验和确实不正确。 I was hard coding at the last instant the amount to be Rs. 我在最后一刻硬编码了Rs。 10 to test the integration.. but the checksum I calculated with the actual amount. 10来测试积分..但是我用实际金额计算了校验和。 Hence the incorrect checksum! 因此,错误的校验和! Hope this helps someone. 希望这对某人有帮助。

检查ccavenue的商户密钥,它在每次重新生成时都会更改,并且还会检查算法以进行校验和计算

if you are using the free code provided for integrating ccavenues with joomla , in the file ps_ccavenues_info_part.php the amount is rounded off after calculating the checksum. 如果您正在使用提供的免费代码将ccavenuejoomla集成在一起,则在文件ps_ccavenues_info_part.php ,在计算校验和后将其四舍五入。

I modified the code so the amount is rounded off before calculating the checksum and this fixed it for me. 我修改了代码,以便在计算校验和之前将金额四舍五入,这对我来说是固定的。

Try replacing your function file provided in the CCAvenue kit with this one: 尝试用以下工具替换CCAvenue套件中提供的功能文件:

<?php

function getchecksum($MerchantId,$Amount,$OrderId ,$URL,$WorkingKey)
{
    $str ="$MerchantId|$OrderId|$Amount|$URL|$WorkingKey";
    $adler = 1;
    $adler = adler32($adler,$str);
    return $adler;
}

function verifychecksum($MerchantId,$OrderId,$Amount,$AuthDesc,$CheckSum,$WorkingKey)
{
    $str = "$MerchantId|$OrderId|$Amount|$AuthDesc|$WorkingKey";
    $adler = 1;
    $adler = adler32($adler,$str);

    if($adler == $CheckSum)
        return "true" ;
    else
        return "false" ;
}

function adler32($adler , $str)
{
    $BASE =  65521 ;

    $s1 = $adler & 0xffff ;
    $s2 = ($adler >> 16) & 0xffff;
    for($i = 0 ; $i < strlen($str) ; $i++)
    {
        $s1 = ($s1 + Ord($str[$i])) % $BASE ;
        $s2 = ($s2 + $s1) % $BASE ;
            //echo "s1 : $s1 <BR> s2 : $s2 <BR>";

    }
    return leftshift($s2 , 16) + $s1;
}

function leftshift($str , $num)
{

    $str = DecBin($str);

    for( $i = 0 ; $i < (64 - strlen($str)) ; $i++)
        $str = "0".$str ;

    for($i = 0 ; $i < $num ; $i++) 
    {
        $str = $str."0";
        $str = substr($str , 1 ) ;
        //echo "str : $str <BR>";
    }
    return cdec($str) ;
}

function cdec($num)
{

    for ($n = 0 ; $n < strlen($num) ; $n++)
    {
       $temp = $num[$n] ;
       $dec =  $dec + $temp*pow(2 , strlen($num) - $n - 1);
    }

    return $dec;
}
?>

I have found the issue and that is the URL. 我发现了问题,那就是URL。 It will work, If your Redirect URL will not have any params. 如果您的重定向URL没有任何参数,它将起作用。

For solving this issue. 为了解决这个问题。 You will have to encode your URL via urlencode function in PHP. 您将必须通过PHP中的urlencode函数对URL进行编码。

$url= urlencode($url);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM