Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
konaspi2024
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Siti Aisah
konaspi2024
Commits
f79abb5b
Commit
f79abb5b
authored
Mar 07, 2024
by
Muhammad Iskandar Java
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add pembayaran va
parent
69569b4a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
44 deletions
+46
-44
app/Http/Controllers/RegistrasiController.php
+42
-43
app/Models/Registrasi.php
+4
-1
No files found.
app/Http/Controllers/RegistrasiController.php
View file @
f79abb5b
...
...
@@ -69,22 +69,18 @@ public function store(Request $request) {
$tglRegistrasi
=
Carbon
::
now
()
->
format
(
'Y-m-d h:i:s'
);
// $kegiatan = Kegiatan::find($request->kegiatan);
// $konferensi = Konferensi::find($request->konferensi);
$id_registrasi
=
Registrasi
::
query
()
->
create
(
$registrasi
)
->
id
;
$multipartData
=
[
'noid'
=>
$id_registrasi
,
'nama'
=>
$request
->
nama
,
'tagihan'
=>
$tagihan
];
$generatedVa
=
$this
->
generateVa
(
$multipartData
);
$konaspi
=
Kegiatan
::
query
()
->
where
(
'id'
,
'498633a9-082c-4a4a-9dbd-e20b678ec15e'
)
->
first
();
$registrasi
=
Registrasi
::
query
()
->
create
(
$registrasi
);
$id_registrasi
=
$registrasi
->
id
;
$kode_registrasi
=
$registrasi
->
kode_registrasi
;
//inisial harga
// dd($konaspi);
$totalHarga
=
(
int
)
$konaspi
->
harga
;
foreach
(
$request
->
konferensi
as
$kon
){
$i
=
0
;
$daftarKonferensi
[]
=
$kon
;
$konferensi
=
Konferensi
::
select
(
'nama'
)
->
where
(
'id'
,
$kon
)
->
first
();
$konferensi
=
Konferensi
::
query
(
)
->
where
(
'id'
,
$kon
)
->
first
();
foreach
(
$request
->
input
(
'kegiatan'
.
$i
)
as
$keg
){
$daftarKegiatan
[]
=
$keg
;
...
...
@@ -100,15 +96,38 @@ public function store(Request $request) {
'harga'
=>
$kegiatan
[
$i
][
'harga'
]
];
$totalHarga
+=
(
int
)
$konferensi
->
harga
;
$i
++
;
}
$multipartData
=
[
'noid'
=>
$kode_registrasi
,
'nama'
=>
$request
->
nama
,
'tagihan'
=>
$totalHarga
];
$generatedVa
=
$this
->
generateVa
(
$multipartData
);
$arrResponse
=
json_decode
(
$generatedVa
,
true
);
$registrasi
->
status_va
=
$arrResponse
[
'BTNresponse'
];
$registrasi
->
save
();
if
(
$arrResponse
[
'BTNresponse'
]
!=
'Request has been processed successfully'
){
DB
::
rollBack
();
Log
::
error
(
'---'
);
Log
::
error
(
$multipartData
);
Log
::
error
(
$arrResponse
[
'BTNresponse'
]);
Log
::
error
(
'---'
);
return
redirect
()
->
back
()
->
with
(
'error'
,
'Data failed to save'
);
}
foreach
(
$kegiatanpeserta
as
$keg
){
KegiatanPeserta
::
query
()
->
create
(
$keg
);
}
Log
::
debug
(
$generatedVa
);
DB
::
commit
();
// return redirect()->back()
...
...
@@ -131,38 +150,18 @@ private function generateVa($multipartData)
{
$client
=
new
Client
();
$options
=
[
'headers'
=>
[
'Cookie'
=>
'XSRF-TOKEN=eyJpdiI6IkNNRXc1SmprYzMxL3FpQTE2NHI2UHc9PSIsInZhbHVlIjoibzlLcE80TzAyUjJYT3VLTUJSblNIRkpXdytOS0djM0U5azRrMFY1SzRwei92ZzB4VWV0bVMyeGdNSE1LZ2RxOUw4RC9QbGw4V1BWaU5id2dFTWVkbVJaZFNOOWFDRENMQVBzdlhycEE4TDRPZmRzK2xQa21ZWUJMOFg2TGJ2ZVUiLCJtYWMiOiIwMWM2MGM1ZTAyODlhOThjYWYwNDk1OWUwNTUyMWM0MWFmMTA5MDc2OGYzNzliYTViYTAxOTg0MTJjNDY1MmZkIiwidGFnIjoiIn0%3D; siva_session=eyJpdiI6Ii9qeEt5S0xDSS91QThndEp4eTRNS0E9PSIsInZhbHVlIjoiNGxJQ1oxTGtMOXFodTRPUFJRMFY0R1ZXNUNwV0FnSXhDUzJ5VkdNdmZJUWUvdlZCZzVjN3E3WE1MajZhZDlKeng5WWVhcTFOc1NXTmNPVWR1RkZpaEQ0MFdRbVJpTEp6YXo4bzUvNkJtTkpKRWRSRTRNaHEyZndLYlNtYXUxUzQiLCJtYWMiOiJkOGRjMjUwZjlhYTIzYmM4NmUwMzQ1MjhlZTNjMDdjZWI2MWNkYjQ3ZGRjZTI5MDlhZTZjODVkYjhhNDU0YTYzIiwidGFnIjoiIn0%3D'
],
'multipart'
=>
new
MultipartStream
([
[
'name'
=>
'credential'
,
'contents'
=>
'$2a$08$xSX/XuObiJ3GoJWhjDTyXepT64o1ze.A/.OVYB15uzKW3V7pxgZ6O'
],
[
'name'
=>
'noid'
,
'contents'
=>
$multipartData
[
'noid'
]
],
[
'name'
=>
'nama'
,
'contents'
=>
$multipartData
[
'nama'
]
],
[
'name'
=>
'tagihan'
,
'contents'
=>
$multipartData
[
'tagihan'
]
],
[
'name'
=>
'flag'
,
'contents'
=>
'F'
],
[
'name'
=>
'expired_date'
,
'contents'
=>
''
'form_params'
=>
[
'credential'
=>
'$2a$08$xSX/XuObiJ3GoJWhjDTyXepT64o1ze.A/.OVYB15uzKW3V7pxgZ6O'
,
'noid'
=>
$multipartData
[
'noid'
],
'nama'
=>
$multipartData
[
'nama'
],
'tagihan'
=>
$multipartData
[
'tagihan'
],
'flag'
=>
'F'
,
'expired_date'
=>
''
,
'deskripsi'
=>
'pembayaran konaspi'
]
])
];
$response
=
$client
->
request
(
'POST'
,
'http
://neo-sidata.inf
/btn_v2/create'
,
$options
);
$response
=
$client
->
request
(
'POST'
,
'http
s://neosidata.unesa.ac.id
/btn_v2/create'
,
$options
);
return
$response
->
getBody
()
->
getContents
();
}
...
...
app/Models/Registrasi.php
View file @
f79abb5b
...
...
@@ -28,7 +28,10 @@ class Registrasi extends Model
'alamat'
,
'kode_pos'
,
'kota'
,
'kode_registrasi'
'kode_registrasi'
,
'tagihan'
,
'status_va'
,
'tanggal_bayar'
];
public
function
pkKegiatan
(){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment