feat: enhance wallet functionality and improve error handling
- Updated .env.example to include optional player site code configuration. - Modified error messages in hall-bet-errors for better clarity. - Improved the betting grid logic to handle invalid draw IDs and reload draws when necessary. - Adjusted wallet components to differentiate between credit and main wallet balances, including new translations for credit-related terms. - Enhanced wallet logs to support credit activity tracking and improved UI for displaying credit information.
This commit is contained in:
@@ -36,16 +36,48 @@ function resolveGroupStatus(items: TicketItemListRow[]): string {
|
||||
return orderStatus;
|
||||
}
|
||||
|
||||
const itemStatuses = new Set(items.map((row) => row.status));
|
||||
if (
|
||||
itemStatuses.has("failed") &&
|
||||
(itemStatuses.has("pending_draw") ||
|
||||
itemStatuses.has("placed") ||
|
||||
itemStatuses.has("pending_confirm"))
|
||||
) {
|
||||
const hasStatus = (status: string): boolean => items.some((row) => row.status === status);
|
||||
const hasAny = (statuses: string[]): boolean => statuses.some((status) => hasStatus(status));
|
||||
const allMatch = (statuses: string[]): boolean =>
|
||||
items.length > 0 && items.every((row) => statuses.includes(row.status));
|
||||
const hasWinningItem = items.some(
|
||||
(row) => row.status === "settled_win" && row.win_amount + row.jackpot_win_amount > 0,
|
||||
);
|
||||
|
||||
if (hasStatus("failed") && hasAny(["pending_draw", "placed", "pending_confirm"])) {
|
||||
return "partial_failed";
|
||||
}
|
||||
|
||||
if (hasAny(["pending_confirm", "partial_pending_confirm"])) {
|
||||
return hasAny(["failed", "pending_draw", "placed", "pending_payout", "settled_win", "settled_lose"])
|
||||
? "partial_pending_confirm"
|
||||
: "pending_confirm";
|
||||
}
|
||||
|
||||
if (hasAny(["pending_draw", "placed"])) {
|
||||
return "pending_draw";
|
||||
}
|
||||
|
||||
if (hasStatus("pending_payout")) {
|
||||
return "pending_payout";
|
||||
}
|
||||
|
||||
if (hasWinningItem) {
|
||||
return "settled_win";
|
||||
}
|
||||
|
||||
if (allMatch(["failed"])) {
|
||||
return "failed";
|
||||
}
|
||||
|
||||
if (allMatch(["refunded"])) {
|
||||
return "refunded";
|
||||
}
|
||||
|
||||
if (allMatch(["settled_lose", "settled_win"])) {
|
||||
return "settled_lose";
|
||||
}
|
||||
|
||||
return items[0]?.status ?? "unknown";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user