Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/components/Claim/Link/views/BankFlowManager.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ export const BankFlowManager = (props: IClaimScreenProps) => {
* @name handleCreateOfframpAndClaim
* @description creates an off-ramp transfer for the user, either as a guest or a logged-in user.
*/
const handleCreateOfframpAndClaim = async (account: IBankAccountDetails) => {
const handleCreateOfframpAndClaim = async (
account: IBankAccountDetails & { id?: string; bridgeAccountId?: string }
) => {
try {
setLoadingState('Executing transaction')
setError(null)
Expand Down Expand Up @@ -148,6 +150,12 @@ export const BankFlowManager = (props: IClaimScreenProps) => {
const contractVersion = params.contractVersion
const peanutContractAddress = peanut.getContractAddress(chainId, contractVersion) as Address

const externalAccountId = account?.bridgeAccountId ?? account?.id

if (!externalAccountId) throw new Error('External account ID not found')

const destination = getOfframpCurrencyConfig(account.country ?? selectedCountry!.id)

// handle offramp request creation
const offrampRequestParams: TCreateOfframpRequest = {
onBehalfOf: userForOfframp.bridgeCustomerId,
Expand All @@ -160,8 +168,8 @@ export const BankFlowManager = (props: IClaimScreenProps) => {
fromAddress: peanutContractAddress,
},
destination: {
...getOfframpCurrencyConfig(account.country ?? selectedCountry!.id),
externalAccountId: (account as any).bridgeAccountId ?? (account as any).id,
...destination,
externalAccountId,
},
features: { allowAnyFromAddress: true },
}
Expand Down
7 changes: 7 additions & 0 deletions src/components/Claim/Link/views/Confirm.bank-claim.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ export function ConfirmBankClaimView({
<PaymentInfoRow label="Full name" value={displayedFullName} />
{bankDetails.iban && <PaymentInfoRow label="IBAN" value={bankDetails.iban.toUpperCase()} />}
{bankDetails.bic && <PaymentInfoRow label="BIC" value={bankDetails.bic.toUpperCase()} />}
{bankDetails.clabe && <PaymentInfoRow label="CLABE" value={bankDetails.clabe.toUpperCase()} />}
{bankDetails.accountNumber && (
<PaymentInfoRow label="Account Number" value={bankDetails.accountNumber.toUpperCase()} />
)}
{bankDetails.routingNumber && (
<PaymentInfoRow label="Routing Number" value={bankDetails.routingNumber.toUpperCase()} />
)}
<ExchangeRate accountType={accountType} />
<PaymentInfoRow hideBottomBorder label="Fee" value={`$ 0.00`} />
</Card>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/bridge.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type BridgeOperationType = 'onramp' | 'offramp'
* Payment rails differ between onramp and offramp operations
*/
export const getCurrencyConfig = (countryId: string, operationType: BridgeOperationType): CurrencyConfig => {
if (countryId === 'US') {
if (countryId === 'US' || countryId === 'USA') {
return {
currency: 'usd',
paymentRail: operationType === 'onramp' ? 'ach_push' : 'ach',
Expand Down
Loading