remove testing code

This commit is contained in:
edmondlang
2024-03-02 00:25:00 +08:00
parent b2dd34106c
commit 8b22b49937
-150
View File
@@ -866,153 +866,3 @@ Route::get('/invoice/{marking}/{started_at}/{ended_at}/fix', function($marking,
}
);
})->name('invoice.fix.byCustomerMarking');
Route::get('/transfer/{marking}/payment-details', function ($marking) {
$booking = Booking::where('marking', $marking)->first();
$transactions = $booking->transactions()->withTrashed()->get();
$paymentMethods = PaymentMethodType::PAYMENT_METHODS_ID;
$statusLabels = [
0 => 'PAYMENT_ATTEMPT',
1 => 'PAYMENT',
2 => 'INVOICE',
3 => 'BILL',
4 => 'PROFORMA',
5 => 'TOP_UP',
6 => 'REFUND',
7 => 'PURCHASE_ORDER',
8 => 'SUPPLIER_DELIVER',
9 => 'CREDIT_NOTE',
10 => 'WITHDRAW',
11 => 'DEBIT_NOTE',
12 => 'TRANSFER_FEE',
13 => 'CASH_BACK',
];
$ApprovalStatus = ApprovalStatus::APPROVAL_STATUS_ID;
echo '<table border="1" width="100%">';
echo '<thead>';
echo '<tr>';
echo '<th>ID</th>';
echo '<th>Amount</th>';
echo '<th>Type</th>';
echo '<th>Status</th>';
echo '<th>Payment Method</th>';
echo '<th>Created At</th>';
echo '<th>Deleted At</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
foreach ($transactions as $transaction) {
echo '<tr>';
echo '<td>' . $transaction->id . '</td>';
echo '<td>' . $transaction->amount . '</td>';
echo '<td>' . $statusLabels[$transaction->type] . '</td>';
echo '<td>' . $ApprovalStatus [$transaction->status] . '</td>';
echo '<td>' . $paymentMethods [$transaction->payment_method] . '</td>';
echo '<td>' . $transaction->created_at . '</td>';
echo '<td>' . $transaction->deleted_at . '</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
echo '<br> ----------------------------------------------------------------<br>';
echo 'Wallet Details';
})->name('booking.details.transactions');
Route::get('show-booking-expired', function () {
$transactions = Transaction::where('type', TransactionType::PAYMENT)
->where('status', ApprovalStatus::EXPIRED)
->whereDate('updated_at', '>=', '2024-02-16')
->take(10)
->orderBy('updated_at', 'desc')
->get();
// print_r(count($transactions));
$statusLabels = [
0 => 'PAYMENT_ATTEMPT',
1 => 'PAYMENT',
2 => 'INVOICE',
3 => 'BILL',
4 => 'PROFORMA',
5 => 'TOP_UP',
6 => 'REFUND',
7 => 'PURCHASE_ORDER',
8 => 'SUPPLIER_DELIVER',
9 => 'CREDIT_NOTE',
10 => 'WITHDRAW',
11 => 'DEBIT_NOTE',
12 => 'TRANSFER_FEE',
13 => 'CASH_BACK',
];
$ApprovalStatus = ApprovalStatus::APPROVAL_STATUS_ID;
$paymentMethods = PaymentMethodType::PAYMENT_METHODS_ID;
echo '<table border="1" width="100%">';
echo '<thead>';
echo '<tr>';
echo '<th>Counter</th>';
echo '<th>ID</th>';
echo '<th>Booking</th>';
echo '<th>Payments</th>';
echo '<th>Amount</th>';
echo '<th>Type</th>';
echo '<th>Status</th>';
echo '<th>Payment Method</th>';
echo '<th>BillPlz Response</th>';
echo '<th>Updated At</th>';
echo '<th>Created At</th>';
echo '</tr>';
echo '</thead>';
echo '<tbody>';
$counter = 1;
foreach ($transactions as $transaction) {
$billplz_status = null;
if ($transaction->payment_method == PaymentMethodType::PAYMENT_GATEWAY) {
$response = Http::withBasicAuth(config('billplz.api_key') . ':', '')->get(config('billplz.base_url') . '/api/v3/bills/' . $transaction->payment_reference);
if ($response->successful()) {
$data = $response->json();
if ($data['paid']) {
$billplz_status = 'Paid';
} else {
$billplz_status = $transaction->id . " => Fraud";
}
} else {
$billplz_status = $transaction->id . " => billplz error";
}
}
echo '<tr>';
echo '<td>' . $counter++ . '</td>';
echo '<td>' . $transaction->id . '</td>';
echo '<td>' . '<a href="'.route('booking.details', $transaction->owner->marking).'" target="_blank">'.$transaction->owner->marking.'</a>' . '</td>';
echo '<td>' . '<a href="'.route('booking.details.transactions', $transaction->owner->marking).'" target="_blank">Payments</a>' . '</td>';
echo '<td>' . $transaction->amount . '</td>';
echo '<td>' . $statusLabels[$transaction->type] . '</td>';
echo '<td>' . $ApprovalStatus [$transaction->status] . '</td>';
echo '<td>' . $paymentMethods [$transaction->payment_method] . '</td>';
echo '<td>' . $billplz_status . '</td>';
echo '<td>' . $transaction->updated_at . '</td>';
echo '<td>' . $transaction->created_at . '</td>';
echo '</tr>';
}
echo '</tbody>';
echo '</table>';
});