billplz failed callback payment

This commit is contained in:
edmondlang
2023-03-22 19:36:26 +08:00
parent 1dfbc71302
commit 2169f09ffe
@@ -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);