Add refund if withdrawal failed

This commit is contained in:
t1amak
2025-05-29 04:19:35 +00:00
parent 9f9738591c
commit 7a0fae0d7a

View File

@@ -50,7 +50,8 @@ foreach ($withdrawals as $withdrawal) {
sendMessage($withdrawal['user_id'], "Withdrawal of {$withdrawal['amount']} SAL sent. TxID: {$result['tx_hash']}");
} else {
$db->updateWithdrawalStatus($withdrawal['id'], 'failed');
sendMessage($withdrawal['user_id'], "Withdrawal failed. Please try again later or contact support.");
$db->updateUserTipBalance($withdrawal['user_id'], $withdrawal['amount'], 'add'); // <== Refund
sendMessage($withdrawal['user_id'], "Withdrawal failed. The amount has been returned to your balance. Please try again later or contact support.");
}
}