debug billplz payment

This commit is contained in:
edmondlang
2023-03-15 19:43:51 +08:00
parent fe9ccc1041
commit 1140cc9d3d
2 changed files with 19 additions and 3 deletions
@@ -19,4 +19,15 @@ final class ApprovalStatus {
public const EXPIRED = 6;
public const REFUNDED = 7;
public const APPROVAL_STATUS_ID = [
self::PENDING_SUBMISSION => "Pending Submission",
self::PENDING_VERIFICATION => "Pending Verification",
self::APPROVED => "Approved",
self::COMPLETED => "Completed",
self::REJECTED => "Rejected",
self::SUSPENDED => "Suspended",
self::EXPIRED => "Expired",
self::REFUNDED => "Refunded",
];
}
@@ -55,18 +55,23 @@ class debugBillplzFailedPayment extends Command
$data = $response->json();
if($data['paid']){
if (!in_array($transaction->status, [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])) {
$this->info('Paid transaction - id: '. $transaction->id . '. Booking Marking: '. $transaction->owner->marking . ' - Date: '.$transaction->created_at->format('d-m-Y').' - Amount: '. $transaction->amount);
$this->returnLog('Paid transaction', $transaction);
}
}
// else {
// $totalAmount += $transaction->amount;
// $this->info('Unpaid Transaction - id:' . $transaction->id . ' - Date: '.$transaction->owner->created_at->format('d-m-Y').' - Amount: '. $transaction->amount);
// $this->returnLog('Unpaid Transaction', $transaction);
// }
}else{
$this->info('billplz error - id: '. $transaction->id . ' - Date: '.$transaction->created_at->format('d-m-Y'));
$this->returnLog('billplz error', $transaction);
}
}
echo 'Total: ' . $totalAmount;
}
public function returnLog($text, $transaction) {
$approvalStatusArray = ApprovalStatus::APPROVAL_STATUS_ID;
$this->info($text . ' - id: '. $transaction->id . '. Booking Marking: '. $transaction->owner->marking . ' - Date: '.$transaction->created_at->format('d-m-Y').' - Amount: '. $transaction->amount . '. Current Status: ' . $approvalStatusArray[$transaction->status]);
}
}