diff --git a/app/Http/Controllers/BillplzController.php b/app/Http/Controllers/BillplzController.php new file mode 100644 index 0000000..0949e85 --- /dev/null +++ b/app/Http/Controllers/BillplzController.php @@ -0,0 +1,16 @@ +bill_ids); + return $billplzService->getBills($billIdArray); + } +} diff --git a/app/Services/BillplzService.php b/app/Services/BillplzService.php index e7f38fe..ae853f9 100644 --- a/app/Services/BillplzService.php +++ b/app/Services/BillplzService.php @@ -156,7 +156,6 @@ class BillplzService public function getBillplzTransactionReview($date) { - $date = Carbon::now()->toDateString(); $arrahnTransactions = $this->getArrahnTransactions(['date' => $date]); // sort array by tarikh desc and masa key desc @@ -248,4 +247,9 @@ class BillplzService throw $th; } } + + public function getBills($billIds) + { + return array_map(fn($x) => $this->client->bill()->get($x)->toArray(), $billIds); + } } diff --git a/routes/api.php b/routes/api.php index 275a46e..e90f5c5 100644 --- a/routes/api.php +++ b/routes/api.php @@ -3,6 +3,7 @@ use App\Http\Controllers\BillplzTransactionReviewController; use Illuminate\Http\Request; use Illuminate\Support\Facades\Route; +use App\Http\Controllers\BillplzController; /* |-------------------------------------------------------------------------- @@ -19,5 +20,6 @@ Route::middleware('auth:api')->get('/user', function (Request $request) { return $request->user(); }); +Route::get('/billplz', BillplzController::class); Route::get('/billplz-transaction-review', [BillplzTransactionReviewController::class, 'index']); Route::get('/billplz-transaction-review/{bill_id}', [BillplzTransactionReviewController::class, 'show']);