fix: withdraw flow bug (zero bal) (#5629)
This commit is contained in:
@@ -408,11 +408,11 @@ export function createWithdrawContext(
|
||||
const stages = computed<WithdrawStage[]>(() => {
|
||||
const dynamicStages: WithdrawStage[] = []
|
||||
|
||||
const usedLimit = balance?.withdrawn_ytd ?? 0
|
||||
const available = balance?.available ?? 0
|
||||
const usedLimit = balanceRef.value?.withdrawn_ytd ?? 0
|
||||
const available = balanceRef.value?.available ?? 0
|
||||
|
||||
const needsTaxForm =
|
||||
balance?.form_completion_status !== 'complete' &&
|
||||
balanceRef.value?.form_completion_status !== 'complete' &&
|
||||
usedLimit + available >= getTaxThreshold(taxComplianceThresholds)
|
||||
|
||||
const threshold = getTaxThreshold(taxComplianceThresholds)
|
||||
@@ -420,7 +420,7 @@ export function createWithdrawContext(
|
||||
usedLimit,
|
||||
available,
|
||||
total: usedLimit + available,
|
||||
status: balance?.form_completion_status,
|
||||
status: balanceRef.value?.form_completion_status,
|
||||
needsTaxForm,
|
||||
taxThreshold: threshold,
|
||||
taxComplianceFilled: `${((usedLimit / threshold) * 100).toFixed(1)}%`,
|
||||
@@ -448,14 +448,14 @@ export function createWithdrawContext(
|
||||
})
|
||||
|
||||
const maxWithdrawAmount = computed(() => {
|
||||
const availableBalance = balance?.available ?? 0
|
||||
const formCompleted = balance?.form_completion_status === 'complete'
|
||||
const availableBalance = balanceRef.value?.available ?? 0
|
||||
const formCompleted = balanceRef.value?.form_completion_status === 'complete'
|
||||
|
||||
if (formCompleted) {
|
||||
return Math.max(0, availableBalance)
|
||||
}
|
||||
|
||||
const usedLimit = balance?.withdrawn_ytd ?? 0
|
||||
const usedLimit = balanceRef.value?.withdrawn_ytd ?? 0
|
||||
const remainingLimit = Math.max(0, getTaxThresholdActual(taxComplianceThresholds) - usedLimit)
|
||||
return Math.max(0, Math.min(remainingLimit, availableBalance))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user