Merge branch 'production' of https://bitbucket.org/arrahn-pkb/lelong into lelong-ujrah-kopkb
This commit is contained in:
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Resit;
|
||||
use App\Services\BillplzService;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Models\Payment;
|
||||
use App\Http\Controllers\ApiController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class CheckBillplzPayments extends Command
|
||||
{
|
||||
protected $signature = 'billplz:semak
|
||||
{--date= : Date in YYYY-MM-DD format}
|
||||
{--preview : Preview pending resits only}';
|
||||
protected $description = 'Check Billplz payment status and update database';
|
||||
|
||||
protected $billplzService;
|
||||
|
||||
public function __construct(BillplzService $billplzService)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->billplzService = $billplzService;
|
||||
}
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$date = $this->option('date') ?? now()->toDateString();
|
||||
$preview = $this->option('preview');
|
||||
|
||||
// Validate date
|
||||
try {
|
||||
$dateObj = Carbon::createFromFormat('Y-m-d', $date);
|
||||
} catch (\Exception $e) {
|
||||
$this->error("Invalid date format. Use YYYY-MM-DD.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
$this->info("Retrying Billplz check for date: {$dateObj->toDateString()}");
|
||||
|
||||
$date = $dateObj->toDateString();
|
||||
|
||||
$pendingResits = DB::table('resit as r')
|
||||
->join('payment as p', 'p.resit_id', '=', 'r.id')
|
||||
->join(DB::raw('(
|
||||
SELECT user_id, total_payment, MIN(id) AS min_id
|
||||
FROM payment
|
||||
GROUP BY user_id, total_payment
|
||||
) as unique_payment'), 'p.id', '=', 'unique_payment.min_id')
|
||||
->whereNull('r.status')
|
||||
->where('p.status', 0)
|
||||
->whereNotNull('r.billplz_id')
|
||||
->whereDate('r.created_at', $date)
|
||||
->where('r.billplz_id', 'NOT LIKE', '%CDM%')
|
||||
->select('r.*', 'p.id as payment_id', 'p.total_payment')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
if ($pendingResits->isEmpty()) {
|
||||
$this->info('Tiada Resit belum dibayar ditemui.');
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($preview) {
|
||||
$this->info("Preview mode aktif. Senarai Resit:");
|
||||
foreach ($pendingResits as $resit) {
|
||||
$this->line("Resit ID: {$resit->id} | Billplz ID: {$resit->billplz_id} | Jumlah: RM{$resit->total_payment}");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
foreach ($pendingResits as $resit) {
|
||||
$this->info("Semak Resit ID: {$resit->id}");
|
||||
|
||||
$billData = $this->billplzService->testGetBill($resit->billplz_id);
|
||||
|
||||
if (isset($billData['error'])) {
|
||||
$this->error("❌ Gagal semak Billplz untuk Resit {$resit->id}: {$billData['details']}");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isset($billData['paid']) && $billData['paid'] === true) {
|
||||
// Simulate Request object
|
||||
$data = [
|
||||
'billplz' => [
|
||||
'id' => $resit->billplz_id,
|
||||
'paid' => 'true',
|
||||
'paid_at' => $billData['paid_at'] ?? now()->toDateTimeString(),
|
||||
]
|
||||
];
|
||||
// dd($data);
|
||||
|
||||
$apiController = App::make(ApiController::class);
|
||||
$apiController->processPaidResit($data);
|
||||
// dd($fakeRequest);
|
||||
|
||||
|
||||
$this->info("✅ Resit ID {$resit->id} handled via processPaidResit.");
|
||||
}else {
|
||||
$this->info("ℹ️ Resit ID {$resit->id} masih belum dibayar.");
|
||||
}
|
||||
}
|
||||
|
||||
$this->info('Semakan semula Billplz selesai.');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -328,7 +328,7 @@ class AccountController extends Controller
|
||||
$eachbid->status_payment = 1;
|
||||
$eachbid->status_jual = 1;
|
||||
$eachbid->status_semak = 1;
|
||||
$eachbid->t_jual = $currentdate;
|
||||
//$eachbid->t_jual = $currentdate;
|
||||
$eachbid->save();
|
||||
|
||||
$bidder = LelongBidder::where('lelongbid_id', $sag->lelongbid_id)
|
||||
|
||||
@@ -39,6 +39,8 @@ use Billplz\Client;
|
||||
use Http\Client\Common\HttpMethodsClient;
|
||||
use Http\Adapter\Guzzle7\Client as GuzzleHttpClient;
|
||||
use Http\Message\MessageFactory\GuzzleMessageFactory;
|
||||
use App\Models\LogUser;
|
||||
use App\Jobs\WhatsappPembidaFPXPaid;
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
@@ -644,5 +646,70 @@ class ApiController extends Controller
|
||||
return view('pembida.feePaymentResult', compact('data', 'result', 'success'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// BillplzService.php atau ApiController.php
|
||||
public function processPaidResit(array $data)
|
||||
{
|
||||
$currentdate = Carbon::now();
|
||||
$currentdate = $currentdate->toDateTimeString();
|
||||
$loguser = new LogUser;
|
||||
$loguser->user_id = User::where('name','System')->first()->id;
|
||||
$loguser->date = $currentdate;
|
||||
$loguser->username = 'System';
|
||||
$loguser->nama_user = 'System';
|
||||
$loguser->norujukan = $data['billplz']['id'];
|
||||
$loguser->nota = 'Callback Resit Billplz Telah Bayar : Billplz_id -'.$data['billplz']['id'];
|
||||
$loguser->save();
|
||||
|
||||
$resit = Resit::where('billplz_id', '=', $data['billplz']['id'])->first();
|
||||
|
||||
if (!$resit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $data['billplz']['paid_at'];
|
||||
$resit->save();
|
||||
|
||||
$resitoriginal = Resit::where('user_id', $resit->user_id)
|
||||
->where('lelong_id', $resit->lelong_id)
|
||||
->where('resit_type', 2)
|
||||
->first();
|
||||
|
||||
$payment = Payment::where('lelong_id', $resit->lelong_id)
|
||||
->where('user_id', $resit->user_id)
|
||||
->where('resit_id', $resit->id)
|
||||
->get();
|
||||
|
||||
foreach ($payment as $index) {
|
||||
$index->status = 2;
|
||||
$index->remark = "BERJAYA BAYARAN ONLINE";
|
||||
$index->update();
|
||||
|
||||
$updateTagBid = LelongBid::where('norujukan', $index->norujukan)->first();
|
||||
if ($updateTagBid) {
|
||||
$updateTagBid->status_payment = 2;
|
||||
$updateTagBid->save();
|
||||
|
||||
$updateTagBidder = LelongBidder::where('lelongbid_id', $updateTagBid->id)
|
||||
->where('user_id', $resit->user_id)->first();
|
||||
if ($updateTagBidder) {
|
||||
$updateTagBidder->status_payment = 2;
|
||||
$updateTagBidder->payment_id = $index->id;
|
||||
$updateTagBidder->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
event(new PaymentNotify('PAID', $resit->user_id, $payment));
|
||||
//notifikasi wasap kepada pembida//
|
||||
WhatsappPembidaFPXPaid::dispatch($resit->user_id,
|
||||
$resit->id,
|
||||
$resit->total_payment);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,23 +15,22 @@ use Illuminate\Support\Facades\Http;
|
||||
|
||||
class UserController extends Controller
|
||||
{
|
||||
public function getProfileUser(Request $request){
|
||||
public function getProfileUser(Request $request)
|
||||
{
|
||||
$user = Auth::user();
|
||||
|
||||
$getUserNokp = User::where('nokp', $request->nokp)
|
||||
// ->join('file', function ($join) {
|
||||
// $join->on('users.id', '=', 'file.user_id');
|
||||
// })
|
||||
->get();
|
||||
|
||||
if ($getUserNokp->isNotEmpty()) {
|
||||
return response()->json(['success' => true , 'message' => $getUserNokp], 201);
|
||||
}
|
||||
|
||||
else {
|
||||
return response()->json(['success' => false, 'message' => 'Empty data'], 201);
|
||||
if ($user) {
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => [$user]
|
||||
], 200);
|
||||
} else {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'message' => 'Unauthorized'
|
||||
], 401);
|
||||
}
|
||||
}
|
||||
|
||||
public function updateProfileUser(Request $request){
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
@@ -179,7 +178,7 @@ class UserController extends Controller
|
||||
]);
|
||||
|
||||
$tac_code_model = new TacCode();
|
||||
$tac_code_model->tac_code = $tac_code;
|
||||
$tac_code_model->tac_code = Hash::make($tac_code);
|
||||
$tac_code_model->phone_number = $request->phone_number;
|
||||
$tac_code_model->case_code = 1;
|
||||
$tac_code_model->case_description = 'Verify Phone Number';
|
||||
@@ -189,7 +188,6 @@ class UserController extends Controller
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'message' => 'Tac Sent!',
|
||||
'response' => $tac_code_model
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -199,13 +197,13 @@ class UserController extends Controller
|
||||
$current_date_time = $current->toDateTimeString();
|
||||
|
||||
$tac_code = TacCode::query()
|
||||
->where('tac_code', $request->tac_code)
|
||||
->where('phone_number', $request->phone_number)
|
||||
->where('expired_at', '>=', $current_date_time)
|
||||
->where('status', 0)
|
||||
->latest()
|
||||
->first();
|
||||
|
||||
if ($tac_code) {
|
||||
if ($tac_code && Hash::check($request->tac_code, $tac_code->tac_code)) {
|
||||
$user = Auth::user();
|
||||
$user->notelbimbit = $request->phone_number;
|
||||
$user->save();
|
||||
|
||||
@@ -24,19 +24,26 @@ use App\Models\Invoice;
|
||||
use App\Models\ScanJual;
|
||||
use App\Services\ResitPhotoService;
|
||||
use Symfony\Component\Console\Descriptor\Descriptor;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use App\Services\BillplzService;
|
||||
use App\Http\Controllers\ApiController;
|
||||
|
||||
|
||||
class PembidaController extends Controller
|
||||
{
|
||||
private $resitPhotoService;
|
||||
protected $billplzService;
|
||||
protected $ResitSemakanService;
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(ResitPhotoService $resitPhotoService)
|
||||
public function __construct(ResitPhotoService $resitPhotoService,BillplzService $billplzService)
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->resitPhotoService = $resitPhotoService;
|
||||
$this->billplzService = $billplzService;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1371,5 +1378,167 @@ class PembidaController extends Controller
|
||||
//return view('pembida.statusserahanbypembida',compact('listwinner','lelong','arrayinfo','cawanganbidder'));
|
||||
return view('pembida.statusserahanbypembida',compact('arraysms','arraysls','listwinner','lelong','cawanganbidder'));
|
||||
}
|
||||
|
||||
public function semakanBillplz(Request $request, BillplzService $billplzService)
|
||||
{
|
||||
$date = $request->input('date') ?? now()->toDateString();
|
||||
|
||||
try {
|
||||
$dateObj = Carbon::createFromFormat('Y-m-d', $date);
|
||||
} catch (\Exception $e) {
|
||||
return back()->with('error', 'Tarikh tidak sah. Guna format YYYY-MM-DD.');
|
||||
}
|
||||
|
||||
$date = $dateObj->toDateString();
|
||||
|
||||
$allPendingResits = DB::table('resit as r')
|
||||
->join('payment as p', 'p.resit_id', '=', 'r.id')
|
||||
->join(DB::raw('(
|
||||
SELECT user_id, total_payment, MIN(id) AS min_id
|
||||
FROM payment
|
||||
GROUP BY user_id, total_payment
|
||||
) as unique_payment'), 'p.id', '=', 'unique_payment.min_id')
|
||||
->join('users as u', 'p.user_id', '=', 'u.id')
|
||||
->join('cawangan as c', 'p.kodcaw', '=', 'c.caw_code') // JOIN ikut kodcaw
|
||||
// Elakkan resit yang ada CDM payment pada hari yang sama
|
||||
->whereNotExists(function ($query) use ($date) {
|
||||
$query->select(DB::raw(1))
|
||||
->from('resit as r2')
|
||||
->join('payment as p2', 'p2.resit_id', '=', 'r2.id')
|
||||
->whereRaw('p2.user_id = p.user_id')
|
||||
->whereRaw('p2.total_payment = p.total_payment')
|
||||
->whereDate('r2.created_at', $date)
|
||||
->where('r2.billplz_id', 'LIKE', '%CDM%');
|
||||
})
|
||||
->whereNull('r.status')
|
||||
->where('p.status', 0)
|
||||
->whereNotNull('r.billplz_id')
|
||||
->where('r.billplz_id', 'NOT LIKE', '%CDM%')
|
||||
->whereDate('r.created_at', $date)
|
||||
->select(
|
||||
'r.*',
|
||||
'p.id as payment_id',
|
||||
'p.total_payment',
|
||||
'p.user_id',
|
||||
'u.name as payer_name',
|
||||
'c.caw_name as cawangan_nama' // Tambah nama cawangan
|
||||
)
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
// Kumpul mengikut billplz_id dan user_id
|
||||
$groupedResitsUnpaid = $allPendingResits
|
||||
->groupBy('billplz_id') // Group mengikut billplz_id
|
||||
->map(function ($items) {
|
||||
return (object) [
|
||||
'billplz_id' => $items->first()->billplz_id,
|
||||
'jumlah_bayaran' => $items->sum('total_payment'),
|
||||
'payer_name' => $items->first()->payer_name,
|
||||
'cawangan_nama' => $items->first()->cawangan_nama,
|
||||
'resit_id' => $items->first()->id,
|
||||
'created_at' => $items->first()->created_at,
|
||||
'user_id' => $items->first()->user_id,
|
||||
];
|
||||
})
|
||||
->values(); // Reset index
|
||||
|
||||
|
||||
$billplzWithCdmResits = DB::table('resit as r')
|
||||
->join('payment as p', 'p.resit_id', '=', 'r.id')
|
||||
->join(DB::raw('(
|
||||
SELECT user_id, total_payment, MIN(id) AS min_id
|
||||
FROM payment
|
||||
GROUP BY user_id, total_payment
|
||||
) as unique_payment'), 'p.id', '=', 'unique_payment.min_id')
|
||||
->join('users as u', 'p.user_id', '=', 'u.id')
|
||||
->join('cawangan as c', 'p.kodcaw', '=', 'c.caw_code')
|
||||
->whereNull('r.status')
|
||||
->where('p.status', 0)
|
||||
->whereNotNull('r.billplz_id')
|
||||
->where('r.billplz_id', 'NOT LIKE', '%CDM%')
|
||||
->whereDate('r.created_at', $date)
|
||||
->whereExists(function ($query) use ($date) {
|
||||
$query->select(DB::raw(1))
|
||||
->from('resit as r2')
|
||||
->join('payment as p2', 'p2.resit_id', '=', 'r2.id')
|
||||
->join('users as u2', 'p2.user_id', '=', 'u2.id')
|
||||
->whereRaw('u2.name = u.name') // banding nama
|
||||
->whereRaw('p2.total_payment = p.total_payment') // dan jumlah
|
||||
->whereDate('r2.created_at', $date)
|
||||
->where('r2.billplz_id', 'LIKE', '%CDM%');
|
||||
})
|
||||
->select('r.*', 'p.id as payment_id', 'p.total_payment', 'u.name as payer_name', 'c.caw_name as cawangan_nama')
|
||||
->distinct()
|
||||
->get();
|
||||
|
||||
$groupedResits = $billplzWithCdmResits
|
||||
->groupBy('billplz_id')
|
||||
->map(function ($items) {
|
||||
return (object) [
|
||||
'billplz_id' => $items->first()->billplz_id,
|
||||
'jumlah_bayaran' => $items->sum('total_payment'),
|
||||
'payer_name' => $items->first()->payer_name,
|
||||
'cawangan_nama' => $items->first()->cawangan_nama,
|
||||
'resit_id' => $items->first()->id,
|
||||
'created_at' => $items->first()->created_at,
|
||||
'user_id' => $items->first()->user_id,
|
||||
];
|
||||
})->values();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Semak status Billplz untuk setiap resit
|
||||
$paidResits = collect();
|
||||
$unpaidResits = collect();
|
||||
$processingResits = collect();
|
||||
|
||||
foreach ($allPendingResits as $resit) {
|
||||
$billData = $billplzService->testGetBill($resit->billplz_id);
|
||||
|
||||
$isPaid = isset($billData['paid']) && $billData['paid'] === true;
|
||||
$isProcessing = isset($billData['state']) && in_array($billData['state'], ['pending', 'processing']) && isset($billData['paid_at']);
|
||||
|
||||
if ($isPaid) {
|
||||
$resit->paid_at = $billData['paid_at'] ?? now();
|
||||
$paidResits->push($resit);
|
||||
} elseif ($isProcessing) {
|
||||
$resit->paid_at = $billData['paid_at'];
|
||||
$resit->state = $billData['state'];
|
||||
$processingResits->push($resit);
|
||||
} else {
|
||||
$unpaidResits->push($resit);
|
||||
}
|
||||
}
|
||||
|
||||
return view('pembida.semakanbillplz', compact(
|
||||
'paidResits',
|
||||
'unpaidResits',
|
||||
'billplzWithCdmResits',
|
||||
'processingResits',
|
||||
'groupedResits',
|
||||
'groupedResitsUnpaid',
|
||||
'date'
|
||||
));
|
||||
}
|
||||
|
||||
public function prosesBillplz(Request $request)
|
||||
{
|
||||
$data = [
|
||||
'billplz' => [
|
||||
'id' => $request->billplz_id,
|
||||
'resit_id' => $request->resit_id,
|
||||
'paid' => 'true',
|
||||
'paid_at' => $request->paid_at ?? now()->toDateTimeString(),
|
||||
]
|
||||
];
|
||||
|
||||
$apiController = app(ApiController::class);
|
||||
$apiController->processPaidResit($data);
|
||||
|
||||
return redirect()->back()->with('success', 'Resit telah diproses.');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Carbon\Carbon;
|
||||
use App\Models\User;
|
||||
use App\Models\LogUser;
|
||||
|
||||
class WhatsappPembidaFPXPaid implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public $userId, $resitId, $amount;
|
||||
|
||||
public function __construct($userId, $resitId, $amount)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
$this->resitId = $resitId;
|
||||
$this->amount = $amount;
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$dt = Carbon::now();
|
||||
$user = User::find($this->userId);
|
||||
if (!$user || !$user->notelbimbit) return;
|
||||
|
||||
$message = "Assalamualaikum {$user->name}, bayaran FPX anda sebanyak RM " . number_format($this->amount, 2) . " telah berjaya direkodkan. Resit ID: {$this->resitId}. Terima kasih.";
|
||||
|
||||
$mobile_no = '6' . $user->notelbimbit;
|
||||
if (config('app.env') != 'production') {
|
||||
$mobile_no = config('app.admin_phone_number');
|
||||
}
|
||||
|
||||
$response = Http::get(config('app.wabot_api'), [
|
||||
'number' => $mobile_no,
|
||||
'type' => 'text',
|
||||
'message' => $message,
|
||||
'instance_id' => config('app.wabot_instances_id'),
|
||||
'access_token' => config('app.wabot_token_keys')
|
||||
]);
|
||||
|
||||
$loguser = new LogUser;
|
||||
$loguser->date = $dt;
|
||||
$loguser->username = 'Operasi';
|
||||
$loguser->nama_user = 'System';
|
||||
$loguser->nota = 'Notifikasi Pembayaran Billplz Berjaya';
|
||||
$loguser->save();
|
||||
|
||||
Log::info("Notifikasi Pembayaran Billplz Berjaya: " . $response);
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
//
|
||||
if ($this->app->environment('local')) {
|
||||
$this->app->register(\Laravel\Telescope\TelescopeServiceProvider::class);
|
||||
$this->app->register(TelescopeServiceProvider::class);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Billplz\Client as BillplzClient;
|
||||
use Http\Client\Common\HttpMethodsClient;
|
||||
use GuzzleHttp\Client as GuzzleHttpClient;
|
||||
use Http\Message\MessageFactory\GuzzleMessageFactory;
|
||||
use Laravie\Codex\Exceptions\NotFoundException;
|
||||
|
||||
class BillplzService
|
||||
{
|
||||
protected $client;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// Buat HttpMethodsClient dengan GuzzleHttpClient dan GuzzleMessageFactory
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(), // Guzzle HTTP client
|
||||
new GuzzleMessageFactory() // Guzzle message factory untuk request dan response
|
||||
);
|
||||
|
||||
// Get API key dan base URL dari environment
|
||||
$apiKey = env('BILLPLZ_API_KEY');
|
||||
$baseUrl = env('BILLPLZ_API_URL', 'https://api.billplz.com'); // Default production URL
|
||||
|
||||
// Mencipta client Billplz dengan adapter HTTP
|
||||
$this->client = new BillplzClient($http, $apiKey, $baseUrl);
|
||||
}
|
||||
|
||||
public function testGetBill(string $billId)
|
||||
{
|
||||
try {
|
||||
// Minta details bill berdasarkan ID
|
||||
$response = $this->client->bill()->get($billId);
|
||||
|
||||
// Pastikan respons berjaya
|
||||
if ($response->isSuccessful()) {
|
||||
return $response->toArray(); // Kembalikan hasil dalam bentuk array
|
||||
}
|
||||
|
||||
return ['error' => 'Request failed', 'details' => $response->toArray()];
|
||||
} catch (NotFoundException $e) {
|
||||
return ['error' => 'Bill not found', 'details' => $e->getMessage()];
|
||||
} catch (\Throwable $e) {
|
||||
return ['error' => 'Unexpected error', 'details' => $e->getMessage()];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,4 +30,9 @@ return [
|
||||
'region' => env('AWS_DEFAULT_REGION', 'us-east-1'),
|
||||
],
|
||||
|
||||
'billplz' => [
|
||||
'key' => env('BILLPLZ_API_KEY'),
|
||||
'sandbox' => env('BILLPLZ_SANDBOX', false),
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
@@ -123,12 +123,17 @@
|
||||
.page-break {
|
||||
page-break-before: always;
|
||||
}
|
||||
|
||||
.alamat {
|
||||
width: 300px; /* Adjust as needed */
|
||||
word-wrap: break-word; /* Allows long words to break */
|
||||
overflow-wrap: break-word; /* Ensures wrapping */
|
||||
white-space: normal; /* Prevents text from staying in a single line */
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
@foreach($marhuns as $index1=> $notis)
|
||||
{{-- {{dd($notis['nama']['alamat1'])}} --}}
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
<table id="header">
|
||||
@@ -202,7 +207,7 @@
|
||||
<tr>
|
||||
<td style="vertical-align:top;">KEPADA :</td>
|
||||
<!-- <td style="vertical-align:top;">:</td> -->
|
||||
<td style="vertical-align:top;">{{ $notis['nama']['nama']}}
|
||||
<td style="vertical-align:top;" class="alamat">{{ $notis['nama']['nama']}}
|
||||
<br> {{ strtoupper($notis['nama']['alamat1']) }}
|
||||
{{-- {!! ($notis['nama']['alamat1'] === null || $notis['nama']['alamat1'] === '') ? '' : '<br>' . strtoupper($notis['nama']['alamat1']) !!} <br> --}} <br>
|
||||
{{ ' ' . $notis['nama']['poskod'] . ' ' . strtoupper($notis['nama']['namadaerah']) . ' ' . strtoupper($notis['nama']['negeri'])}}</td>
|
||||
|
||||
@@ -123,6 +123,14 @@
|
||||
.page-break {
|
||||
page-break-before: always;
|
||||
}
|
||||
.alamat {
|
||||
width: 300px; /* Adjust as needed */
|
||||
word-wrap: break-word; /* Allows long words to break */
|
||||
overflow-wrap: break-word; /* Ensures wrapping */
|
||||
white-space: normal; /* Prevents text from staying in a single line */
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
@foreach($marhuns as $index1=> $notis)
|
||||
{{-- {{dd($notis['nama']['alamat1'])}} --}}
|
||||
@@ -199,7 +207,7 @@
|
||||
<tr>
|
||||
<td style="vertical-align:top;">KEPADA</td>
|
||||
<td style="vertical-align:top;">:</td>
|
||||
<td style="vertical-align:top;">{{ $notis['nama']['nama']}}
|
||||
<td style="vertical-align:top;" class="alamat">{{ $notis['nama']['nama']}}
|
||||
<br> {{ strtoupper($notis['nama']['alamat1']) }} <br>
|
||||
{{-- {!! ($notis['nama']['alamat1'] === null || $notis['nama']['alamat1'] === '') ? '' : '<br>' . strtoupper($notis['nama']['alamat1']) !!} <br> --}}
|
||||
{{-- {!! ($notis['nama']['alamat2'] === null || $notis['nama']['alamat2'] === '') ? '' : '<br>' . strtoupper($notis['nama']['alamat2']) !!} <br> --}}
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
@extends('layouts.app')
|
||||
@section('content')
|
||||
<div class="container-fluid">
|
||||
<div class="row ">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-header header-style">
|
||||
<a href="javascript:window.history.go(-1);" class="header-style-icon">
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
</a>
|
||||
<div class="header-style-title">Semakan Billplz FPX</div>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
@if ($message = Session::get('success'))
|
||||
<div class="alert alert-success">
|
||||
<p>{{ $message }}</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<form method="GET" action="{{ route('pembida.semakanbillplz') }}" class="mb-4">
|
||||
<div class="form-inline">
|
||||
<label for="date" class="mr-2">Pilih Tarikh:</label>
|
||||
<input type="date" name="date" id="date" class="form-control mr-2" value="{{ $date }}">
|
||||
<button type="submit" class="btn btn-primary">Semak</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr>
|
||||
<h4>✅ Resit Telah Dibayar (PAID)</h4>
|
||||
@if($paidResits->isEmpty())
|
||||
<p>Tiada resit yang telah dibayar.</p>
|
||||
@else
|
||||
<table class="table table-bordered text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nama Pembayar</th>
|
||||
<th>ID Pembayar</th>
|
||||
<th>Cawangan</th>
|
||||
<th>Resit ID</th>
|
||||
<th>Billplz ID</th>
|
||||
<th>Jumlah (RM)</th>
|
||||
<th>Dibayar Pada</th>
|
||||
<th>Tindakan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($paidResits as $resit)
|
||||
<tr>
|
||||
<td>{{ $resit->payer_name ?? '-' }}</td>
|
||||
<td>{{ $resit->user_id }}</td>
|
||||
<td>{{ $resit->cawangan_nama ?? '-' }}</td>
|
||||
<td>{{ $resit->id }}</td>
|
||||
<td>{{ $resit->billplz_id }}</td>
|
||||
<td>{{ number_format($resit->total_payment, 2) }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($resit->paid_at)->format('d/m/Y H:i') }}</td>
|
||||
<td>
|
||||
@if (\Carbon\Carbon::parse($resit->paid_at)->isSameDay(\Carbon\Carbon::today()))
|
||||
<form method="POST" action="{{ route('pembida.prosesBillplz', ['resit_id' => $resit->id, 'billplz_id' => $resit->billplz_id]) }}">
|
||||
@csrf
|
||||
<input type="hidden" name="billplz_id" value="{{ $resit->billplz_id }}">
|
||||
<input type="hidden" name="paid_at" value="{{ \Carbon\Carbon::parse($resit->paid_at)->toDateTimeString() }}">
|
||||
<button type="submit" class="btn btn-sm btn-success">Proses</button>
|
||||
</form>
|
||||
@else
|
||||
<span class="text-muted">Tarikh bukan hari ini</span>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
|
||||
<hr>
|
||||
|
||||
<h4>❌ Resit Belum Dibayar (UNPAID)</h4>
|
||||
@if($unpaidResits->isEmpty())
|
||||
<p>Semua resit telah dibayar.</p>
|
||||
@else
|
||||
<table class="table table-bordered text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nama Pembayar</th>
|
||||
<th>ID Pembayar</th>
|
||||
<th>Cawangan</th>
|
||||
<th>Resit ID</th>
|
||||
<th>Billplz ID</th>
|
||||
<th>Jumlah (RM)</th>
|
||||
<th>Tarikh Dicipta</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($groupedResitsUnpaid as $resit)
|
||||
<tr>
|
||||
<td>{{ $resit->payer_name ?? '-' }}</td>
|
||||
<td>{{ $resit->user_id }}</td>
|
||||
<td>{{ $resit->cawangan_nama ?? '-' }}</td>
|
||||
<td>{{ $resit->resit_id }}</td>
|
||||
<td>{{ $resit->billplz_id }}</td>
|
||||
<td>{{ number_format($resit->jumlah_bayaran, 2) }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($resit->created_at)->format('d/m/Y H:i') }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
|
||||
<hr>
|
||||
<h4>🔄 Resit Billplz yang Telah Dibayar Semula Melalui CDM</h4>
|
||||
@if($billplzWithCdmResits->isEmpty())
|
||||
<p>Tiada bayaran semula melalui CDM ditemui.</p>
|
||||
@else
|
||||
<table class="table table-bordered text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nama Pembayar</th>
|
||||
<th>ID Pembayar</th>
|
||||
<th>Cawangan</th>
|
||||
<th>Resit ID</th>
|
||||
<th>Billplz ID</th>
|
||||
<th>Jumlah (RM)</th>
|
||||
<th>Tarikh Dicipta</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($groupedResits as $resit)
|
||||
<tr>
|
||||
<td>{{ $resit->payer_name }}</td>
|
||||
<td>{{ $resit->user_id }}</td>
|
||||
<td>{{ $resit->cawangan_nama }}</td>
|
||||
<td>{{ $resit->resit_id }}</td>
|
||||
<td>{{ $resit->billplz_id }}</td>
|
||||
<td>{{ number_format($resit->jumlah_bayaran, 2) }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($resit->created_at)->format('d/m/Y H:i') }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
|
||||
<hr>
|
||||
<h4>🕒 Resit Telah Dibayar Tetapi Dalam Proses (PENDING)</h4>
|
||||
@if($processingResits->isEmpty())
|
||||
<p>Tiada resit yang belum direlease.</p>
|
||||
@else
|
||||
<table class="table table-bordered text-center">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Nama Pembayar</th>
|
||||
<th>ID Pembayar</th>
|
||||
<th>Cawangan</th>
|
||||
<th>Resit ID</th>
|
||||
<th>Billplz ID</th>
|
||||
<th>Jumlah (RM)</th>
|
||||
<th>Tarikh Dibayar</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($processingResits as $resit)
|
||||
<tr>
|
||||
<td>{{ $resit->payer_name }}</td>
|
||||
<td>{{ $resit->user_id }}</td>
|
||||
<td>{{ $resit->cawangan_nama ?? '-' }}</td>
|
||||
<td>{{ $resit->id }}</td>
|
||||
<td>{{ $resit->billplz_id }}</td>
|
||||
<td>{{ number_format($resit->total_payment, 2) }}</td>
|
||||
<td>{{ \Carbon\Carbon::parse($resit->paid_at)->format('d/m/Y H:i') }}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -13,6 +13,8 @@
|
||||
<div class="card-body">
|
||||
@hasrole('operasi')
|
||||
<a href="{{ route('pembida.statuspembayaranbypembida') }}" class="btn btn-success mb-2">Status Pembayaran Mengikut Nama Pembida</a>
|
||||
<a href="{{ route('pembida.semakanbillplz') }}" class="btn btn-success mb-2">Semakan BILLPLZ</a>
|
||||
|
||||
@endhasrole
|
||||
@hasrole('account')
|
||||
<a href="{{ route('account.statuspembayaranbypembida') }}" class="btn btn-success mb-2">Status Pembayaran Mengikut Nama Pembida</a>
|
||||
|
||||
+1
-2
@@ -43,7 +43,6 @@ Route::group(['middleware' => ['auth:sanctum']], function () {
|
||||
Route::get('/getProfile', [AuthController::class, 'getProfile']);
|
||||
// User
|
||||
Route::post('/user/logout', [AuthController::class, 'logoutUser']);
|
||||
Route::get('/user/profile/{nokp}', [UserController::class, 'getProfileUser']);
|
||||
Route::post('/password/reset', [ResetPasswordController::class, 'reset']);
|
||||
//change password user
|
||||
Route::post('/changePassword', [UserController::class, 'changePassword']);
|
||||
@@ -52,7 +51,7 @@ Route::group(['middleware' => ['auth:sanctum']], function () {
|
||||
Route::get('/user/profile', [UserController::class, 'getProfileUser']);
|
||||
Route::put('/userUpdate/profile', [UserController::class, 'updateProfileUser']);
|
||||
|
||||
Route::get('/requestTac', [UserController::class, 'requestTac']);
|
||||
Route::post('/requestTac', [UserController::class, 'requestTac']);
|
||||
Route::post('/verifyTac', [UserController::class, 'verifyTac']);
|
||||
|
||||
//============HOME===========================
|
||||
|
||||
@@ -364,6 +364,9 @@ Route::group(['middleware' => ['permission:pengesahanpembida'],'prefix'=>'pembid
|
||||
Route::get('/statuspembayaranbypembida',['as'=>'pembida.statuspembayaranbypembida','uses'=>'PembidaController@statuspembayaranbypembida']);
|
||||
Route::get('/statusserahanbidaan',['as'=>'pembida.statusserahanbidaan','uses'=>'PembidaController@statusserahanbidaan']);
|
||||
Route::get('/statusserahanbypembida',['as'=>'pembida.statusserahanbypembida','uses'=>'PembidaController@statusserahanbypembida']);
|
||||
Route::get('/semakanbillplz',['as'=>'pembida.semakanbillplz','uses'=>'PembidaController@semakanbillplz']);
|
||||
Route::post('/semakanbillplz/proses',['as'=>'pembida.prosesBillplz','uses'=>'PembidaController@prosesBillplz']);
|
||||
|
||||
|
||||
// Route::get('/pemenangkedua',['as'=>'pembida.pemenangkedua','uses'=>'PembidaController@pemenangkedua']);
|
||||
// Route::get('/senaraipemenangkedua/{lelong_id}/{kodcaw}',['as'=>'pembida.senaraipemenangkedua','uses'=>'PembidaController@senaraipemenangkedua']);
|
||||
|
||||
Reference in New Issue
Block a user