|
|
|
@@ -1,142 +1,142 @@ |
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
use Illuminate\Support\Facades\Input;
|
|
|
|
use LynX39\LaraPdfMerger\Facades\PdfMerger;
|
|
|
|
|
|
|
|
use Validator;
|
|
|
|
use Session;
|
|
|
|
use Config;
|
|
|
|
use File;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use PDF;
|
|
|
|
|
|
|
|
use App\SiteSetting;
|
|
|
|
use App\Model\Staff;
|
|
|
|
use App\Model\StaffDetail;
|
|
|
|
use App\Model\User;
|
|
|
|
use App\Model\UserDetail;
|
|
|
|
use App\Model\Module\Roles;
|
|
|
|
use App\Model\Module\Department;
|
|
|
|
use App\Model\Module\DeedLaw;
|
|
|
|
use App\Model\Module\Faulty;
|
|
|
|
use App\Model\Module\Compound;
|
|
|
|
use App\Model\Module\CompoundInvestigation;
|
|
|
|
use App\Model\Module\ConfidentialFile;
|
|
|
|
use App\Model\Module\Investigation;
|
|
|
|
use App\Model\Module\ItemInventory;
|
|
|
|
use App\Model\Module\History;
|
|
|
|
use App\Model\Module\SubHistory;
|
|
|
|
use App\Model\Module\Memo;
|
|
|
|
use App\Model\Module\Attachment;
|
|
|
|
|
|
|
|
use App\Jobs\UpdateCompoundPrice;
|
|
|
|
|
|
|
|
class PaymentController extends Controller
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Create payment controller.
|
|
|
|
*
|
|
|
|
* @return json
|
|
|
|
*/
|
|
|
|
public function requestCompoundPaymentPdf($kpd) {
|
|
|
|
|
|
|
|
$ready_view_pdf = false;
|
|
|
|
$availablePDF = array();
|
|
|
|
$now = Carbon::now()->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('no_badan', $compound->dikeluarkan)->first();
|
|
|
|
$department = Department::where('_id', $staff->StaffDetail->jbkod)->first();
|
|
|
|
$akta = DeedLaw::where('_id', $compound->akta)->first();
|
|
|
|
$faulty = Faulty::with('DeedLaw')->where('itkod',$compound->seksyen_kesalahan)->first();
|
|
|
|
$site = SiteSetting::first();
|
|
|
|
return view('pdf.compound_payment', compact('compound','staff','department','akta','faulty','picArray','tawaran','site'));
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
<?php |
|
|
|
|
|
|
|
namespace App\Http\Controllers; |
|
|
|
|
|
|
|
use Illuminate\Http\Request; |
|
|
|
use App\Http\Controllers\Controller; |
|
|
|
use Illuminate\Support\Facades\Auth; |
|
|
|
use Illuminate\Support\Facades\Input; |
|
|
|
use LynX39\LaraPdfMerger\Facades\PdfMerger; |
|
|
|
|
|
|
|
use Validator; |
|
|
|
use Session; |
|
|
|
use Config; |
|
|
|
use File; |
|
|
|
use Carbon\Carbon; |
|
|
|
use PDF; |
|
|
|
|
|
|
|
use App\SiteSetting; |
|
|
|
use App\Model\Staff; |
|
|
|
use App\Model\StaffDetail; |
|
|
|
use App\Model\User; |
|
|
|
use App\Model\UserDetail; |
|
|
|
use App\Model\Module\Roles; |
|
|
|
use App\Model\Module\Department; |
|
|
|
use App\Model\Module\DeedLaw; |
|
|
|
use App\Model\Module\Faulty; |
|
|
|
use App\Model\Module\Compound; |
|
|
|
use App\Model\Module\CompoundInvestigation; |
|
|
|
use App\Model\Module\ConfidentialFile; |
|
|
|
use App\Model\Module\Investigation; |
|
|
|
use App\Model\Module\ItemInventory; |
|
|
|
use App\Model\Module\History; |
|
|
|
use App\Model\Module\SubHistory; |
|
|
|
use App\Model\Module\Memo; |
|
|
|
use App\Model\Module\Attachment; |
|
|
|
|
|
|
|
use App\Jobs\UpdateCompoundPrice; |
|
|
|
|
|
|
|
class PaymentController extends Controller |
|
|
|
{ |
|
|
|
/** |
|
|
|
* Create payment controller. |
|
|
|
* |
|
|
|
* @return json |
|
|
|
*/ |
|
|
|
public function requestCompoundPaymentPdf($kpd) { |
|
|
|
|
|
|
|
$ready_view_pdf = false; |
|
|
|
$availablePDF = array(); |
|
|
|
$now = Carbon::now()->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('no_badan', $compound->dikeluarkan)->first(); |
|
|
|
$department = Department::where('_id', $compound->jbkod)->first(); |
|
|
|
$akta = DeedLaw::where('_id', $compound->akta)->first(); |
|
|
|
$faulty = Faulty::with('DeedLaw')->where('itkod',$compound->seksyen_kesalahan)->first(); |
|
|
|
$site = SiteSetting::first(); |
|
|
|
return view('pdf.compound_payment', compact('compound','staff','department','akta','faulty','picArray','tawaran','site')); |
|
|
|
} |
|
|
|
|
|
|
|
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; |
|
|
|
} |
|
|
|
} |