<?php
/**
 * File: Complete3DAuthRequest.php
 * Year: 2023
 */

namespace Tami\WooCommerce;
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if(!class_exists('\Tami\WooCommerce\Complete3DAuthRequest')) {
	class Complete3DAuthRequest extends PostAuthRequest {
		public function generateHash(
			$merchantId,
			$terminalId,
			$secretKey,
			$fixedKidValue,
			$fixedKValue
		): bool {
			$hashBody = [
				'orderId' => $this->orderId
			];

			if(!class_exists('Tami\WooCommerce\HashGenerator'))
				include TAMI_PLUGIN_PATH . '/lib/HashGenerator.php';

			$HashGenerator = new HashGenerator(
				$merchantId,
				$terminalId,
				$secretKey,
				$fixedKidValue,
				$fixedKValue
			);

			$hash = $HashGenerator->generateJWKSignature(
				$hashBody
			);

			$this->setSecurityHash($hash);
			return true;
		}
	}


}
