public function checkNotificationSignature($signature, array $notificationBody, $merchantSecret)
    {
        // Preset required fields.
        $notificationBody = array_replace_recursive(
            [
                'bill' => [
                    'billId' => null,
                    'amount' => [
                        'value'    => null,
                        'currency' => null,
                    ],
                    'siteId' => null,
                    'status' => ['value' => null],
                ],
            ],
            $notificationBody
        );

        $processedNotificationData = [
            'billId'          => (string) $notificationBody['bill']['billId'],
            'amount.value'    => $this->normalizeAmount($notificationBody['bill']['amount']['value']),
            'amount.currency' => (string) $notificationBody['bill']['amount']['currency'],
            'siteId'          => (string) $notificationBody['bill']['siteId'],
            'status'          => (string) $notificationBody['bill']['status']['value'],
        ];
        ksort($processedNotificationData);
        $processedNotificationDataKeys = join(self::VALUE_SEPARATOR, $processedNotificationData);
        $hash = hash_hmac(self::DEFAULT_ALGORITHM, $processedNotificationDataKeys, $merchantSecret);

        return $hash === $signature;

    }
public function checkNotificationSignature($signature, array $notificationBody, $merchantSecret)
    {
        // Preset required fields.
        $notificationBody = array_replace_recursive(
            [
                'bill' => [
                    'billId' => null,
                    'amount' => [
                        'value'    => null,
                        'currency' => null,
                    ],
                    'siteId' => null,
                    'status' => ['value' => null],
                ],
            ],
            $notificationBody
        );

        $processedNotificationData = [
            'billId'          => (string) $notificationBody['bill']['billId'],
            'amount.value'    => $this->normalizeAmount($notificationBody['bill']['amount']['value']),
            'amount.currency' => (string) $notificationBody['bill']['amount']['currency'],
            'siteId'          => (string) $notificationBody['bill']['siteId'],
            'status'          => (string) $notificationBody['bill']['status']['value'],
        ];
        ksort($processedNotificationData);
        $processedNotificationDataKeys = join(self::VALUE_SEPARATOR, $processedNotificationData);
        $hash = hash_hmac(self::DEFAULT_ALGORITHM, $processedNotificationDataKeys, $merchantSecret);

        return $hash === $signature;

    }
public function checkNotificationSignature ( $ signature , array $ notificationBody , $ merchantSecret ) { // Preset required fields. $ notificationBody = array_replace_recursive ( [ 'bill' => [ 'billId' => null , 'amount' => [ 'value' => null , 'currency' => null , ] , 'siteId' => null , 'status' => [ 'value' => null ] , ] , ] , $ notificationBody ) ; $ processedNotificationData = [ 'billId' => ( string ) $ notificationBody [ 'bill' ] [ 'billId' ] , 'amount.value' => $ this -> normalizeAmount ( $ notificationBody [ 'bill' ] [ 'amount' ] [ 'value' ] ) , 'amount.currency' => ( string ) $ notificationBody [ 'bill' ] [ 'amount' ] [ 'currency' ] , 'siteId' => ( string ) $ notificationBody [ 'bill' ] [ 'siteId' ] , 'status' => ( string ) $ notificationBody [ 'bill' ] [ 'status' ] [ 'value' ] , ] ; ksort ( $ processedNotificationData ) ; $ processedNotificationDataKeys = join ( self :: VALUE_SEPARATOR , $ processedNotificationData ) ; $ hash = hash_hmac ( self :: DEFAULT_ALGORITHM , $ processedNotificationDataKeys , $ merchantSecret ) ; return $ hash === $ signature ; }
Checks notification data signature.

@param string       $signature        The signature.
@param object|array $notificationBody The notification body.
@param string       $merchantSecret   The merchant key for validating signature.

@return bool Signature is valid or not.
Checks notification data signature .