44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Models\CompanyStatus;
|
|
use App\Services\BillplzService;
|
|
use Carbon\Carbon;
|
|
use Illuminate\Http\Request;
|
|
|
|
class BillplzTransactionReviewController extends Controller
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$date = $request->date ?? Carbon::now()->toDateString();
|
|
|
|
$companyMapping = [
|
|
CompanyStatus::COM_PKB,
|
|
// CompanyStatus::COM_KOOPPKB,
|
|
];
|
|
|
|
$billplzTransactionReview = array_map(function($company_code) use($date){
|
|
$billplzService = new BillplzService($company_code);
|
|
return $billplzService->getBillplzTransactionReview($date);
|
|
}, $companyMapping);
|
|
|
|
return response()->json(array_merge(...$billplzTransactionReview), 200);
|
|
}
|
|
|
|
public function show(Request $request)
|
|
{
|
|
$companyMapping = [
|
|
CompanyStatus::COM_PKB,
|
|
// CompanyStatus::COM_KOOPPKB,
|
|
];
|
|
|
|
$billplzTransactionReview = array_map(function($company_code) use($request){
|
|
$billplzService = new BillplzService($company_code);
|
|
return $billplzService->getBillplzTransactionReviewByBillId($request->bill_id);
|
|
}, $companyMapping);
|
|
|
|
return response()->json($billplzTransactionReview, 200);
|
|
}
|
|
}
|