Skip to content

Commit

Permalink
fix(bank accounts): check for bank_transfer payment method before dis…
Browse files Browse the repository at this point in the history
…playing add bank button on settings page
  • Loading branch information
blockdylanb committed Feb 2, 2021
1 parent 6081b85 commit 355c651
Showing 1 changed file with 20 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { any } from 'ramda'
import { Button, Image, Text } from 'blockchain-info-components'
import {
CardDetails,
Expand All @@ -10,12 +11,12 @@ import { FormattedMessage } from 'react-intl'
import { getBankLogoImageName } from 'services/ImagesService'
import { InjectedFormProps, reduxForm } from 'redux-form'
import { Props as OwnProps, SuccessStateType } from '.'
import { SBPaymentMethodType, WalletFiatEnum } from 'core/types'
import {
SettingComponent,
SettingContainer,
SettingSummary
} from 'components/Setting'
import { WalletFiatEnum } from 'core/types'
import media from 'services/ResponsiveService'
import React from 'react'
import styled from 'styled-components'
Expand Down Expand Up @@ -43,6 +44,10 @@ const Success: React.FC<InjectedFormProps<{}, Props> & Props> = props => {
account => account.currency in WalletFiatEnum
)

const isEligible = any(
(method: SBPaymentMethodType) => method.type === 'BANK_TRANSFER'
)(props.paymentMethods.methods)

return (
<StyledSettingsContainer>
<SettingSummary>
Expand Down Expand Up @@ -107,15 +112,20 @@ const Success: React.FC<InjectedFormProps<{}, Props> & Props> = props => {
})}
</div>
</SettingSummary>
<CustomSettingComponent>
<Button
nature='primary'
data-e2e='addCardFromSettings'
onClick={() => props.handleBankClick()}
>
<FormattedMessage id='buttons.add_bank' defaultMessage='Add a Bank' />
</Button>
</CustomSettingComponent>
{isEligible && (
<CustomSettingComponent>
<Button
nature='primary'
data-e2e='addCardFromSettings'
onClick={() => props.handleBankClick()}
>
<FormattedMessage
id='buttons.add_bank'
defaultMessage='Add a Bank'
/>
</Button>
</CustomSettingComponent>
)}
</StyledSettingsContainer>
)
}
Expand Down

0 comments on commit 355c651

Please sign in to comment.