Payout flows in backend - fix Tremendous forex cards (#5001)

* wip: payouts flow api

* working

* Finish up flow migration

* vibe-coded frontend changes

* fix typos and vue

* fix: types

---------

Co-authored-by: Calum H. (IMB11) <contact@cal.engineer>
This commit is contained in:
aecsocket
2026-01-14 10:53:35 +00:00
committed by GitHub
parent 50a87ba933
commit d055dc68dc
17 changed files with 1224 additions and 873 deletions

View File

@@ -40,11 +40,6 @@ export interface PayoutMethod {
category?: string
image_url: string | null
image_logo_url: string | null
fee: {
percentage: number
min: number
max: number | null
}
interval: {
standard: {
min: number
@@ -130,6 +125,7 @@ export interface TaxData {
export interface CalculationData {
amount: number
fee: number | null
netUsd: number | null
exchangeRate: number | null
}
@@ -400,6 +396,7 @@ export function createWithdrawContext(
calculation: {
amount: 0,
fee: null,
netUsd: null,
exchangeRate: null,
},
providerData: {
@@ -841,14 +838,20 @@ export function createWithdrawContext(
apiVersion: 3,
method: 'POST',
body: payload,
})) as { fee: number | string | null; exchange_rate: number | string | null }
})) as {
net_usd: number | string | null
fee: number | string | null
exchange_rate: number | string | null
}
const parsedFee = response.fee ? Number.parseFloat(String(response.fee)) : 0
const parsedNetUsd = response.net_usd ? Number.parseFloat(String(response.net_usd)) : null
const parsedExchangeRate = response.exchange_rate
? Number.parseFloat(String(response.exchange_rate))
: null
withdrawData.value.calculation.fee = parsedFee
withdrawData.value.calculation.netUsd = parsedNetUsd
withdrawData.value.calculation.exchangeRate = parsedExchangeRate
return {
@@ -872,7 +875,9 @@ export function createWithdrawContext(
created: new Date(),
amount: withdrawData.value.calculation.amount,
fee: withdrawData.value.calculation.fee || 0,
netAmount: withdrawData.value.calculation.amount - (withdrawData.value.calculation.fee || 0),
netAmount:
withdrawData.value.calculation.netUsd ??
withdrawData.value.calculation.amount - (withdrawData.value.calculation.fee || 0),
methodType: getMethodDisplayName(withdrawData.value.selection.method),
recipientDisplay: getRecipientDisplay(withdrawData.value),
}