debug billplz

This commit is contained in:
edmondlang
2023-10-08 23:53:39 +08:00
parent c493b3786c
commit fa4cfc0d75
+18 -1
View File
@@ -1078,7 +1078,8 @@ Route::get('/wallet/audit', function (Request $request) {
foreach ($wallet->transactions as $transaction){
if(!in_array((int) $transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) continue;
if((int) $transaction->type === TransactionType::TOP_UP) {
if((int) $transaction->type === TransactionType::TOP_UP || (int) $transaction->type === TransactionType::GROUP_PAYMENT) {
// if((int) $transaction->type === TransactionType::TOP_UP) {
$topups += (float) $transaction->amount;
}
if((int) $transaction->type === TransactionType::CREDIT_NOTE) $credit += (float) $transaction->amount;
@@ -1191,4 +1192,20 @@ Route::get('/duplicate-package-clean-up', function(){
Route::get('transaction/{id}/credit_note/download', 'Transactions\GenerateCreditNotePdfController@download')->name('transaction.credit_note.download');
Route::get('/check-successful-payment-or-topup', function () {
$sum = 0 ;
$transactions = Transaction::whereIn('type', [TransactionType::PAYMENT, TransactionType::TOP_UP, TransactionType::GROUP_PAYMENT])->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereNotIn('status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->get();
foreach ($transactions as $transaction){
$response = Http::withBasicAuth(config('billplz.api_key').':', '')->get(config('billplz.base_url').'/api/v3/bills/'.$transaction->payment_reference);
if($response->successful()){
$sum += $transaction->amount;
dump($transaction->payment_reference . 'Amount : ' . $transaction->amount);
}else{
dump("billplz error</br>");
}
}
dump("Sum is : " . $sum);
});