Skip to content

Commit

Permalink
feat(simple buy): handle card payments when pending_depo
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Apr 29, 2020
1 parent 8bc8000 commit 0d00134
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1416,6 +1416,7 @@ type MessagesType = {
'scenes.home.banner.coinifyToSB.revamped': "We've revamped the Buy Crypto experience"
'scenes.home.banner.finishsigningup': 'Finish Signing Up'
'scenes.home.banner.pendingbuy': 'Pending Buy'
'scenes.home.banner.receive_cc_order': 'Once you finalize your credit card information, your buy order will complete.'
'scenes.home.banner.receivetransfer': 'Once we receive your bank transfer, your buy order will complete.'
'scenes.home.banner.sborder.details': 'View Details'
'scenes.home.banner.signupapprove': 'Once you finish and get approved, start buying crypto.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ export default ({
yield delay(3000)
}

yield put(A.fetchSBOrders())
yield put(A.setStep({ step: 'ORDER_SUMMARY', order }))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,37 @@ const Success: React.FC<Props> = props => {
) : (
<CustomFlyoutWrapper>
<>
<Icon
cursor
name='arrow-left'
size='20px'
color='grey600'
role='button'
onClick={() => {
switch (props.type) {
case 'CARD':
props.simpleBuyActions.setStep({
step: 'ADD_CARD',
cardId: props.card.id
})
break
case 'ORDER':
props.simpleBuyActions.setStep({
step: 'CHECKOUT_CONFIRM',
order: props.order
})
}
}}
/>
{props.type === 'CARD' && (
<Icon
cursor
name='arrow-left'
size='20px'
color='grey600'
role='button'
onClick={() => {
props.simpleBuyActions.setStep({
step: 'ADD_CARD',
cardId: props.card.id
})
}}
/>
)}
{props.type === 'ORDER' && (
<Icon
cursor
name='arrow-right'
size='20px'
color='grey600'
role='button'
style={{ justifyContent: 'flex-end' }}
onClick={() => {
props.simpleBuyActions.setStep({
step: 'ORDER_SUMMARY',
order: props.order
})
}}
/>
)}
<Iframe
src={
props.domains.walletHelper +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,7 @@ const BannerButton = styled(Button)`
`

class SBOrderBanner extends PureComponent<Props> {
showModal = () => {
const latestPendingOrder = this.props.orders.find(order => {
return (
order.state === 'PENDING_CONFIRMATION' ||
order.state === 'PENDING_DEPOSIT'
)
})

showModal = (latestPendingOrder: SBOrderType) => {
if (!latestPendingOrder) return
this.props.simpleBuyActions.showModal('pendingOrder')
this.props.simpleBuyActions.setStep({
Expand All @@ -88,6 +81,15 @@ class SBOrderBanner extends PureComponent<Props> {
}

render () {
const latestPendingOrder = this.props.orders.find(order => {
return (
order.state === 'PENDING_CONFIRMATION' ||
order.state === 'PENDING_DEPOSIT'
)
})

if (!latestPendingOrder) return null

return (
<Wrapper>
<Row>
Expand All @@ -102,15 +104,22 @@ class SBOrderBanner extends PureComponent<Props> {
/>
</Text>
<Copy size='16px' color='grey600' weight={500}>
<FormattedMessage
id='scenes.home.banner.receivetransfer'
defaultMessage='Once we receive your bank transfer, your buy order will complete.'
/>
{latestPendingOrder.paymentMethodId ? (
<FormattedMessage
id='scenes.home.banner.receive_cc_order'
defaultMessage='Once you finalize your credit card information, your buy order will complete.'
/>
) : (
<FormattedMessage
id='scenes.home.banner.receivetransfer'
defaultMessage='Once we receive your bank transfer, your buy order will complete.'
/>
)}
</Copy>
</Column>
</Row>
<BannerButton
onClick={() => this.showModal()}
onClick={() => this.showModal(latestPendingOrder)}
jumbo
data-e2e='openPendingSBOrder'
nature='primary'
Expand Down

0 comments on commit 0d00134

Please sign in to comment.