From a648aa321314c842d7d7cfa5cbb7ecb72d22c24b Mon Sep 17 00:00:00 2001 From: Joanhey Date: Wed, 2 Mar 2022 23:03:00 +0100 Subject: [PATCH 1/2] Fix and clean url query generator --- class/paycomet_bankstore.php | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/class/paycomet_bankstore.php b/class/paycomet_bankstore.php index b568809..f9ddd8b 100644 --- a/class/paycomet_bankstore.php +++ b/class/paycomet_bankstore.php @@ -1752,27 +1752,10 @@ private function ComposeURLParams($operationdata, $operationtype) } } - $content = ""; - foreach ($data as $key => $value) { - if ($content != "") { - $content .= "&"; - } - - $content .= urlencode($key) . "=" . urlencode($value); - } - - $data["VHASH"] = hash('sha512', md5($content.md5($this->password))); - - $secureurlhash = ""; - foreach ($data as $key => $value) { - if ($secureurlhash != "") { - $secureurlhash .= "&"; - } - - $secureurlhash .= urlencode($key) . "=" . urlencode($value); - } + $content = http_build_query($data); + $VHASH = hash('sha512', md5($content.md5($this->password))); - return $secureurlhash; + return $content."&VHASH=$VHASH"; } /** From 8a533ab18cbfd2dbfe86216e7ba55f1bee255bcc Mon Sep 17 00:00:00 2001 From: Joanhey Date: Thu, 3 Mar 2022 01:07:11 +0100 Subject: [PATCH 2/2] Delete unnecessary variable $secureurlhash --- class/paycomet_bankstore.php | 1 - 1 file changed, 1 deletion(-) diff --git a/class/paycomet_bankstore.php b/class/paycomet_bankstore.php index f9ddd8b..b2adabd 100644 --- a/class/paycomet_bankstore.php +++ b/class/paycomet_bankstore.php @@ -1591,7 +1591,6 @@ private function GenerateHash($operationdata, $operationtype) */ private function ComposeURLParams($operationdata, $operationtype) { - $secureurlhash = false; $data = array(); $data["MERCHANT_MERCHANTCODE"] = $this->merchantCode;