add check registrasi

parent e5736e04
......@@ -190,6 +190,8 @@ public function store(Request $request) {
'tagihan' => $totalHarga
];
$registrasi->save();
$generatedVa = $this->generateVa($multipartData);
$arrResponse = json_decode($generatedVa, true);
$registrasi->status_va = $arrResponse['BTNresponse'];
......@@ -197,6 +199,7 @@ public function store(Request $request) {
$registrasi->save();
if($arrResponse['BTNresponse'] != 'Request has been processed successfully'){
DB::rollBack();
Log::error('---');
......@@ -261,6 +264,46 @@ public function addFormKegiatan(Request $request)
return view('form_kegiatan', $data);
}
public function getDataRegis($va)
{
$registrasi = Registrasi::query()
->with('pkKegiatan', 'pkRegistrasiPeserta.rKegiatanPeserta', 'pkRegistrasiPeserta.rKonferensiPeserta')
->where('kode_registrasi', $va)
->first();
$konvensi = Kegiatan::query()->find('498633a9-082c-4a4a-9dbd-e20b678ec15e');
$konv = $konvensi->toArray();
$totalHarga = $totalHarga = (int) $konvensi->harga;
foreach($registrasi->pkRegistrasiPeserta as $item){
if(is_null($item->rKonferensiPeserta)){
continue;
}
$konferensi = $item->rKonferensiPeserta;
$kegkonaspi = $item->rKegiatanPeserta;
$totalHarga += (int) $konferensi->harga;
$kegPeserta[] = [
'idkon' => $konferensi->id,
'namakon' => $konferensi->nama,
'hargakon' => $konferensi->harga,
'namakeg' => $kegkonaspi->nama
];
}
$data = [
'registrasi' => $registrasi,
'tglRegistrasi' => $registrasi->created_at,
'konaspi' => $konv,
'hargaKonferensi' => $kegPeserta,
'totalHarga' => $totalHarga,
];
return $data;
}
public function updatePembayaran(Request $request, $va)
{
if($request->bearerToken() != 'zGKEX7CDNLOvVtetz6lqFZzhZv11Gr9Y2MKVIQmqusAyD5STPPEt7ZC1gl8P'){
......@@ -271,12 +314,15 @@ public function updatePembayaran(Request $request, $va)
}
$registrasi = Registrasi::query()
->with('pkKegiatan', 'pkRegistrasiPeserta.rKegiatanPeserta', 'pkRegistrasiPeserta.rKonferensiPeserta')
->where('kode_registrasi', $va)
->update([
'tanggal_bayar' => Carbon::now()
]);
//SendMail::dispatch($data, 'email.selesai_pembayaran', $data['registrasi']->email, 'registrasi', 'email_pembayaran_sent_at');
$data = $this->getDataRegis($va);
SendMail::dispatch($data, 'email.selesai_pembayaran', $data['registrasi']->email, 'registrasi', 'email_pembayaran_sent_at');
return response([
'status' => 200,
......@@ -290,5 +336,12 @@ public function testEmail(Request $request)
SendMail::dispatch($data, 'email.invoice', $data['registrasi']->email, 'registrasi', 'email_regis_sent_at');
}
public function checkRegistrasi(Request $request, $va)
{
$data = $this->getDataRegis($va);
return view('email.selesai_pembayaran', $data);
}
}
......@@ -7,7 +7,7 @@
<div class="invoice-print">
<div class="row">
<div class="col-lg-12">
<p class="section-lead" style="font-size: 12pt">Terimakasih telah mendaftar KONASPI XI 2024. Pembayaran kegiatan telah kami terima</p>
<p class="section-lead" style="font-size: 12pt">Terimakasih telah mendaftar KONASPI XI 2024. ({{ !is_null($registrasi->tanggal_bayar) ? 'LUNAS' : 'Menunggu Pembayaran' }})</p>
<div class="invoice-title">
<h2>Invoice</h2>
<div class="invoice-number">No. Transaksi #{{$registrasi['kode_registrasi'] ?? 'param' }}</div>
......@@ -49,7 +49,7 @@
<div class="row mt-4">
<div class="col-md-12" style="font-size: 12pt">
<p class="section-lead">Rincian (Lunas)</p>
<p class="section-lead">Rincian ({{ !is_null($registrasi->tanggal_bayar) ? 'LUNAS' : 'Menunggu Pembayaran' }})</p>
<div class="table-responsive">
<table class="table table-striped table-hover table-md">
<tr>
......
......@@ -46,3 +46,4 @@
return view('email.invoice');
});
Route::get('test/email', [RegistrasiController::class, 'testEmail']);
Route::get('check/regis/{va}', [RegistrasiController::class, 'checkRegistrasi']);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment