update
This commit is contained in:
@@ -13,3 +13,4 @@ npm-debug.log
|
||||
yarn-error.log
|
||||
/.idea
|
||||
/.vscode
|
||||
composer.lock
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Events;
|
||||
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
|
||||
|
||||
class PaymentNotify implements ShouldBroadcast
|
||||
{
|
||||
use Dispatchable, InteractsWithSockets, SerializesModels;
|
||||
|
||||
public $response;
|
||||
public $userid;
|
||||
|
||||
public function __construct($response,$userid)
|
||||
{
|
||||
$this->response = $response;
|
||||
$this->userid = $userid;
|
||||
}
|
||||
|
||||
public function broadcastOn()
|
||||
{
|
||||
return ['payment-notify'];
|
||||
}
|
||||
|
||||
public function broadcastAs()
|
||||
{
|
||||
return 'trigger-payment';
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Events\PaymentNotify;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
@@ -155,13 +157,13 @@ class ApiController extends Controller
|
||||
$collection_id = $this->collection_id;
|
||||
$response = $bill->create(
|
||||
$collection_id,
|
||||
'test@gmail.com',
|
||||
$request->email,
|
||||
$request->notel,
|
||||
$request->name,
|
||||
Money::MYR($total_bayaran),
|
||||
route('pay.callback'),
|
||||
'Bayaran Borang',
|
||||
['redirect_url' => 'http://192.168.0.85:8003/api/pembayaran/response']
|
||||
['redirect_url' => 'http://192.168.0.88:8003/api/pembayaran/response']
|
||||
);
|
||||
// dd($response);
|
||||
$previous_siri = Resit::orderBy('id','desc')->first();
|
||||
@@ -218,7 +220,7 @@ class ApiController extends Controller
|
||||
}
|
||||
|
||||
public function callback(Request $request){
|
||||
// dd('hye');
|
||||
// dd('hye callback');
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
@@ -239,7 +241,8 @@ class ApiController extends Controller
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $data['billplz']['paid_at'];
|
||||
$resit->save();
|
||||
|
||||
|
||||
event(new PaymentNotify('PAID',$resit->user_id));
|
||||
// $transactionOnline = Http::get(config('api.url') . '/api/transaction/online/express',[
|
||||
// 'billplz_id' => $data['billplz']['id']
|
||||
// ])->json();
|
||||
@@ -253,6 +256,8 @@ class ApiController extends Controller
|
||||
$resit->status = 'UNSUCCESSFUL';
|
||||
$resit->paid_at = null;
|
||||
$resit->save();
|
||||
|
||||
event(new PaymentNotify('UNSUCCESSFUL',$resit->user_id));
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'resit' => $resit
|
||||
@@ -261,7 +266,7 @@ class ApiController extends Controller
|
||||
}
|
||||
|
||||
public function response(Request $request){
|
||||
// dd('hye');
|
||||
// dd('hye response');
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
@@ -287,6 +292,7 @@ class ApiController extends Controller
|
||||
// $transactionOnline = Http::get(config('api.url') . '/api/transaction/online/express',[
|
||||
// 'billplz_id' => $data['billplz']['id']
|
||||
// ])->json();
|
||||
event(new PaymentNotify('PAID',$resit->user_id));
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'resit' => $resit
|
||||
@@ -297,6 +303,8 @@ class ApiController extends Controller
|
||||
$resit->status = 'UNSUCCESSFUL';
|
||||
$resit->paid_at = null;
|
||||
$resit->save();
|
||||
|
||||
event(new PaymentNotify('UNSUCCESSFUL',$resit->user_id));
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'resit' => $resit
|
||||
|
||||
@@ -8,6 +8,8 @@ use Spatie\Permission\Models\Permission;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Models\Cawangan;
|
||||
|
||||
use App\Events\PaymentNotify;
|
||||
|
||||
class DatabaseController extends Controller
|
||||
{
|
||||
/**
|
||||
@@ -27,6 +29,7 @@ class DatabaseController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
event(new PaymentNotify('lulus','8'));
|
||||
$caw = Cawangan::all();
|
||||
// $user = Auth::user();
|
||||
// $user->assignRole('admin');
|
||||
|
||||
Reference in New Issue
Block a user