From 2169f09ffec0d83b4cdc2cfb2a4a96c015348f64 Mon Sep 17 00:00:00 2001 From: edmondlang Date: Wed, 22 Mar 2023 19:36:26 +0800 Subject: [PATCH] billplz failed callback payment --- app/Console/Commands/BillplzFailedCallbackPayment.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Console/Commands/BillplzFailedCallbackPayment.php b/app/Console/Commands/BillplzFailedCallbackPayment.php index 7026efc4..e2b69858 100644 --- a/app/Console/Commands/BillplzFailedCallbackPayment.php +++ b/app/Console/Commands/BillplzFailedCallbackPayment.php @@ -54,7 +54,9 @@ class BillplzFailedCallbackPayment extends Command $this->outputArray = []; $start = new Carbon(); - $transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereIn('status', [ApprovalStatus::REJECTED])->get(); + $approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID; + + $transactions = Transaction::where('type', TransactionType::PAYMENT)->where('payment_method', PaymentMethodType::PAYMENT_GATEWAY)->whereIn('status', [ApprovalStatus::REJECTED, ApprovalStatus::PENDING_VERIFICATION])->get(); $totalTransactions = count($transactions); $counter = 1; $totalAmount = 0; @@ -65,7 +67,7 @@ class BillplzFailedCallbackPayment extends Command $data = $response->json(); if($data['paid']){ $totalAmount += $transaction->amount; - $this->appendToOutput($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount); + $this->appendToOutput($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Status: ' . $approvalStatusArray[$transaction->status]); } else { // $totalAmount += $transaction->amount; // $this->appendToOutput($counter . ' of ' . $totalTransactions . '. Order: '. $transaction->owner->owner->owner->reference . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount);