Skip to content

Commit

Permalink
fix(payments): set right limit for card method type
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLeoB committed Jan 21, 2021
1 parent 3d3e9ad commit 8916bc6
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ class Accounts extends PureComponent<InjectedFormProps<{}, Props> & Props> {
) > 0)
)

// use this to get min/max for card buys from eligible/payment-methods
// limits aren't available on availableCards
const cardMethod = defaultMethods.find(
method => method.value.type === 'PAYMENT_CARD'
)
const cardMethods = availableCards.map(card => ({
text: card.card
? card.card.label
Expand All @@ -225,7 +230,10 @@ class Accounts extends PureComponent<InjectedFormProps<{}, Props> & Props> {
card: card.card,
type: 'USER_CARD',
currency: card.currency,
limits: { min: '1000', max: '500000' }
limits: {
min: cardMethod?.value.limits.min,
max: cardMethod?.value.limits.max
}
} as SBPaymentMethodType
}))

Expand All @@ -247,7 +255,6 @@ class Accounts extends PureComponent<InjectedFormProps<{}, Props> & Props> {

const availableMethods =
funds.length || cardMethods.length || bankMethods.length

return (
<Wrapper>
<Form>
Expand Down

0 comments on commit 8916bc6

Please sign in to comment.