format('d/m/Y h:i:s A'); $compound = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('kpd', $kpd)->first(); $file = ConfidentialFile::with(['Memo' => function($q){ $q->orderBy('updated_at','ASC'); }],['Investigation' => function($q){ $q->orderBy('updated_at','ASC'); }],'ItemInventory')->where('_id',$compound->ConfidentialFile->_id)->first(); $destinationPath = 'document/'.$compound->ConfidentialFile->no_siri.'/pdf'; if(!File::exists(public_path().'/'.$destinationPath)) { File::makeDirectory(public_path().'/'.$destinationPath, $mode = 0777, true, true); } /** ** Compound **/ $tawaran = ''; if($compound->jumlah_kemaskini_kompaun == ''){ $tawaran = $compound->jumlah_asal_kompaun; }else{ $tawaran = $compound->jumlah_kemaskini_kompaun; } $staff = Staff::with('StaffDetail')->where('_id', $compound->dikeluarkan)->first(); $department = Department::where('_id', $compound->jbkod)->first(); $akta = DeedLaw::where('_id', $compound->akta)->first(); $faulty = Faulty::with('DeedLaw')->where('_id',$compound->seksyen_kesalahan)->first(); $site = SiteSetting::first(); $tarikh = date('d/m/Y', strtotime($compound['created_at'])); $masa = date('h:i:s a', strtotime($compound['created_at'])); return view('pdf.compound_payment', compact('compound','staff','department','akta','faulty','picArray','tawaran','site','tarikh','masa')); } public function makeWebPayment(Request $request){ $crypt = new \Illuminate\Encryption\Encrypter('F1339A1149AB6FFA9BDDDC6AE677EA90', Config::get( 'app.cipher' )); $encry = $crypt->encrypt('mpkb:0c79ba6d11631e9619d5ff46711867dc:'.$request->orderid.':'.$request->amount); $client = new \GuzzleHttp\Client(); $result = $client->request('POST', 'https://staging.kelantanpay.com.my/api/payment/mobile/request', [ 'verify' => false, 'form_params' => [ 'amount' => $request->amount, 'orderid' => $request->orderid, 'userid' => $request->userid, 'name' => $request->name, 'email' => $request->email, 'mobile' => $request->mobile, 'description' => $request->orderid, 'merchantid' => 'mpkb', 'country' => 'MY', 'key'=> $encry, 'returnurl' => 'https://mdch1.sipadu.my/compound/'.$request->orderid.'/view/details', 'update_payment' => 'https://mdch1.sipadu.my/api/update/payment/compound', ] ]); $response = json_decode($result->getBody()->getContents()); if($response->status == true){ return redirect($response->url); }else if($response->status == false){ return redirect('https://mdch1.sipadu.my/compound/'.$request->orderid.'/view/details'); } } public function makeMobilePayment(Request $request){ $crypt = new \Illuminate\Encryption\Encrypter('F1339A1149AB6FFA9BDDDC6AE677EA90', Config::get( 'app.cipher' )); $encry = $crypt->encrypt('mpkb:0c79ba6d11631e9619d5ff46711867dc:'.$request->orderid.':'.$request->amount); $client = new \GuzzleHttp\Client(); $result = $client->request('POST', 'https://staging.kelantanpay.com.my/api/payment/mobile/request', [ 'verify' => false, 'form_params' => [ 'amount' => $request->amount, 'orderid' => $request->orderid, 'userid' => $request->userid, 'name' => $request->name, 'email' => $request->email, 'mobile' => $request->mobile, 'description' => $request->orderid, 'merchantid' => 'mpkb', 'country' => 'MY', 'key'=> $encry, 'returnurl' => 'https://demo.sipadu.my/compound/'.$request->orderid.'/view/details', 'update_payment' => 'https://demo.sipadu.my/api/update/payment/compound', ] ]); $response = $result->getBody()->getContents(); return $response; } }