add generate va

parent ff94b584
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
use App\Models\Registrasi; use App\Models\Registrasi;
use Carbon\Carbon; use Carbon\Carbon;
use Exception; use Exception;
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\MultipartStream;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
...@@ -90,6 +92,14 @@ public function store(Request $request) { ...@@ -90,6 +92,14 @@ public function store(Request $request) {
'harga' => $kegiatan[$i]['harga'] 'harga' => $kegiatan[$i]['harga']
]; ];
$multipartData = [
'noid' => $id_registrasi,
'nama' => $request->nama,
'tagihan' => $kegiatan[$i]['harga']
];
$this->generateVa($multipartData);
$i++; $i++;
} }
...@@ -114,6 +124,46 @@ public function store(Request $request) { ...@@ -114,6 +124,46 @@ public function store(Request $request) {
} }
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' => ''
]
])
];
$response = $client->request('POST', 'http://neo-sidata.inf/btn_v2/create', $options);
return $response->getBody()->getContents();
}
public function addFormKegiatan(Request $request) public function addFormKegiatan(Request $request)
{ {
$data['kegiatan'] = Kegiatan::get(); $data['kegiatan'] = Kegiatan::get();
......
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