mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/portal.git
synced 2026-08-19 04:23:59 +00:00
fix billplz bill status
This commit is contained in:
+6
-3
@@ -599,19 +599,22 @@ Route::get('/yd/fix', function(){
|
||||
|
||||
Route::get('/billplz/fix', function(){
|
||||
$payments = \App\Models\Transaction::where('type', \App\Classes\ValueObjects\Constants\TransactionType::PAYMENT)->where('payment_method',\App\Classes\ValueObjects\Constants\PaymentMethodType::PAYMENT_GATEWAY)->get();
|
||||
|
||||
echo '<h3>fixed orders</h3>';
|
||||
foreach ($payments as $payment){
|
||||
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$payment->payment_reference);
|
||||
|
||||
if($response->successful()){
|
||||
$data = $response->json();
|
||||
|
||||
$orderNumber = $payment->owner->owner->owner->reference;
|
||||
if(!$data['paid'] && $payment->status === \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED) {
|
||||
echo $payment->id." => Fraud";
|
||||
echo '<br><span style="color: red">Fraude: <a href="'.route('order.show', $orderNumber).'" target="_blank">'.$orderNumber.'</a></span><br>';
|
||||
continue;
|
||||
}
|
||||
|
||||
if($data['paid']){
|
||||
if($payment->status !== \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED){
|
||||
echo '<a href="'.route('order.show', $orderNumber).'" target="_blank">'.$orderNumber.'</a><br>';
|
||||
}
|
||||
$payment->status = \App\Classes\ValueObjects\Constants\ApprovalStatus::APPROVED;
|
||||
$payment->save();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user