diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/Payments/index.tsx b/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/Payments/index.tsx index 59c707b2125..85815139961 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/Payments/index.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/Payments/index.tsx @@ -107,22 +107,14 @@ class Payments extends PureComponent & Props> { text: this.getType(value), value })) - // TODO: remove when adding FUNDS type - const defaultMethodsNoFunds = defaultMethods.filter( - method => method.value.type !== 'FUNDS' - ) - const itemsss = { - group: '', - items: [...cardMethods, ...defaultMethodsNoFunds] - } // eslint-disable-next-line - console.log('itemsss', itemsss) + console.log('cardMethods', cardMethods) // eslint-disable-next-line console.log('availableCards', availableCards) // eslint-disable-next-line - console.log('defaultMethodsNoFunds', defaultMethodsNoFunds) + console.log('defaultMethodsNoFunds', defaultMethods) // return [ // { diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/index.tsx b/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/index.tsx index f15885fe4ba..7b5c7826472 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/index.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/index.tsx @@ -1,14 +1,7 @@ import { actions, selectors } from 'data' import { bindActionCreators, Dispatch } from 'redux' import { connect, ConnectedProps } from 'react-redux' -import { - FiatEligibleType, - FiatType, - RemoteDataType, - SBCardType, - SBPairType, - SBPaymentMethodsType -} from 'core/types' +import { FiatType, RemoteDataType, SBPairType } from 'core/types' import { getData } from './selectors' import { RootState } from 'data/rootReducer' import Failure from './template.failure' @@ -16,9 +9,11 @@ import Loading from './template.loading' import React, { PureComponent } from 'react' import Success from './template.success' -class EnterAmount extends PureComponent { +class PaymentMethods extends PureComponent { componentDidMount () { if (this.props.fiatCurrency) { + this.props.simpleBuyActions.fetchSBPairs(this.props.fiatCurrency) + this.props.simpleBuyActions.fetchSBFiatEligible(this.props.fiatCurrency) this.props.simpleBuyActions.fetchSBPaymentMethods(this.props.fiatCurrency) this.props.simpleBuyActions.fetchSBCards() } @@ -51,11 +46,9 @@ export type OwnProps = { handleClose: () => void pair: SBPairType } -export type SuccessStateType = { - cards: Array - eligibility: FiatEligibleType - paymentMethods: SBPaymentMethodsType -} + +export type SuccessStateType = ReturnType['data'] + export type LinkStatePropsType = { data: RemoteDataType fiatCurrency: undefined | FiatType @@ -63,4 +56,4 @@ export type LinkStatePropsType = { export type LinkDispatchPropsType = ReturnType export type Props = OwnProps & ConnectedProps -export default connector(EnterAmount) +export default connector(PaymentMethods) diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/selectors.ts b/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/selectors.ts index 616b2cc5709..e8f78963562 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/selectors.ts +++ b/packages/blockchain-wallet-v4-frontend/src/modals/SimpleBuy/PaymentMethods/selectors.ts @@ -1,3 +1,4 @@ +import { ExtractSuccess } from 'core/types' import { lift } from 'ramda' import { selectors } from 'data' @@ -8,9 +9,15 @@ export const getData = state => { state ) - return lift((cards, eligibility, paymentMethods) => ({ - cards, - eligibility, - paymentMethods - }))(cardsR, eligibilityR, paymentMethodsR) + return lift( + ( + cards: ExtractSuccess, + eligibility: ExtractSuccess, + paymentMethods: ExtractSuccess + ) => ({ + cards, + eligibility, + paymentMethods + }) + )(cardsR, eligibilityR, paymentMethodsR) }