Handle erors on marhun service, and pembiayaan service

This commit is contained in:
Afiq Hamzah
2024-07-16 16:01:53 +08:00
parent 9c8908f9ea
commit f57f2da1c4
3 changed files with 24 additions and 13 deletions
+2 -1
View File
@@ -23,7 +23,8 @@ class MarhunService
});
};
$marhunDetailsResponse = array_map(fn($x) => array_merge([], ...$x->json()), $getMarhunDetails());
$marhunDetailsResponse = array_map(fn($x) => $x->json() == null ? [] : $x->Json(), $getMarhunDetails());
$marhunDetailsResponse = array_map(fn($x) => array_merge([], ...$x), $marhunDetailsResponse);
$formatMarhunDetailData = function ($x) {
$getMarhunTypeFullName = function ($code) {
+10 -1
View File
@@ -165,9 +165,18 @@ class PembiayaanService
};
$pembiayaanAkanDilelong = array_filter($getPembiayaanAkanDilelong(), $isCurrentDateGreaterThanEqual3DaysBeforeLelong);
$norujukanAkanDilelong = array_map(fn($x) => $x->norujukan, $pembiayaanAkanDilelong);
$pembiayaanInFasa2 = array_filter($getPembiayaanAkanDilelong(), fn($x) => $x->fasa == 2);
$setDefaultFasaIfNotAvailable = function($x){
if(! isset($x->fasa)){
$x->fasa = 1;
}
return $x;
};
$pembiayaanWithFasa = array_map($setDefaultFasaIfNotAvailable, $getPembiayaanAkanDilelong());
$pembiayaanInFasa2 = array_filter($pembiayaanWithFasa, fn($x) => $x->fasa == 2);
$norujukanInFasa2 = array_map(fn($x) => $x->norujukan, $pembiayaanInFasa2);
$getPayableUjrahBranches = fn() => Http::arrahn()->get('/api/payable-ujrah-branches')->json();