File: D:/HostingSpaces/SBogers10/topswtw.komma.pro/app/KommaApp/Shop/Checkout/Payment/ShaSign.php
<?php
namespace KommaApp\Shop\Checkout\Payment;
use Illuminate\Config\Repository;
class ShaSign
{
private $passPhrase;
public function __construct(Repository $config)
{
$this->passPhrase = $config->get('komma/ingenico.shaSign.passPhrase');
}
public function create($array)
{
// Concert keys to uppercasein
$array = array_change_key_case($array, CASE_UPPER);
// Sort properties
$properties = array_keys($array);
asort($properties);
// Create string
$shaString = '';
foreach($properties as $property)
{
// Don't include SHASIGN property or empty values
if( $property != 'SHASIGN' && $array[$property] != '')
{
// Add property=value
$shaString .= $property . '=' . $array[$property];
// Add pass phrase
$shaString .= $this->passPhrase;
}
}
// Create hash
$hash = hash('sha1',$shaString);
// Return an uppercase hash
return strtoupper($hash);
}
}