Skip to content

Commit

Permalink
update new checksum version
Browse files Browse the repository at this point in the history
  • Loading branch information
LalitChaudhary1 committed May 28, 2020
1 parent dd49cfe commit aae256f
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 539 deletions.
7 changes: 5 additions & 2 deletions checksum_v2/PaytmChecksum.php → PaytmChecksum.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author Lalit Kumar
* @version 2.0
* @link https://developer.paytm.com/docs/checksum/
* @link https://developer.paytm.com/docs/checksum/#php
*/

class PaytmChecksum{
Expand Down Expand Up @@ -63,6 +63,9 @@ static public function verifySignature($params, $key, $checksum){
if(!is_array($params) && !is_string($params)){
throw new Exception("string or array expected, ".gettype($params)." given");
}
if(isset($params['CHECKSUMHASH'])){
unset($params['CHECKSUMHASH']);
}
if(is_array($params)){
$params = self::getStringByParams($params);
}
Expand Down Expand Up @@ -96,7 +99,7 @@ static private function generateRandomString($length) {
static private function getStringByParams($params) {
ksort($params);
$params = array_map(function ($value){
return ($value == null) ? "" : $value;
return ($value !== null && strtolower($value) !== "null") ? $value : "";
}, $params);
return implode("|", $params);
}
Expand Down
11 changes: 0 additions & 11 deletions checksum_v1/README.md

This file was deleted.

44 changes: 0 additions & 44 deletions checksum_v1/generateChecksum.php

This file was deleted.

4 changes: 0 additions & 4 deletions checksum_v1/lib/config_paytm.php

This file was deleted.

251 changes: 0 additions & 251 deletions checksum_v1/lib/encdec_paytm.php

This file was deleted.

52 changes: 0 additions & 52 deletions checksum_v1/verifyChecksum.php

This file was deleted.

Loading

0 comments on commit aae256f

Please sign in to comment.