Fix bug on split payment in BillplzTransactionReviewController
This commit is contained in:
@@ -2,26 +2,41 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\CompanyStatus;
|
||||||
use App\Services\BillplzService;
|
use App\Services\BillplzService;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class BillplzTransactionReviewController extends Controller
|
class BillplzTransactionReviewController extends Controller
|
||||||
{
|
{
|
||||||
public function index(Request $request, BillplzService $billplzService)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$date = $request->date ?? Carbon::now()->toDateString();
|
$date = $request->date ?? Carbon::now()->toDateString();
|
||||||
|
|
||||||
$billplzTransactionReview = $billplzService->getBillplzTransactionReview($date);
|
$companyMapping = [
|
||||||
|
CompanyStatus::COM_PKB,
|
||||||
|
// CompanyStatus::COM_KOOPPKB,
|
||||||
|
];
|
||||||
|
|
||||||
return response()->json($billplzTransactionReview, 200);
|
$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, BillplzService $billplzService)
|
public function show(Request $request)
|
||||||
{
|
{
|
||||||
$date = $request->date ?? Carbon::now()->toDateString();
|
$companyMapping = [
|
||||||
|
CompanyStatus::COM_PKB,
|
||||||
|
// CompanyStatus::COM_KOOPPKB,
|
||||||
|
];
|
||||||
|
|
||||||
$billplzTransactionReview = $billplzService->getBillplzTransactionReviewByBillId($request->bill_id);
|
$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);
|
return response()->json($billplzTransactionReview, 200);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user