From fdbb910f9741d660328339fc30d28039dea4d65a Mon Sep 17 00:00:00 2001 From: Afiq Hamzah Date: Sun, 16 Feb 2025 22:36:01 +0800 Subject: [PATCH] Update billplz transaction review response --- .../Controllers/BillplzTransactionReviewController.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/BillplzTransactionReviewController.php b/app/Http/Controllers/BillplzTransactionReviewController.php index 5160b32..8bc8979 100644 --- a/app/Http/Controllers/BillplzTransactionReviewController.php +++ b/app/Http/Controllers/BillplzTransactionReviewController.php @@ -18,12 +18,13 @@ class BillplzTransactionReviewController extends Controller 'KOPKB', ]; - $billplzTransactionReview = array_map(function($company_code) use($date){ + $billplzTransactionReview = array_reduce($companyMapping, function($carry, $company_code) use($date){ $billplzService = new BillplzService($company_code); - return $billplzService->getBillplzTransactionReview($date)->toArray(); - }, $companyMapping); + $carry[$company_code] = $billplzService->getBillplzTransactionReview($date)->toArray(); + return $carry; + }, []); - return response()->json(array_merge(...$billplzTransactionReview), 200); + return response()->json($billplzTransactionReview, 200); } public function show(Request $request)