From 8df8551f83e98b112558d19d4110a87b024a563e Mon Sep 17 00:00:00 2001 From: hafifierahman Date: Tue, 21 Jan 2025 00:06:55 +0800 Subject: [PATCH] fix disabled after payment --- app/Services/PembiayaanService.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Services/PembiayaanService.php b/app/Services/PembiayaanService.php index 495efe7..9bd6a6a 100644 --- a/app/Services/PembiayaanService.php +++ b/app/Services/PembiayaanService.php @@ -144,8 +144,8 @@ class PembiayaanService { $getRecentlyAttemptPayment = function () use ($norujukanList) { return Http::pool(function (Pool $pool) use ($norujukanList) { - foreach ($norujukanList as $norujukan) { - $pool->get(config('api.url') . '/portal/searchsagonline/', ['norujukan' => $norujukan]); + foreach ($norujukanList as $list) { + $pool->get(($list['tag_syarikat'] == CompanyStatus::COM_PKB ? config('api.url') : config('api.url_koop')) . '/portal/searchsagonline/', ['norujukan' => $list['norujukan']]); } }); }; @@ -166,8 +166,11 @@ class PembiayaanService } private function checkPembiayaanPaymentDisabled($pembiayaan) - { - $norujukanList = array_map(fn($x) => $x->norujukan, $pembiayaan); + { + $norujukanList = array_map(fn($x) => [ + 'tag_syarikat' => $x->tag_syarikat, + 'norujukan' => $x->norujukan, + ], $pembiayaan); $norujukanRecentlyAttemptPayment = $this->getNorujukanRecentlyAttemptPayment($norujukanList); @@ -205,6 +208,7 @@ class PembiayaanService $kodCawanganBranchesNotPermitPaymentUjrah = array_map(fn($x) => $x['kodcaw'], $branchesNotPermitPaymentUjrah); $isNorujukanPaymentRecentlyAttempted = function ($x) use ($norujukanRecentlyAttemptPayment) { + $norujukanRecentlyAttemptPayment = array_column($norujukanRecentlyAttemptPayment, 'norujukan'); return in_array($x->norujukan, $norujukanRecentlyAttemptPayment); };