Penambahan thema pada Menu Laporan per pintu pos

This commit is contained in:
pand03
2026-04-16 17:38:48 +07:00
parent 67f6604f89
commit c73adb3c6b
8 changed files with 652 additions and 118 deletions

View File

@@ -0,0 +1,42 @@
<?php
namespace Tests\Unit;
use Tests\TestCase;
use App\Services\BcaSignatureService;
class BcaSignatureTest extends TestCase
{
public function test_generate_signature()
{
$service = new BcaSignatureService();
$method = 'POST';
$relativeUrl = '/test/api';
$accessToken = 'dummy_token';
$timestamp = '2026-04-10T10:00:00.000+07:00';
$apiSecret = 'secret123';
$body = json_encode([
"foo" => "bar"
]);
$result = $service->generateSignature(
$method,
$relativeUrl,
$accessToken,
$body,
$timestamp,
$apiSecret
);
// Expected manual
$expected = hash_hmac(
'sha256',
'POST:/test/api:dummy_token:' . hash('sha256', $body) . ':' . $timestamp,
$apiSecret
);
$this->assertEquals($expected, $result);
}
}