-
Notifications
You must be signed in to change notification settings - Fork 504
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Jumio): clean up jumio sagas, get jumio status after modal closes
- Loading branch information
plondon
committed
Jul 19, 2018
1 parent
3d34a25
commit 982c3e6
Showing
15 changed files
with
233 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
...lockchain-wallet-v4-frontend/src/scenes/BuySell/SfoxCheckout/Content/JumioStatus/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import React from 'react' | ||
import { connect } from 'react-redux' | ||
import { bindActionCreators } from 'redux' | ||
|
||
import { actions, selectors } from 'data' | ||
import { getData } from './selectors' | ||
import { Success } from './template.success' | ||
|
||
class JumioStatusContainer extends React.PureComponent { | ||
constructor (props) { | ||
super(props) | ||
this.openJumio = this.openJumio.bind(this) | ||
} | ||
|
||
componentDidMount () { | ||
this.props.sfoxActions.initializeJumio() | ||
} | ||
|
||
openJumio () { | ||
this.props.sfoxActions.nextStep('jumio') | ||
this.props.modalActions.showModal('SfoxExchangeData', { step: 'jumio' }) | ||
} | ||
|
||
render () { | ||
return this.props.data.cata({ | ||
Success: value => <Success value={value} onClick={this.openJumio} />, | ||
Loading: () => <div />, | ||
NotAsked: () => <div />, | ||
Failure: () => <div /> | ||
}) | ||
} | ||
} | ||
|
||
const mapStateToProps = state => ({ | ||
data: getData(state), | ||
profile: selectors.core.data.sfox.getProfile(state) | ||
}) | ||
|
||
const mapDispatchToProps = dispatch => ({ | ||
modalActions: bindActionCreators(actions.modals, dispatch), | ||
sfoxActions: bindActionCreators(actions.modules.sfox, dispatch) | ||
}) | ||
|
||
const enhance = connect( | ||
mapStateToProps, | ||
mapDispatchToProps | ||
) | ||
|
||
export default enhance(JumioStatusContainer) |
3 changes: 3 additions & 0 deletions
3
...chain-wallet-v4-frontend/src/scenes/BuySell/SfoxCheckout/Content/JumioStatus/selectors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { path } from 'ramda' | ||
|
||
export const getData = state => path(['sfoxSignup', 'jumioStatus'])(state) |
79 changes: 79 additions & 0 deletions
79
...allet-v4-frontend/src/scenes/BuySell/SfoxCheckout/Content/JumioStatus/template.success.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import React from 'react' | ||
import styled from 'styled-components' | ||
import { FormattedMessage } from 'react-intl' | ||
import { Button, Text } from 'blockchain-info-components' | ||
|
||
const Container = styled.div` | ||
padding: 15px; | ||
border: 1px solid ${props => props.theme['gray-1']}; | ||
` | ||
const Title = styled(Text)` | ||
color: ${props => props.theme['brand-primary']}; | ||
margin-bottom: 10px; | ||
` | ||
const Body = styled(Text)` | ||
font-size: 14px; | ||
font-weight: 300; | ||
` | ||
const ButtonWrapper = styled.div` | ||
display: flex; | ||
justify-content: center; | ||
margin-top: 10px; | ||
` | ||
|
||
export const Success = ({ value, onClick }) => { | ||
const { status } = value | ||
const statusTitleHelper = status => { | ||
switch (status) { | ||
case 'PENDING': | ||
return ( | ||
<FormattedMessage | ||
id='scenes.buysell.sfoxcheckout.content.jumio.title.pending' | ||
defaultMessage='Identity Verification Pending' | ||
/> | ||
) | ||
case 'FAILED': | ||
return ( | ||
<FormattedMessage | ||
id='scenes.buysell.sfoxcheckout.content.jumio.title.failed' | ||
defaultMessage='Identity Verification Failed' | ||
/> | ||
) | ||
} | ||
} | ||
const statusBodyHelper = status => { | ||
switch (status) { | ||
case 'PENDING': | ||
return ( | ||
<FormattedMessage | ||
id='scenes.buysell.sfoxcheckout.content.jumio.body.pending' | ||
defaultMessage='It looks like you tried to verify your identity but never finished.' | ||
/> | ||
) | ||
case 'FAILED': | ||
return ( | ||
<FormattedMessage | ||
id='scenes.buysell.sfoxcheckout.content.jumio.body.failed' | ||
defaultMessage='There was a problem with your identity verification documents. Please try again.' | ||
/> | ||
) | ||
} | ||
} | ||
|
||
return ( | ||
status !== 'DONE' && ( | ||
<Container> | ||
<Title>{statusTitleHelper(status)}</Title> | ||
<Body>{statusBodyHelper(status)}</Body> | ||
<ButtonWrapper> | ||
<Button onClick={onClick} nature='light' uppercase> | ||
<FormattedMessage | ||
id='scenes.buysell.sfoxcheckout.content.jumio.button.tryagain' | ||
defaultMessage='Try Again' | ||
/> | ||
</Button> | ||
</ButtonWrapper> | ||
</Container> | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters