Fix Billplz controller not fetching bills from Billplz api
This commit is contained in:
+1
-1
@@ -4,6 +4,7 @@ APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
API_URL=http://api_arrahn.test
|
||||
API_URL_KOOP=http://api_arrahn_v3.test
|
||||
API_LELONG_URL=https://niklah.arrahn.com.my
|
||||
|
||||
LOG_CHANNEL=stack
|
||||
@@ -63,4 +64,3 @@ BILLPLZ_SANDBOX_COLLECTION_ID="z0r4kjhi"
|
||||
BILLPLZ_SANDBOX_KOPKB_API_KEY="abecfd0c-98d8-4635-abc2-2fcba8c60c11"
|
||||
BILLPLZ_SANDBOX_KOPKB_X_SIGNATURE="S-GWr7z03XjAhqPsFfu_H5nQ"
|
||||
BILLPLZ_SANDBOX_KOPKB_COLLECTION_ID="uae40muk"
|
||||
|
||||
|
||||
@@ -2,15 +2,28 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\CompanyStatus;
|
||||
use App\Services\BillplzService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class BillplzController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, BillplzService $billplzService)
|
||||
public function __invoke(Request $request)
|
||||
{
|
||||
$billIdArray = json_decode($request->bill_ids);
|
||||
return $billplzService->getBills($billIdArray);
|
||||
$companyMapping = [
|
||||
CompanyStatus::COM_PKB,
|
||||
// CompanyStatus::COM_KOOPPKB,
|
||||
];
|
||||
|
||||
$bills = array_map(function($company_code, $request){
|
||||
$billplzService = new BillplzService($company_code);
|
||||
$billIdArray = json_decode($request->bill_ids);
|
||||
return $billplzService->getBills($billIdArray);
|
||||
}, $companyMapping);
|
||||
|
||||
return $bills;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user