Skip to content

Commit

Permalink
feat(Jumio): getJumioToken, add step to flow
Browse files Browse the repository at this point in the history
  • Loading branch information
plondon committed Jul 17, 2018
1 parent 8dc1536 commit d39f88d
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 27 deletions.
140 changes: 124 additions & 16 deletions config/wallet-options-v4.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,23 @@
"header": {
"en": "We’re packing our bags and preparing to move...domains!"
},
"sections": [{
"title": {
"en": ""
},
"body": {
"en": "To make way for our new and exciting products coming this year, we’re saying hello to our new home. blockchain.info will soon be changing URLs as it's combined with our company site, blockchain.com."
"sections": [
{
"title": {
"en": ""
},
"body": {
"en":
"To make way for our new and exciting products coming this year, we’re saying hello to our new home. blockchain.info will soon be changing URLs as it's combined with our company site, blockchain.com."
}
}
}],
],
"action": {
"title": {
"en": "Read more about what to expect."
},
"link": "https://blog.blockchain.com/2018/06/19/blockchain-infos-moving-domains/"
"link":
"https://blog.blockchain.com/2018/06/19/blockchain-infos-moving-domains/"
}
},
"wallet": {
Expand All @@ -46,7 +50,8 @@
"en": ""
},
"body": {
"en": "We’re updating our Privacy Policy and Cookie Policy to make it easier for you to understand the limited information we collect and why we collect it. We thrive on collecting the least amount of data on our users. Please review our updated policies."
"en":
"We’re updating our Privacy Policy and Cookie Policy to make it easier for you to understand the limited information we collect and why we collect it. We thrive on collecting the least amount of data on our users. Please review our updated policies."
}
}
],
Expand Down Expand Up @@ -89,7 +94,53 @@
},
"coinify": {
"fraction": 1,
"countries": ["GB", "AT", "BE", "BG", "HR", "CY", "CZ", "DK", "EE", "FI", "FR", "GF", "DE", "GI", "GR", "GP", "GG", "HU", "IS", "IE", "IM", "IT", "JE", "LV", "LI", "LT", "LU", "MT", "MQ", "YT", "MC", "NL", "NO", "PL", "PT", "RE", "BL", "MF", "PM", "SM", "SK", "SI", "ES", "SE", "CH"],
"countries": [
"GB",
"AT",
"BE",
"BG",
"HR",
"CY",
"CZ",
"DK",
"EE",
"FI",
"FR",
"GF",
"DE",
"GI",
"GR",
"GP",
"GG",
"HU",
"IS",
"IE",
"IM",
"IT",
"JE",
"LV",
"LI",
"LT",
"LU",
"MT",
"MQ",
"YT",
"MC",
"NL",
"NO",
"PL",
"PT",
"RE",
"BL",
"MF",
"PM",
"SM",
"SK",
"SI",
"ES",
"SE",
"CH"
],
"states": "*",
"config": {
"production": false,
Expand Down Expand Up @@ -130,13 +181,41 @@
"sfox": {
"fraction": 1,
"countries": ["US"],
"states": ["AR", "AZ", "CA", "CO", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "MI", "MN", "MO", "MT", "NE", "NV", "OK", "PA", "SC", "SD", "TN", "TX", "VA", "WI", "WV"],
"states": [
"AR",
"AZ",
"CA",
"CO",
"ID",
"IL",
"IN",
"KS",
"KY",
"LA",
"MA",
"MD",
"MI",
"MN",
"MO",
"MT",
"NE",
"NV",
"OK",
"PA",
"SC",
"SD",
"TN",
"TX",
"VA",
"WI",
"WV"
],
"config": {
"production": true,
"production": false,
"availability": true,
"apiKey": "f31614a7-5074-49f2-8c2a-bfb8e55de2bd",
"apiKey": "6CD61A0E965D48A7B1883A860490DC9E",
"plaid": "0b041cd9e9fbf1e7d93a0d5a39f5b9",
"plaidEnv": "production",
"plaidEnv": "tartan",
"siftScience": "3884e5fae5",
"surveyLinks": [
"https://blockchain.co1.qualtrics.com/SE/?SID=SV_bPCcv7eZgqlQSrP",
Expand All @@ -163,9 +242,38 @@
},
"fraction": 1,
"countries": "*",
"states": ["AR", "AZ", "CA", "CO", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "MI", "MN", "MO", "MT", "NE", "NV", "OK", "PA", "SC", "SD", "TN", "TX", "VA", "WI", "WV"],
"states": [
"AR",
"AZ",
"CA",
"CO",
"ID",
"IL",
"IN",
"KS",
"KY",
"LA",
"MA",
"MD",
"MI",
"MN",
"MO",
"MT",
"NE",
"NV",
"OK",
"PA",
"SC",
"SD",
"TN",
"TX",
"VA",
"WI",
"WV"
],
"config": {
"apiKey": "b7a7c320c19ea3a8e276c8921bc3ff79ec064d2cd9d98ab969acc648246b4be5ab2379af704c5d3a3021c0ddf82b3e479590718847c1301e1a85331d2d2a8370",
"apiKey":
"b7a7c320c19ea3a8e276c8921bc3ff79ec064d2cd9d98ab969acc648246b4be5ab2379af704c5d3a3021c0ddf82b3e479590718847c1301e1a85331d2d2a8370",
"upperLimit": 750,
"surveyLinks": [
"https://blockchain.co1.qualtrics.com/jfe/form/SV_1MuVnVEtWhiVIQl",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,8 @@ export const SFOX_SELL_BTC_PAYMENT_UPDATED_LOADING =
'@COMPONENT.SFOX_SELL_BTC_PAYMENT_UPDATED_LOADING'
export const SFOX_SELL_BTC_PAYMENT_UPDATED_FAILURE =
'@COMPONENT.SFOX_SELL_BTC_PAYMENT_UPDATED_FAILURE'

export const GET_JUMIO_TOKEN = '@COMPONENT.GET_JUMIO_TOKEN'
export const GET_JUMIO_TOKEN_SUCCESS = '@COMPONENT.GET_JUMIO_TOKEN_SUCCESS'
export const GET_JUMIO_TOKEN_FAILURE = '@COMPONENT.GET_JUMIO_TOKEN_FAILURE'
export const GET_JUMIO_TOKEN_LOADING = '@COMPONENT.GET_JUMIO_TOKEN_LOADING'
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,14 @@ export const sfoxSellBtcPaymentUpdatedFailure = err => ({
type: AT.SFOX_SELL_BTC_PAYMENT_UPDATED_FAILURE,
payload: err
})

export const getJumioToken = () => ({ type: AT.GET_JUMIO_TOKEN })
export const getJumioTokenLoading = () => ({ type: AT.GET_JUMIO_TOKEN_LOADING })
export const getJumioTokenSuccess = payload => ({
type: AT.GET_JUMIO_TOKEN_SUCCESS,
payload
})
export const getJumioTokenFailure = error => ({
type: AT.GET_JUMIO_TOKEN_FAILURE,
payload: error
})
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ const INITIAL_STATE = {
sfoxBusy: Remote.NotAsked,
qaSellAddress: null,
siftScienceEnabled: false,
payment: Remote.NotAsked
payment: Remote.NotAsked,
jumioToken: Remote.NotAsked
}

const sfoxSignup = (state = INITIAL_STATE, action) => {
Expand Down Expand Up @@ -46,6 +47,15 @@ const sfoxSignup = (state = INITIAL_STATE, action) => {
case AT.SFOX_SELL_BTC_PAYMENT_UPDATED_FAILURE: {
return assoc('payment', Remote.Failure(payload), state)
}
case AT.GET_JUMIO_TOKEN_SUCCESS: {
return assoc('jumioToken', Remote.Success(payload), state)
}
case AT.GET_JUMIO_TOKEN_LOADING: {
return assoc('jumioToken', Remote.Loading, state)
}
case AT.GET_JUMIO_TOKEN_FAILURE: {
return assoc('jumioToken', Remote.Failure(payload), state)
}
default:
return state
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ export default ({ coreSagas }) => {
yield takeLatest(AT.SUBMIT_SELL_QUOTE, sfoxSagas.submitSellQuote)
yield takeLatest(AT.HANDLE_MODAL_CLOSE, sfoxSagas.checkForProfileFailure)
yield takeLatest(AT.SFOX_INITIALIZE_PAYMENT, sfoxSagas.initializePayment)
yield takeLatest(AT.GET_JUMIO_TOKEN, sfoxSagas.getJumioToken)
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { put, call, select } from 'redux-saga/effects'
import { apply, put, call, select } from 'redux-saga/effects'
import { delay } from 'redux-saga'
import * as A from './actions'
import * as actions from '../../actions'
Expand Down Expand Up @@ -75,7 +75,7 @@ export default ({ coreSagas }) => {

const profile = yield select(selectors.core.data.sfox.getProfile)
if (!profile.data.verificationStatus.required_docs.length) {
yield put(A.nextStep('funding'))
yield put(A.nextStep('jumio'))
}
} catch (e) {
yield put(actions.logs.logErrorMessage(logLocation, 'upload', e))
Expand Down Expand Up @@ -258,6 +258,18 @@ export default ({ coreSagas }) => {
}
}

const getJumioToken = function*() {
try {
yield put(A.getJumioTokenLoading())
const profile = yield select(selectors.core.data.sfox.getProfile)
const token = yield apply(profile.data, profile.data.getJumioToken)
yield put(A.getJumioTokenSuccess(token))
} catch (e) {
yield put(A.getJumioTokenFailure(e))
yield put(actions.logs.logErrorMessage(logLocation, 'getJumioToken', e))
}
}

return {
checkForProfileFailure,
initializePayment,
Expand All @@ -269,6 +281,7 @@ export default ({ coreSagas }) => {
submitMicroDeposits,
submitQuote,
submitSellQuote,
getJumioToken,
upload
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import React from 'react'
import { connect } from 'react-redux'
import { bindActionCreators, compose } from 'redux'
import { actions } from 'data'

import { getData } from './selectors'
import Success from './template.success'

class JumioContainer extends React.PureComponent {
componentWillMount () {
this.props.sfoxActions.getJumioToken()
}

render () {
const { data } = this.props
return data.cata({
Success: value => <Success token={value.token} options={value.options} />,
Loading: () => <div>Loading</div>,
Failure: msg => <div>{msg}</div>,
NotAsked: () => <div />
})
}
}

const mapStateToProps = state => ({
data: getData(state)
})

const mapDispatchToProps = dispatch => ({
sfoxActions: bindActionCreators(actions.modules.sfox, dispatch)
})

const enhance = compose(
connect(
mapStateToProps,
mapDispatchToProps
)
)

export default enhance(JumioContainer)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { selectors } from 'data'
import { lift, path } from 'ramda'
import { createDeepEqualSelector } from 'services/ReselectHelper'

export const getData = createDeepEqualSelector(
[selectors.core.walletOptions.getOptions, path(['sfoxSignup', 'jumioToken'])],
(optionsR, tokenR) => {
const transform = (options, token) => {
return {
options,
token
}
}
return lift(transform)(optionsR, tokenR)
}
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React from 'react'
import styled from 'styled-components'
import { path } from 'ramda'

const Container = styled.div`
width: 100%;
height: 100%;
display: flex;
flex-direction: row;
justify-content: space-between;
`
const JumioFrame = styled.iframe`
width: 80%;
height: 450px;
border-width: 1px;
border-style: solid;
border-color: ${props => props.theme['gray-1']};
`

const Success = value => {
const { options, token } = value
const { authorizationToken } = token
const walletHelperRoot = path(['domains', 'walletHelper'], options)
const jumioUrl = `${walletHelperRoot}/wallet-helper/jumio/#/key/${authorizationToken}`

return (
<Container>
<JumioFrame
src={jumioUrl}
sandbox='allow-same-origin allow-scripts allow-forms allow-popups'
scrolling='yes'
id='jumio'
/>
</Container>
)
}

export default Success
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { path, equals } from 'ramda'
import { actions } from 'data'
import ui from 'redux-ui'
import Upload from '../Upload'
import Jumio from '../Jumio'

import Helper from 'components/BuySell/FAQ'

Expand Down Expand Up @@ -86,6 +87,7 @@ class VerifyContainer extends Component {

render () {
if (this.props.step === 'upload') return <Upload />
if (this.props.step === 'jumio') return <Jumio />
if (this.props.ui.verify === 'address') {
return <Address {...this.props} faqs={faqHelper} />
}
Expand Down

0 comments on commit d39f88d

Please sign in to comment.