HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
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);
    }
}