We will work on Apr 26th (Saturday) and will be off from Apr 30th (Wednesday) until May 2nd (Friday) for public holiday in our country

Commit 2944c2c7 authored by Rik ter Beek's avatar Rik ter Beek

#61 send in extra data for openinvoice and fix result hmac calculation so it...

 #61 send in extra data for openinvoice and fix result hmac calculation so it alllow to have dots in the result params
parent d721a8bc
This diff is collapsed.
......@@ -262,17 +262,29 @@ class Result extends \Magento\Framework\App\Action\Action
protected function _authenticate($response) {
$hmacKey = $this->_adyenHelper->getHmac();
$merchantSigNotification = $response['merchantSig'];
// do it like this because $_GET is converting dot to underscore
$queryString = $_SERVER['QUERY_STRING'];
$result = [];
$pairs = explode("&", $queryString);
foreach ($pairs as $pair) {
$nv = explode("=", $pair);
$name = urldecode($nv[0]);
$value = urldecode($nv[1]);
$result[$name] = $value;
}
// do not include the merchantSig in the merchantSig calculation
$merchantSigNotification = $response['merchantSig'];
unset($response['merchantSig']);
unset($result['merchantSig']);
// Sort the array by key using SORT_STRING order
ksort($response, SORT_STRING);
ksort($result, SORT_STRING);
// Generate the signing data string
$signData = implode(":", array_map([$this, 'escapeString'],
array_merge(array_keys($response), array_values($response))));
array_merge(array_keys($result), array_values($result))));
$merchantSig = base64_encode(hash_hmac('sha256', $signData, pack("H*", $hmacKey), true));
......
......@@ -190,7 +190,19 @@ class Data extends AbstractHelper
break;
}
return number_format($amount, $format, '', '');
return (int)number_format($amount, $format, '', '');
}
/**
* Tax Percentage needs to be in minor units for Adyen
*
* @param float $taxPercent
* @return int
*/
public function getMinorUnitTaxPercent($taxPercent)
{
$taxPercent = $taxPercent * 100;
return (int)$taxPercent;
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment