<?php  namespace App\Services\Payments;  use App\Enums\Language;  class CorvusPayHandler { 	/** 	 * @var string 	 */ 	final public const HASH_ALGO = 'sha256';  	public static function generateFormSignature(string $orderId, float|int $amount, Language $language, array $extraData = []): string 	{ 		$data = [ 			'version' => setting('corvus_pay_api_version'), 			'store_id' => setting('corvus_pay_shop_id'), 			'currency' => setting('currency_code'), 			'language' => $language->value, 			'amount' => $amount, 			'order_number' => $orderId, 			'cart' => $orderId, 			'require_complete' => 'false', 			// ...$extraData, 		];  		return static::generateSignature($data); 	}  	public static function generateWebhookSignature(string $orderId, string $approvalCode, Language $language): string 	{ 		$data = [ 			'language' => $language->value, 			'order_number' => $orderId, 			'approval_code' => $approvalCode, 		];  		return static::generateSignature($data); 	}  	protected static function generateSignature(array $data): string 	{ 		ksort($data);  		foreach ($data as $key => &$value) { 			$value = $key . $value; 		}  		return hash_hmac(static::HASH_ALGO, implode('', $data), (string) setting('corvus_pay_secret_key')); 	} }