add check registrasi

parent e5736e04
...@@ -190,6 +190,8 @@ public function store(Request $request) { ...@@ -190,6 +190,8 @@ public function store(Request $request) {
'tagihan' => $totalHarga 'tagihan' => $totalHarga
]; ];
$registrasi->save();
$generatedVa = $this->generateVa($multipartData); $generatedVa = $this->generateVa($multipartData);
$arrResponse = json_decode($generatedVa, true); $arrResponse = json_decode($generatedVa, true);
$registrasi->status_va = $arrResponse['BTNresponse']; $registrasi->status_va = $arrResponse['BTNresponse'];
...@@ -197,6 +199,7 @@ public function store(Request $request) { ...@@ -197,6 +199,7 @@ public function store(Request $request) {
$registrasi->save(); $registrasi->save();
if($arrResponse['BTNresponse'] != 'Request has been processed successfully'){ if($arrResponse['BTNresponse'] != 'Request has been processed successfully'){
DB::rollBack(); DB::rollBack();
Log::error('---'); Log::error('---');
...@@ -261,6 +264,46 @@ public function addFormKegiatan(Request $request) ...@@ -261,6 +264,46 @@ public function addFormKegiatan(Request $request)
return view('form_kegiatan', $data); 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) public function updatePembayaran(Request $request, $va)
{ {
if($request->bearerToken() != 'zGKEX7CDNLOvVtetz6lqFZzhZv11Gr9Y2MKVIQmqusAyD5STPPEt7ZC1gl8P'){ if($request->bearerToken() != 'zGKEX7CDNLOvVtetz6lqFZzhZv11Gr9Y2MKVIQmqusAyD5STPPEt7ZC1gl8P'){
...@@ -271,12 +314,15 @@ public function updatePembayaran(Request $request, $va) ...@@ -271,12 +314,15 @@ public function updatePembayaran(Request $request, $va)
} }
$registrasi = Registrasi::query() $registrasi = Registrasi::query()
->with('pkKegiatan', 'pkRegistrasiPeserta.rKegiatanPeserta', 'pkRegistrasiPeserta.rKonferensiPeserta')
->where('kode_registrasi', $va) ->where('kode_registrasi', $va)
->update([ ->update([
'tanggal_bayar' => Carbon::now() '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([ return response([
'status' => 200, 'status' => 200,
...@@ -290,5 +336,12 @@ public function testEmail(Request $request) ...@@ -290,5 +336,12 @@ public function testEmail(Request $request)
SendMail::dispatch($data, 'email.invoice', $data['registrasi']->email, 'registrasi', 'email_regis_sent_at'); 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 @@ ...@@ -7,7 +7,7 @@
<div class="invoice-print"> <div class="invoice-print">
<div class="row"> <div class="row">
<div class="col-lg-12"> <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"> <div class="invoice-title">
<h2>Invoice</h2> <h2>Invoice</h2>
<div class="invoice-number">No. Transaksi #{{$registrasi['kode_registrasi'] ?? 'param' }}</div> <div class="invoice-number">No. Transaksi #{{$registrasi['kode_registrasi'] ?? 'param' }}</div>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<div class="row mt-4"> <div class="row mt-4">
<div class="col-md-12" style="font-size: 12pt"> <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"> <div class="table-responsive">
<table class="table table-striped table-hover table-md"> <table class="table table-striped table-hover table-md">
<tr> <tr>
......
...@@ -46,3 +46,4 @@ ...@@ -46,3 +46,4 @@
return view('email.invoice'); return view('email.invoice');
}); });
Route::get('test/email', [RegistrasiController::class, 'testEmail']); 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