From c73adb3c6b6792d379eda93f2e6232744c6533c3 Mon Sep 17 00:00:00 2001 From: pand03 Date: Thu, 16 Apr 2026 17:38:48 +0700 Subject: [PATCH] Penambahan thema pada Menu Laporan per pintu pos --- app/.DS_Store | Bin 0 -> 6148 bytes app/Http/Controllers/SetupController.php | 18 +- app/Services/BcaServices.php | 69 +++ app/Services/BcaSignatureService.php | 102 +++++ public/css/style.css | 23 + resources/views/report/by-gate.blade.php | 513 ++++++++++++++++++----- routes/web.php | 3 + tests/Unit/BcaSignatureTest.php | 42 ++ 8 files changed, 652 insertions(+), 118 deletions(-) create mode 100644 app/.DS_Store create mode 100644 app/Services/BcaServices.php create mode 100644 app/Services/BcaSignatureService.php create mode 100644 tests/Unit/BcaSignatureTest.php diff --git a/app/.DS_Store b/app/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c0358326c0945612bfa1aa5b7ba728b68f3c2cb0 GIT binary patch literal 6148 zcmeHKOKQVF43*j}4Bcdzs)YU!ahb5(qB1)N8MLt{kmTA3}rOO(C1`1k#() z=#BAPSeA%r`*nC0*@{R5HmI_b-DnJFO02TO`0@izB%~K#F6`%rC;G%$i9}3*CCeDHW=|J!i0JuTg z4QrnzfW;EPnm7j{1Jj@agQ_`VXwZ=_SyvP1z@Urf@S*u+%?U;Q>A1gmxo8b!qykjn zT7k#dZms{n!2g*4uSwid0V;4;3h1WmyB4pMy>;<&)@uv=6>c?WxEam?0H` literal 0 HcmV?d00001 diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index ca398ad..62ff4d7 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -89,13 +89,19 @@ public function run() private function checkPgcrypto() { - $result = DB::select(" - SELECT 1 - FROM pg_extension - WHERE extname = 'pgcrypto' - "); + // $result = DB::select(" + // SELECT 1 + // FROM pg_extension + // WHERE extname = 'pgcrypto' + // "); - return !empty($result); + // return !empty($result); + try { + DB::select("SELECT digest('test','sha1')"); + return true; + } catch (\Exception $e) { + return false; + } } private function checkPegawaiColumns() diff --git a/app/Services/BcaServices.php b/app/Services/BcaServices.php new file mode 100644 index 0000000..2348d92 --- /dev/null +++ b/app/Services/BcaServices.php @@ -0,0 +1,69 @@ +apiKey = env('BCA_API_KEY'); + $this->apiSecret = env('BCA_API_SECRET'); + } + + public function getAccessToken() + { + $response = Http::asForm() + ->withBasicAuth($this->apiKey, $this->apiSecret) + ->post($this->baseUrl . '/api/oauth/token', [ + 'grant_type' => 'client_credentials' + ]); + + return $response->json()['access_token']; + } + + private function generateSignature($method, $relativeUrl, $token, $body, $timestamp) + { + $bodyHash = hash('sha256', $body); + + $stringToSign = strtoupper($method) . ':' . + $relativeUrl . ':' . + $token . ':' . + strtolower($bodyHash) . ':' . + $timestamp; + + return hash_hmac('sha256', $stringToSign, $this->apiSecret); + } + + public function getAccount($corporateId, $accountNumber) + { + $token = $this->getAccessToken(); + + $method = 'GET'; + $relativeUrl = "/banking/v3/corporates/$corporateId/accounts/$accountNumber"; + $timestamp = now()->format('Y-m-d\TH:i:s.vP'); + $body = ''; + + $signature = $this->generateSignature( + $method, + $relativeUrl, + $token, + $body, + $timestamp + ); + + $response = Http::withHeaders([ + 'Authorization' => 'Bearer ' . $token, + 'X-BCA-Key' => $this->apiKey, + 'X-BCA-Timestamp' => $timestamp, + 'X-BCA-Signature' => $signature, + ])->get($this->baseUrl . $relativeUrl); + + return $response->json(); + } +} \ No newline at end of file diff --git a/app/Services/BcaSignatureService.php b/app/Services/BcaSignatureService.php new file mode 100644 index 0000000..9b432e1 --- /dev/null +++ b/app/Services/BcaSignatureService.php @@ -0,0 +1,102 @@ + "bar" + // ]); + + // $signature = $this->generateSignature( + // $method, + // $relativeUrl, + // $accessToken, + // $body, + // $timestamp, + // $apiSecret + // ); + + // // Expected manual calculation (hardcode hasil dari tool / Postman) + // $expected = hash_hmac('sha256', + // 'POST:/test/api:dummy_token:' . hash('sha256', $body) . ':' . $timestamp, + // $apiSecret + // ); + + // $this->assertEquals($expected, $signature); + // } + + // public function test_generate_signature_get_empty_body() + // { + // $method = 'GET'; + // $relativeUrl = '/test/api'; + // $accessToken = 'dummy_token'; + // $timestamp = '2026-04-10T10:00:00.000+07:00'; + // $apiSecret = 'secret123'; + + // $body = ''; + + // $signature = $this->generateSignature( + // $method, + // $relativeUrl, + // $accessToken, + // $body, + // $timestamp, + // $apiSecret + // ); + + // $expectedBodyHash = hash('sha256', ''); + + // $expected = hash_hmac('sha256', + // 'GET:/test/api:dummy_token:' . $expectedBodyHash . ':' . $timestamp, + // $apiSecret + // ); + + // $this->assertEquals($expected, $signature); + // } + + // public function test_string_to_sign_format() + // { + // $method = 'post'; // sengaja lowercase + // $relativeUrl = '/test/api'; + // $accessToken = 'token'; + // $timestamp = '2026-04-10T10:00:00.000+07:00'; + // $body = '{"a":1}'; + + // $bodyHash = hash('sha256', $body); + + // $stringToSign = strtoupper($method) . ':' . + // $relativeUrl . ':' . + // $accessToken . ':' . + // strtolower($bodyHash) . ':' . + // $timestamp; + + // $this->assertStringStartsWith('POST:', $stringToSign); + // $this->assertStringContainsString($relativeUrl, $stringToSign); + // $this->assertStringContainsString($accessToken, $stringToSign); + // } +} \ No newline at end of file diff --git a/public/css/style.css b/public/css/style.css index cff33be..300554f 100755 --- a/public/css/style.css +++ b/public/css/style.css @@ -8866,6 +8866,29 @@ sup { vertical-align: baseline; } + + +.breadcrumb ol { + display: flex; + list-style: none; + padding: 0; +} + +.breadcrumb li + li::before { + content: "/"; /* Standard separator; can also use ">" */ + padding: 0 8px; + color: #666; +} +.breadcrumb a { + text-decoration: none; + color: #0275d8; +} + +.breadcrumb a:hover { + text-decoration: underline; +} + + sub { bottom: -.25em; } diff --git a/resources/views/report/by-gate.blade.php b/resources/views/report/by-gate.blade.php index 59cd066..ca17804 100644 --- a/resources/views/report/by-gate.blade.php +++ b/resources/views/report/by-gate.blade.php @@ -7,35 +7,35 @@ @endsection @@ -43,11 +43,19 @@
+
-

Laporan Per Pintu ({{ $locationSettings->namalokasi }})

+

Laporan Per Pintu ({{ $locationSettings->namalokasi }})

@csrf
@@ -64,7 +72,7 @@
- + @@ -113,93 +121,80 @@
+
+ + +
- {{--
-
-
-
-

TRANSAKSI TUNAI

-
-
-

Transaksi Tanggal :

-

Filter by hari

-
- -
-
-
-
-
--}} - {{--
- - - - - - - - - - - - - - -
PintuPetugasJenis KendaraanStatusJumlahPendapatan
-
-
-
--}} - {{--
- - -
- - -
- -
--}} -
-
- - -
-
-
- Gate List + + + {{--
--}} + + + + -
-
-
-
-
-

JUMLAH TRANSAKSI

-
-
-

Total disini

-
-
-
+
@@ -218,6 +213,8 @@