You've already forked AstralRinth
forked from didirus/AstralRinth
feat: bank acct owner (#4993)
This commit is contained in:
@@ -28,7 +28,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="selectedRail?.type === 'fiat'" class="flex flex-col gap-2.5">
|
<div v-if="selectedRail?.type === 'fiat' && !isBusinessEntity" class="flex flex-col gap-2.5">
|
||||||
<label>
|
<label>
|
||||||
<span class="text-md font-semibold text-contrast">
|
<span class="text-md font-semibold text-contrast">
|
||||||
{{ formatMessage(messages.accountOwner) }}
|
{{ formatMessage(messages.accountOwner) }}
|
||||||
@@ -46,6 +46,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div v-if="selectedRail?.type === 'fiat' && isBusinessEntity" class="flex flex-col gap-2">
|
||||||
|
<span class="text-md font-semibold text-contrast">
|
||||||
|
{{ formatMessage(messages.bankAccountOwner) }}
|
||||||
|
<span class="text-red">*</span>
|
||||||
|
</span>
|
||||||
|
<span class="text-sm leading-tight text-primary">
|
||||||
|
{{ formatMessage(messages.bankAccountOwnerDescription) }}
|
||||||
|
</span>
|
||||||
|
<div class="flex flex-col gap-3 sm:flex-row sm:gap-4">
|
||||||
|
<div class="flex flex-1 flex-col gap-2.5">
|
||||||
|
<input
|
||||||
|
v-model="formData.bankAccountOwnerFirstName"
|
||||||
|
type="text"
|
||||||
|
:placeholder="formatMessage(formFieldPlaceholders.firstNamePlaceholder)"
|
||||||
|
autocomplete="given-name"
|
||||||
|
class="w-full rounded-[14px] bg-surface-4 px-4 py-3 text-contrast placeholder:text-secondary sm:py-2.5"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-1 flex-col gap-2.5">
|
||||||
|
<input
|
||||||
|
v-model="formData.bankAccountOwnerLastName"
|
||||||
|
type="text"
|
||||||
|
:placeholder="formatMessage(formFieldPlaceholders.lastNamePlaceholder)"
|
||||||
|
autocomplete="family-name"
|
||||||
|
class="w-full rounded-[14px] bg-surface-4 px-4 py-3 text-contrast placeholder:text-secondary sm:py-2.5"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div v-if="selectedRail?.requiresBankName" class="flex flex-col gap-2.5">
|
<div v-if="selectedRail?.requiresBankName" class="flex flex-col gap-2.5">
|
||||||
<label>
|
<label>
|
||||||
<span class="text-md font-semibold text-contrast">
|
<span class="text-md font-semibold text-contrast">
|
||||||
@@ -279,6 +309,8 @@ const existingAmount = withdrawData.value.calculation.amount
|
|||||||
const formData = ref<Record<string, any>>({
|
const formData = ref<Record<string, any>>({
|
||||||
amount: existingAmount || undefined,
|
amount: existingAmount || undefined,
|
||||||
bankName: existingAccountDetails?.bankName ?? '',
|
bankName: existingAccountDetails?.bankName ?? '',
|
||||||
|
bankAccountOwnerFirstName: existingAccountDetails?.bankAccountOwnerFirstName ?? '',
|
||||||
|
bankAccountOwnerLastName: existingAccountDetails?.bankAccountOwnerLastName ?? '',
|
||||||
...existingAccountDetails,
|
...existingAccountDetails,
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -363,6 +395,12 @@ const accountOwnerAddress = computed(() => {
|
|||||||
return parts.join(', ')
|
return parts.join(', ')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isBusinessEntity = computed(() => {
|
||||||
|
const providerDataValue = withdrawData.value.providerData
|
||||||
|
if (providerDataValue.type !== 'muralpay') return false
|
||||||
|
return providerDataValue.kycData?.type === 'business'
|
||||||
|
})
|
||||||
|
|
||||||
const allRequiredFieldsFilled = computed(() => {
|
const allRequiredFieldsFilled = computed(() => {
|
||||||
const rail = selectedRail.value
|
const rail = selectedRail.value
|
||||||
if (!rail) return false
|
if (!rail) return false
|
||||||
@@ -511,5 +549,14 @@ const messages = defineMessages({
|
|||||||
id: 'dashboard.creator-withdraw-modal.muralpay-details.document-number-tax-id-placeholder',
|
id: 'dashboard.creator-withdraw-modal.muralpay-details.document-number-tax-id-placeholder',
|
||||||
defaultMessage: 'Enter tax ID number',
|
defaultMessage: 'Enter tax ID number',
|
||||||
},
|
},
|
||||||
|
bankAccountOwner: {
|
||||||
|
id: 'dashboard.creator-withdraw-modal.muralpay-details.bank-account-owner',
|
||||||
|
defaultMessage: 'Bank account owner',
|
||||||
|
},
|
||||||
|
bankAccountOwnerDescription: {
|
||||||
|
id: 'dashboard.creator-withdraw-modal.muralpay-details.bank-account-owner-description',
|
||||||
|
defaultMessage:
|
||||||
|
'Enter the name of the person authorized to operate this bank account on behalf of the business.',
|
||||||
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -716,6 +716,12 @@
|
|||||||
"dashboard.creator-withdraw-modal.muralpay-details.account-owner": {
|
"dashboard.creator-withdraw-modal.muralpay-details.account-owner": {
|
||||||
"message": "Account owner"
|
"message": "Account owner"
|
||||||
},
|
},
|
||||||
|
"dashboard.creator-withdraw-modal.muralpay-details.bank-account-owner": {
|
||||||
|
"message": "Bank account owner"
|
||||||
|
},
|
||||||
|
"dashboard.creator-withdraw-modal.muralpay-details.bank-account-owner-description": {
|
||||||
|
"message": "Enter the name of the person authorized to operate this bank account on behalf of the business."
|
||||||
|
},
|
||||||
"dashboard.creator-withdraw-modal.muralpay-details.coin": {
|
"dashboard.creator-withdraw-modal.muralpay-details.coin": {
|
||||||
"message": "Coin"
|
"message": "Coin"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ export interface AccountDetails {
|
|||||||
bankName?: string
|
bankName?: string
|
||||||
walletAddress?: string
|
walletAddress?: string
|
||||||
documentNumber?: string
|
documentNumber?: string
|
||||||
|
// For business entities, the bank account owner (authorized signatory) name
|
||||||
|
bankAccountOwnerFirstName?: string
|
||||||
|
bankAccountOwnerLastName?: string
|
||||||
[key: string]: any // for dynamic rail fields
|
[key: string]: any // for dynamic rail fields
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,11 +237,12 @@ function buildRecipientInfo(kycData: KycData) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAccountOwnerName(kycData: KycData): string {
|
function getAccountOwnerName(kycData: KycData, accountDetails?: AccountDetails): string {
|
||||||
if (kycData.type === 'individual') {
|
if (kycData.type === 'individual') {
|
||||||
return `${kycData.firstName} ${kycData.lastName}`
|
return `${kycData.firstName} ${kycData.lastName}`
|
||||||
}
|
}
|
||||||
return kycData.name || ''
|
// For business entities, use the authorized signatory's name from accountDetails (required by MuralPay)
|
||||||
|
return `${accountDetails?.bankAccountOwnerFirstName || ''} ${accountDetails?.bankAccountOwnerLastName || ''}`.trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMethodDisplayName(method: string | null): string {
|
function getMethodDisplayName(method: string | null): string {
|
||||||
@@ -358,7 +362,10 @@ function buildPayoutPayload(data: WithdrawData): PayoutPayload {
|
|||||||
payout_details: {
|
payout_details: {
|
||||||
type: 'fiat',
|
type: 'fiat',
|
||||||
bank_name: data.providerData.accountDetails.bankName || '',
|
bank_name: data.providerData.accountDetails.bankName || '',
|
||||||
bank_account_owner: getAccountOwnerName(data.providerData.kycData),
|
bank_account_owner: getAccountOwnerName(
|
||||||
|
data.providerData.kycData,
|
||||||
|
data.providerData.accountDetails,
|
||||||
|
),
|
||||||
fiat_and_rail_details: fiatAndRailDetails,
|
fiat_and_rail_details: fiatAndRailDetails,
|
||||||
},
|
},
|
||||||
recipient_info: buildRecipientInfo(data.providerData.kycData),
|
recipient_info: buildRecipientInfo(data.providerData.kycData),
|
||||||
@@ -732,6 +739,16 @@ export function createWithdrawContext(
|
|||||||
|
|
||||||
if (rail.requiresBankName && !accountDetails.bankName) return false
|
if (rail.requiresBankName && !accountDetails.bankName) return false
|
||||||
|
|
||||||
|
// For business entities on fiat rails, require bank account owner name
|
||||||
|
const kycData = withdrawData.value.providerData.kycData
|
||||||
|
if (
|
||||||
|
rail.type === 'fiat' &&
|
||||||
|
kycData?.type === 'business' &&
|
||||||
|
(!accountDetails.bankAccountOwnerFirstName || !accountDetails.bankAccountOwnerLastName)
|
||||||
|
) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
const requiredFields = rail.fields.filter((f) => f.required)
|
const requiredFields = rail.fields.filter((f) => f.required)
|
||||||
const allRequiredPresent = requiredFields.every((f) => {
|
const allRequiredPresent = requiredFields.every((f) => {
|
||||||
const value = accountDetails[f.name]
|
const value = accountDetails[f.name]
|
||||||
|
|||||||
Reference in New Issue
Block a user