commit
This commit is contained in:
@@ -27,6 +27,7 @@ use App\Models\LelongBidMarhun;
|
||||
use App\Models\LelKarat;
|
||||
use App\Models\LelKarat_temp;
|
||||
use App\Models\Resit;
|
||||
use App\Models\Payment;
|
||||
|
||||
use Session;
|
||||
use Carbon\Carbon;
|
||||
@@ -149,10 +150,9 @@ class ApiController extends Controller
|
||||
$month = $current->month;
|
||||
$year = $current->format('y');
|
||||
|
||||
$total_bayaran = 10;
|
||||
$total_bayaran = 1000;
|
||||
|
||||
$collection_id = $this->collection_id;
|
||||
// dd($request->all());
|
||||
$response = $bill->create(
|
||||
$collection_id,
|
||||
'test@gmail.com',
|
||||
@@ -160,8 +160,8 @@ class ApiController extends Controller
|
||||
$request->name,
|
||||
Money::MYR($total_bayaran),
|
||||
route('pay.callback'),
|
||||
'Bayaran Ansuran',
|
||||
['redirect_url' => route('pay.paymentStatus')]
|
||||
'Bayaran Borang',
|
||||
['redirect_url' => 'http://192.168.0.10:8003/api/pembayaran/response']
|
||||
);
|
||||
|
||||
$previous_siri = Resit::orderBy('id','desc')->first();
|
||||
@@ -170,17 +170,21 @@ class ApiController extends Controller
|
||||
}else{
|
||||
$nosiri = 1;
|
||||
}
|
||||
|
||||
|
||||
$billcode = $response->toArray();
|
||||
// dd($billcode);
|
||||
// $billcode['redirect_url'] = 'http://192.168.0.10:8003/api/pembayaran/response';
|
||||
// dd($billcode);
|
||||
$reference_no = 'LPKB' . $day . $month . $year . sprintf("%08d", $nosiri);
|
||||
|
||||
// $response2 = $bill->get($billcode['id']);
|
||||
// dd($response2->toArray());
|
||||
$resit = new Resit;
|
||||
$resit->user_id = $request->user_id;
|
||||
$resit->lelongbid_id = null;
|
||||
$resit->reference_no = $reference_no;
|
||||
$resit->billplz_id = $billcode['id'];
|
||||
$resit->resit_type = 1;
|
||||
$resit->total_payment = $total_bayaran;
|
||||
$resit->total_payment = 10;
|
||||
$resit->save();
|
||||
|
||||
// foreach($array_payment as $index1=>$arraypay)
|
||||
@@ -214,6 +218,7 @@ class ApiController extends Controller
|
||||
}
|
||||
|
||||
public function callback(Request $request){
|
||||
dd('hye');
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
@@ -256,6 +261,7 @@ class ApiController extends Controller
|
||||
}
|
||||
|
||||
public function response(Request $request){
|
||||
// dd($request->all());
|
||||
$http = new HttpMethodsClient(
|
||||
new GuzzleHttpClient(),
|
||||
new GuzzleMessageFactory()
|
||||
@@ -268,13 +274,14 @@ class ApiController extends Controller
|
||||
$billplz->useVersion('v4');
|
||||
|
||||
$bill = $billplz->bill();
|
||||
|
||||
$data = $bill->webhook($request->toArray());
|
||||
|
||||
if($data['billplz']['paid'] == 'true'){
|
||||
$resit = Resit::where('billplz_id','=',$data['billplz']['id'])->first();
|
||||
$req = $request->toArray();
|
||||
$response = $bill->get($req['billplz']['id']);
|
||||
$data = $response->toArray();
|
||||
// dd($data);
|
||||
if($data['paid'] == 'true'){
|
||||
$resit = Resit::where('billplz_id','=',$data['id'])->first();
|
||||
$resit->status = 'PAID';
|
||||
$resit->paid_at = $data['billplz']['paid_at'];
|
||||
$resit->paid_at = $data['paid_at'];
|
||||
$resit->save();
|
||||
|
||||
// $transactionOnline = Http::get(config('api.url') . '/api/transaction/online/express',[
|
||||
@@ -286,7 +293,7 @@ class ApiController extends Controller
|
||||
]);
|
||||
|
||||
}else{
|
||||
$resit = Resit::where('billplz_id','=',$data['billplz']['id'])->first();
|
||||
$resit = Resit::where('billplz_id','=',$data['id'])->first();
|
||||
$resit->status = 'UNSUCCESSFUL';
|
||||
$resit->paid_at = null;
|
||||
$resit->save();
|
||||
|
||||
Reference in New Issue
Block a user