commit
This commit is contained in:
@@ -33,6 +33,7 @@ use Money\Money;
|
||||
use Billplz\Client;
|
||||
use Http\Client\Common\HttpMethodsClient;
|
||||
use Http\Adapter\Guzzle7\Client as GuzzleHttpClient;
|
||||
use Http\Message\MessageFactory\GuzzleMessageFactory;
|
||||
|
||||
class ApiController extends Controller
|
||||
{
|
||||
@@ -121,7 +122,7 @@ class ApiController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
public function PembayaranEngine(Request $request)
|
||||
public function feepayment(Request $request)
|
||||
{
|
||||
|
||||
$arraycollection_id = array();
|
||||
@@ -162,30 +163,40 @@ class ApiController extends Controller
|
||||
);
|
||||
|
||||
$billcode = $response->toArray();
|
||||
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
|
||||
foreach($array_payment as $index1=>$arraypay)
|
||||
{
|
||||
$previous_siri = Http::get(config('api.url') . '/api/online/transaction')->json();
|
||||
if($previous_siri){
|
||||
$nosiri = $previous_siri['nosiri'] + 1;
|
||||
}else{
|
||||
$nosiri = 1;
|
||||
}
|
||||
$resit = new Resit;
|
||||
$resit->user_id = $request->user_id;
|
||||
$resit->lelongbid_id = $request->lelongbid_id;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->billplz_id = $billcode['id'];
|
||||
$resit->resit_type = 1;
|
||||
$resit->total_payment = $total_bayaran;
|
||||
$resit->save();
|
||||
|
||||
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
// foreach($array_payment as $index1=>$arraypay)
|
||||
// {
|
||||
// $previous_siri = Http::get(config('api.url') . '/api/online/transaction')->json();
|
||||
// if($previous_siri){
|
||||
// $nosiri = $previous_siri['nosiri'] + 1;
|
||||
// }else{
|
||||
// $nosiri = 1;
|
||||
// }
|
||||
|
||||
$new_transaction = Http::post(config('api.url') . '/api/online/transaction',[
|
||||
'nokp'=> Auth::user()->icno,
|
||||
'reference_no'=> $reference_no,
|
||||
'nosiri'=> $nosiri,
|
||||
'billplz_id' => $billcode['id'],
|
||||
'norujukan' => $arraypay['norujukan'],
|
||||
'kodcaw' => $arraypay['kodcaw'],
|
||||
'total_payment'=> $arraypay['bayaran'],
|
||||
'customer_name' => Auth::user()->name,
|
||||
])->json();
|
||||
// $reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
|
||||
}
|
||||
// $new_transaction = Http::post(config('api.url') . '/api/online/transaction',[
|
||||
// 'nokp'=> Auth::user()->icno,
|
||||
// 'reference_no'=> $reference_no,
|
||||
// 'nosiri'=> $nosiri,
|
||||
// 'billplz_id' => $billcode['id'],
|
||||
// 'norujukan' => $arraypay['norujukan'],
|
||||
// 'kodcaw' => $arraypay['kodcaw'],
|
||||
// 'total_payment'=> $arraypay['bayaran'],
|
||||
// 'customer_name' => Auth::user()->name,
|
||||
// ])->json();
|
||||
|
||||
// }
|
||||
|
||||
|
||||
return redirect($billcode['url'] . '?auto_submit=true');
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Http\Controllers\AuthMobile\AuthController;
|
||||
use App\Http\Controllers\AuthMobile\UserController;
|
||||
use App\Http\Controllers\AuthMobile\LelongMobileController;
|
||||
use App\Http\Controllers\CartController;
|
||||
use App\Http\Controllers\ApiController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -24,6 +25,16 @@ Route::post('/login', [AuthController::class, 'login']);
|
||||
Route::post('/forgotpassword', [ResetPassword::class, 'forgotpassword']);
|
||||
Route::post('/addToCart', [CartController::class, 'addToCart']);
|
||||
Route::get('/cart/{userid}', [CartController::class, 'getCart']);
|
||||
|
||||
Route::post('/feepayment', [ApiController::class, 'feepayment']);
|
||||
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