Merge branch 'faiqahzaman' of https://gitlab.com/azfararsyad/lelong into faiqahzaman
This commit is contained in:
@@ -153,7 +153,7 @@ class ApiController extends Controller
|
||||
|
||||
$response = $bill->create(
|
||||
$collection_id,
|
||||
$request->email,
|
||||
// $request->email,
|
||||
$request->notel,
|
||||
$request->name,
|
||||
Money::MYR($total_bayaran),
|
||||
@@ -167,7 +167,7 @@ class ApiController extends Controller
|
||||
|
||||
$resit = new Resit;
|
||||
$resit->user_id = $request->user_id;
|
||||
$resit->lelongbid_id = $request->lelongbid_id;
|
||||
$resit->lelongbid_id = null;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->billplz_id = $billcode['id'];
|
||||
$resit->resit_type = 1;
|
||||
@@ -221,27 +221,28 @@ class ApiController extends Controller
|
||||
$data = $bill->webhook($request->toArray());
|
||||
|
||||
if($data['billplz']['paid'] == 'true'){
|
||||
Http::put(config('api.url') . '/api/online/transaction',[
|
||||
'billplz_id' => $data['billplz']['id'],
|
||||
'status' => 'PAID',
|
||||
'paid_at' => $data['billplz']['paid_at']
|
||||
]);
|
||||
$resit = Resit::where('billplz_id','=',$data['billplz']['id'])->first();
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $data['billplz']['paid_at'];
|
||||
$resit->save();
|
||||
|
||||
$transactionOnline = Http::get(config('api.url') . '/api/transaction/online/express',[
|
||||
'billplz_id' => $data['billplz']['id']
|
||||
])->json();
|
||||
|
||||
return redirect()->route('pay.success',[
|
||||
'transactionOnline' => $transactionOnline
|
||||
]);
|
||||
// $transactionOnline = Http::get(config('api.url') . '/api/transaction/online/express',[
|
||||
// 'billplz_id' => $data['billplz']['id']
|
||||
// ])->json();
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'resit' => $resit
|
||||
]);
|
||||
|
||||
}else{
|
||||
Http::put(config('api.url') . '/api/online/transaction',[
|
||||
'billplz_id' => $data['billplz']['id'],
|
||||
'status' => 'UNSUCCESSFUL',
|
||||
'paid_at' => null
|
||||
]);
|
||||
return redirect()->route('pay.failed');
|
||||
$resit = Resit::where('billplz_id','=',$data['billplz']['id'])->first();
|
||||
$resit->status = 'UNSUCCESSFUL';
|
||||
$resit->paid_at = null;
|
||||
$resit->save();
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'resit' => $resit
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,39 +285,5 @@ class ApiController extends Controller
|
||||
return redirect()->route('pay.failed');
|
||||
}
|
||||
}
|
||||
|
||||
public function successPayment(Request $request){
|
||||
$transactionOnline = $request->transactionOnline;
|
||||
|
||||
// dd($transactionOnline);
|
||||
|
||||
$arraygadai = array();
|
||||
$arraycawangan = array();
|
||||
// dd($transactionOnline);
|
||||
foreach($transactionOnline as $index1=>$trans)
|
||||
{
|
||||
$cawangan_info = Http::get(config('api.url') . '/api/cawangan/'. $trans['kodcaw'])->json();
|
||||
$cawangan = Http::get(config('api.url') . '/api/cawangan/detail/'. $trans['kodcaw'])->json();
|
||||
$cawangan_detail = $cawangan[0];
|
||||
$nama_cawangan = $cawangan_info['details_caw'];
|
||||
$gadai = Http::get(config('api.url') .'/api/gadai/norujukan/'.$trans['norujukan'])->json();
|
||||
$gadai = $gadai[0][0];
|
||||
|
||||
array_push($arraygadai,$gadai);
|
||||
array_push($arraycawangan,$cawangan_detail);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dd($arraygadai,$arraycawangan);
|
||||
|
||||
// return view('pembayaran.result.berjaya',compact('transactionOnline','arraycawangan','arraygadai'));
|
||||
return view('pembayaran.result.berjayaportal',compact('transactionOnline','arraycawangan','arraygadai'));
|
||||
}
|
||||
|
||||
public function failedPayment(){
|
||||
// return view('pembayaran.result.gagal');
|
||||
return view('pembayaran.result.gagalportal');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,8 +32,6 @@ Route::get('/callback', [ApiController::class, 'feepayment']);
|
||||
Route::post('/feepayment', 'App\Http\Controllers\ApiController@PembayaranEngine')->name('feepayment');
|
||||
Route::get('/pembayaran/response', 'App\Http\Controllers\ApiController@response')->name('pay.paymentStatus');
|
||||
Route::get('/pembayaran/backend', 'App\Http\Controllers\ApiController@callback')->name('pay.callback');
|
||||
Route::get('pembayaran/berjaya',['as'=>'pay.success','uses'=>'App\Http\Controllers\ApiController@successPayment']);
|
||||
Route::get('pembayaran/gagal',['as'=>'pay.failed','uses'=>'App\Http\Controllers\ApiController@failedPayment']);
|
||||
|
||||
//Protected routes
|
||||
Route::group(['middleware' => ['auth:sanctum']], function () {
|
||||
|
||||
Reference in New Issue
Block a user