Skip to content

Commit

Permalink
Update WC_Gateway_Payfull.php
Browse files Browse the repository at this point in the history
fix hash
  • Loading branch information
hazeem1991 committed Feb 15, 2019
1 parent b5348b9 commit 2c781dc
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions wp-content/plugins/payfull/src/WC_Gateway_Payfull.php
Expand Up @@ -487,26 +487,19 @@ public function payfull_check_payment_response()
wp_redirect($redirect_url);
}

protected function payfull_generateHash($params)
protected function payfull_generateHash($data)
{
$arr = [];
unset($params['hash']);
unset($data['hash']);

foreach($params as $param_key => $param_val) {
$arr[strtolower($param_key)] = $param_val;

}
ksort($arr);
$hashString_char_count = "";

foreach ($arr as $key => $val) {
$l = mb_strlen($val);
$hashString_char_count .= $l . $val;
$message = '';
ksort($data);
foreach($data as $key=>$value) {
$l = mb_strlen($value);
$message .= $l . $value;
}

$hashString_char_count = strtolower(hash_hmac("sha1", $hashString_char_count, $this->password));

return $hashString_char_count;
$hash = hash_hmac('sha256', $message, $this->password);
return $hash;
}

protected function payfull_processPaymentResponse($order, $response)
Expand Down

0 comments on commit 2c781dc

Please sign in to comment.