Skip to content

Commit 8325815

Browse files
kushagrasarathejjramirezn
authored andcommitted
fix: send link claims to us bank accounts (#1108)
* fix: usa bank account claims * fix: show bank account details in confirm claim view
1 parent 7c7f4fd commit 8325815

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

src/components/Claim/Link/views/BankFlowManager.view.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ export const BankFlowManager = (props: IClaimScreenProps) => {
113113
* @name handleCreateOfframpAndClaim
114114
* @description creates an off-ramp transfer for the user, either as a guest or a logged-in user.
115115
*/
116-
const handleCreateOfframpAndClaim = async (account: IBankAccountDetails) => {
116+
const handleCreateOfframpAndClaim = async (
117+
account: IBankAccountDetails & { id?: string; bridgeAccountId?: string }
118+
) => {
117119
try {
118120
setLoadingState('Executing transaction')
119121
setError(null)
@@ -148,6 +150,12 @@ export const BankFlowManager = (props: IClaimScreenProps) => {
148150
const contractVersion = params.contractVersion
149151
const peanutContractAddress = peanut.getContractAddress(chainId, contractVersion) as Address
150152

153+
const externalAccountId = account?.bridgeAccountId ?? account?.id
154+
155+
if (!externalAccountId) throw new Error('External account ID not found')
156+
157+
const destination = getOfframpCurrencyConfig(account.country ?? selectedCountry!.id)
158+
151159
// handle offramp request creation
152160
const offrampRequestParams: TCreateOfframpRequest = {
153161
onBehalfOf: userForOfframp.bridgeCustomerId,
@@ -160,8 +168,8 @@ export const BankFlowManager = (props: IClaimScreenProps) => {
160168
fromAddress: peanutContractAddress,
161169
},
162170
destination: {
163-
...getOfframpCurrencyConfig(account.country ?? selectedCountry!.id),
164-
externalAccountId: (account as any).bridgeAccountId ?? (account as any).id,
171+
...destination,
172+
externalAccountId,
165173
},
166174
features: { allowAnyFromAddress: true },
167175
}

src/components/Claim/Link/views/Confirm.bank-claim.view.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,13 @@ export function ConfirmBankClaimView({
7373
<PaymentInfoRow label="Full name" value={displayedFullName} />
7474
{bankDetails.iban && <PaymentInfoRow label="IBAN" value={bankDetails.iban.toUpperCase()} />}
7575
{bankDetails.bic && <PaymentInfoRow label="BIC" value={bankDetails.bic.toUpperCase()} />}
76+
{bankDetails.clabe && <PaymentInfoRow label="CLABE" value={bankDetails.clabe.toUpperCase()} />}
77+
{bankDetails.accountNumber && (
78+
<PaymentInfoRow label="Account Number" value={bankDetails.accountNumber.toUpperCase()} />
79+
)}
80+
{bankDetails.routingNumber && (
81+
<PaymentInfoRow label="Routing Number" value={bankDetails.routingNumber.toUpperCase()} />
82+
)}
7683
<ExchangeRate accountType={accountType} />
7784
<PaymentInfoRow hideBottomBorder label="Fee" value={`$ 0.00`} />
7885
</Card>

src/utils/bridge.utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export type BridgeOperationType = 'onramp' | 'offramp'
1111
* Payment rails differ between onramp and offramp operations
1212
*/
1313
export const getCurrencyConfig = (countryId: string, operationType: BridgeOperationType): CurrencyConfig => {
14-
if (countryId === 'US') {
14+
if (countryId === 'US' || countryId === 'USA') {
1515
return {
1616
currency: 'usd',
1717
paymentRail: operationType === 'onramp' ? 'ach_push' : 'ach',

0 commit comments

Comments
 (0)