Dashboard sipadu mbip
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

PaymentController.php 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. namespace App\Http\Controllers;
  3. use Illuminate\Http\Request;
  4. use App\Http\Controllers\Controller;
  5. use Illuminate\Support\Facades\Auth;
  6. use Illuminate\Support\Facades\Input;
  7. use LynX39\LaraPdfMerger\Facades\PdfMerger;
  8. use Validator;
  9. use Session;
  10. use Config;
  11. use File;
  12. use Carbon\Carbon;
  13. use PDF;
  14. use App\SiteSetting;
  15. use App\Model\Staff;
  16. use App\Model\StaffDetail;
  17. use App\Model\User;
  18. use App\Model\UserDetail;
  19. use App\Model\Module\Roles;
  20. use App\Model\Module\Department;
  21. use App\Model\Module\DeedLaw;
  22. use App\Model\Module\Faulty;
  23. use App\Model\Module\Compound;
  24. use App\Model\Module\CompoundInvestigation;
  25. use App\Model\Module\ConfidentialFile;
  26. use App\Model\Module\Investigation;
  27. use App\Model\Module\ItemInventory;
  28. use App\Model\Module\History;
  29. use App\Model\Module\SubHistory;
  30. use App\Model\Module\Memo;
  31. use App\Model\Module\Attachment;
  32. use App\Jobs\UpdateCompoundPrice;
  33. class PaymentController extends Controller
  34. {
  35. /**
  36. * Create payment controller.
  37. *
  38. * @return json
  39. */
  40. public function requestCompoundPaymentPdf($kpd) {
  41. $ready_view_pdf = false;
  42. $availablePDF = array();
  43. $now = Carbon::now()->format('d/m/Y h:i:s A');
  44. $compound = Compound::with('ConfidentialFile','Attachment','CompoundInvestigation')->where('kpd', $kpd)->first();
  45. $file = ConfidentialFile::with(['Memo' => function($q){
  46. $q->orderBy('updated_at','ASC');
  47. }],['Investigation' => function($q){
  48. $q->orderBy('updated_at','ASC');
  49. }],'ItemInventory')->where('_id',$compound->ConfidentialFile->_id)->first();
  50. $destinationPath = 'document/'.$compound->ConfidentialFile->no_siri.'/pdf';
  51. if(!File::exists(public_path().'/'.$destinationPath)) {
  52. File::makeDirectory(public_path().'/'.$destinationPath, $mode = 0777, true, true);
  53. }
  54. /**
  55. ** Compound
  56. **/
  57. $tawaran = '';
  58. if($compound->jumlah_kemaskini_kompaun == ''){
  59. $tawaran = $compound->jumlah_asal_kompaun;
  60. }else{
  61. $tawaran = $compound->jumlah_kemaskini_kompaun;
  62. }
  63. $staff = Staff::with('StaffDetail')->where('no_badan', $compound->dikeluarkan)->first();
  64. $department = Department::where('_id', $staff->StaffDetail->jbkod)->first();
  65. $akta = DeedLaw::where('_id', $compound->akta)->first();
  66. $faulty = Faulty::with('DeedLaw')->where('itkod',$compound->seksyen_kesalahan)->first();
  67. $site = SiteSetting::first();
  68. return view('pdf.compound_payment', compact('compound','staff','department','akta','faulty','picArray','tawaran','site'));
  69. }
  70. public function makeWebPayment(Request $request){
  71. $crypt = new \Illuminate\Encryption\Encrypter('F1339A1149AB6FFA9BDDDC6AE677EA90', Config::get( 'app.cipher' ));
  72. $encry = $crypt->encrypt('mpkb:0c79ba6d11631e9619d5ff46711867dc:'.$request->orderid.':'.$request->amount);
  73. $client = new \GuzzleHttp\Client();
  74. $result = $client->request('POST', 'https://staging.kelantanpay.com.my/api/payment/mobile/request', [
  75. 'verify' => false,
  76. 'form_params' => [
  77. 'amount' => $request->amount,
  78. 'orderid' => $request->orderid,
  79. 'userid' => $request->userid,
  80. 'name' => $request->name,
  81. 'email' => $request->email,
  82. 'mobile' => $request->mobile,
  83. 'description' => $request->orderid,
  84. 'merchantid' => 'mpkb',
  85. 'country' => 'MY',
  86. 'key'=> $encry,
  87. 'returnurl' => 'https://mdch1.sipadu.my/compound/'.$request->orderid.'/view/details',
  88. 'update_payment' => 'https://mdch1.sipadu.my/api/update/payment/compound',
  89. ]
  90. ]);
  91. $response = json_decode($result->getBody()->getContents());
  92. if($response->status == true){
  93. return redirect($response->url);
  94. }else if($response->status == false){
  95. return redirect('https://mdch1.sipadu.my/compound/'.$request->orderid.'/view/details');
  96. }
  97. }
  98. public function makeMobilePayment(Request $request){
  99. $crypt = new \Illuminate\Encryption\Encrypter('F1339A1149AB6FFA9BDDDC6AE677EA90', Config::get( 'app.cipher' ));
  100. $encry = $crypt->encrypt('mpkb:0c79ba6d11631e9619d5ff46711867dc:'.$request->orderid.':'.$request->amount);
  101. $client = new \GuzzleHttp\Client();
  102. $result = $client->request('POST', 'https://staging.kelantanpay.com.my/api/payment/mobile/request', [
  103. 'verify' => false,
  104. 'form_params' => [
  105. 'amount' => $request->amount,
  106. 'orderid' => $request->orderid,
  107. 'userid' => $request->userid,
  108. 'name' => $request->name,
  109. 'email' => $request->email,
  110. 'mobile' => $request->mobile,
  111. 'description' => $request->orderid,
  112. 'merchantid' => 'mpkb',
  113. 'country' => 'MY',
  114. 'key'=> $encry,
  115. 'returnurl' => 'https://demo.sipadu.my/compound/'.$request->orderid.'/view/details',
  116. 'update_payment' => 'https://demo.sipadu.my/api/update/payment/compound',
  117. ]
  118. ]);
  119. $response = $result->getBody()->getContents();
  120. return $response;
  121. }
  122. }