Skip to content

Commit

Permalink
fix(KYC): updaetd email send flow
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-blockchain committed Nov 30, 2018
1 parent 42b3e6f commit b0e235b
Show file tree
Hide file tree
Showing 11 changed files with 100 additions and 86 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ export const CREATE_REGISTER_USER_CAMPAIGN =
export const CHECK_KYC_FLOW = '@EVENT.KYC.CHECK_KYC_FLOW'
export const SET_KYCFLOW = '@DATA.KYC.SET_KYCFLOW'

export const RESEND_DEEP_LINK = '@EVENT.RESEND_DEEP_LINK'
export const SEND_DEEP_LINK = '@EVENT.SEND_DEEP_LINK'
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,6 @@ export const setKycFlow = flowType => ({
type: AT.SET_KYCFLOW,
payload: { flowType }
})
export const resendDeeplink = () => ({
type: AT.RESEND_DEEP_LINK
export const sendDeeplink = () => ({
type: AT.SEND_DEEP_LINK
})
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ export default ({ api, coreSagas }) => {
exchange.createRegisterUserCampaign
)
yield takeLatest(AT.CHECK_KYC_FLOW, exchange.checkKycFlow)
yield takeLatest(AT.RESEND_DEEP_LINK, exchange.resendDeeplink)
yield takeLatest(AT.SEND_DEEP_LINK, exchange.sendDeeplink)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,11 @@ export default ({ api, coreSagas }) => {
}
}

const resendDeeplink = function*() {
const sendDeeplink = function*() {
try {
yield call(api.resendDeeplink)
yield call(api.sendDeeplink)
} catch (e) {
yield put(actions.logs.logErrorMessage(logLocation, 'resendDeeplink', e))
yield put(actions.logs.logErrorMessage(logLocation, 'sendDeeplink', e))
}
}

Expand All @@ -408,6 +408,6 @@ export default ({ api, coreSagas }) => {
updateSmsNumber,
verifySmsNumber,
checkKycFlow,
resendDeeplink
sendDeeplink
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import sagas, { wrongFlowTypeError } from './sagas'

const api = {
fetchKycConfig: jest.fn(),
resendDeeplink: jest.fn()
sendDeeplink: jest.fn()
}

const coreSagas = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,19 @@ exports[`HighFlow should render correctly 1`] = `
bold={false}
capitalize={false}
color="brand-secondary"
onClick={[MockFunction]}
onClick={
[MockFunction] {
"calls": Array [
Array [],
],
"results": Array [
Object {
"isThrow": false,
"value": undefined,
},
],
}
}
size="16px"
uppercase={false}
weight={400}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class VerifyContainer extends React.PureComponent {
flowType === FLOW_TYPES.LOW ? (
<LowFlow supportedDocuments={docTypes} {...rest} />
) : (
<HighFlow mobile={mobile} resend={actions.resendDeeplink} {...rest} />
<HighFlow mobile={mobile} send={actions.sendDeeplink} {...rest} />
),
Loading: () => <Loading />,
NotAsked: () => null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,66 +31,75 @@ const VerifyWrapper = styled.div`
`};
`

const Verify = ({ resend, onBack, mobile }) => (
<IdentityVerificationForm>
<FooterShadowWrapper
fields={
<VerifyWrapper>
<ColLeft>
<InputWrapper>
<IdentityVerificationHeader>
class Verify extends React.PureComponent {
componentDidMount () {
this.props.send()
}

render () {
const { send, onBack, mobile } = this.props
return (
<IdentityVerificationForm>
<FooterShadowWrapper
fields={
<VerifyWrapper>
<ColLeft>
<InputWrapper>
<IdentityVerificationHeader>
<FormattedMessage
id='identityverification.highflow.header'
defaultMessage='Last Step. Continue your verification on mobile'
/>
</IdentityVerificationHeader>
<IdentityVerificationImage name='identity-verification' />
<IdentityVerificationSubHeader>
<Text>
<FormattedMessage
id='identityverification.highflow.message'
defaultMessage='We need to confirm your identity by taking a selfie video'
/>
</Text>
<br />
<Text>
<FormattedMessage
id='identityverification.highflow.sentlink'
defaultMessage='- We just sent you an SMS to {mobile} with a link to complete KYC on your mobile device'
values={{ mobile }}
/>
</Text>
<Text>
<FormattedMessage
id='identityverification.highflow.getidready'
defaultMessage='- Get your ID or Passport ready'
/>
</Text>
<br />
<Link onClick={send}>
<FormattedMessage
id='identityverification.highflow.resend'
defaultMessage='Resend link'
/>
</Link>
</IdentityVerificationSubHeader>
</InputWrapper>
</ColLeft>
</VerifyWrapper>
}
footer={
<Footer>
<BackButton onClick={onBack}>
<FormattedMessage
id='identityverification.highflow.header'
defaultMessage='Last Step. Continue your verification on mobile'
id='identityverification.personal.back'
defaultMessage='Back'
/>
</IdentityVerificationHeader>
<IdentityVerificationImage name='identity-verification' />
<IdentityVerificationSubHeader>
<Text>
<FormattedMessage
id='identityverification.highflow.message'
defaultMessage='We need to confirm your identity by taking a selfie video'
/>
</Text>
<br />
<Text>
<FormattedMessage
id='identityverification.highflow.sentlink'
defaultMessage='- We just sent you an SMS to {mobile} with a link to complete KYC on your mobile device'
values={{ mobile }}
/>
</Text>
<Text>
<FormattedMessage
id='identityverification.highflow.getidready'
defaultMessage='- Get your ID or Passport ready'
/>
</Text>
<br />
<Link onClick={resend}>
<FormattedMessage
id='identityverification.highflow.resend'
defaultMessage='Resend link'
/>
</Link>
</IdentityVerificationSubHeader>
</InputWrapper>
</ColLeft>
</VerifyWrapper>
}
footer={
<Footer>
<BackButton onClick={onBack}>
<FormattedMessage
id='identityverification.personal.back'
defaultMessage='Back'
/>
</BackButton>
</Footer>
}
/>
</IdentityVerificationForm>
)
</BackButton>
</Footer>
}
/>
</IdentityVerificationForm>
)
}
}

Verify.propTypes = {
handleSubmit: PropTypes.func.isRequired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import HighFlow from './template.highflow'
import { BackButton } from 'components/IdentityVerification'

const onBack = jest.fn()
const resend = jest.fn()
const send = jest.fn()

describe('HighFlow', () => {
beforeEach(() => {
Expand All @@ -15,15 +15,15 @@ describe('HighFlow', () => {

it('should render correctly', () => {
const component = shallow(
<HighFlow mobile={'1234567890'} onBack={onBack} resend={resend} />
<HighFlow mobile={'1234567890'} onBack={onBack} send={send} />
)
const tree = toJson(component)
expect(tree).toMatchSnapshot()
})

it('should trigger onBack on back button click', () => {
const component = shallow(
<HighFlow mobile={'1234567890'} onBack={onBack} resend={resend} />
<HighFlow mobile={'1234567890'} onBack={onBack} send={send} />
)
component
.find('FooterShadowWrapper')
Expand All @@ -33,15 +33,8 @@ describe('HighFlow', () => {
expect(onBack).toHaveBeenCalledTimes(1)
})

it('should trigger resend on resend link click', () => {
const component = shallow(
<HighFlow mobile={'1234567890'} onBack={onBack} resend={resend} />
)
component
.find('FooterShadowWrapper')
.dive()
.find('Link')
.simulate('click')
expect(resend).toHaveBeenCalledTimes(1)
it('should trigger email send on mount', () => {
shallow(<HighFlow mobile={'1234567890'} onBack={onBack} send={send} />)
expect(send).toHaveBeenCalledTimes(1)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('HighFlow', () => {
expect(onBack).toHaveBeenCalledTimes(1)
})

it('should trigger resend on resend link click', () => {
it('should trigger submit on submit click', () => {
const component = shallow(
<LowFlow
supportedDocuments={supportedDocuments}
Expand Down
6 changes: 3 additions & 3 deletions packages/blockchain-wallet-v4/src/network/api/kyc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ export default ({ nabuUrl, get, post, authorizedGet, authorizedPost }) => {
endPoint: '/kyc/configuration'
})

const resendDeeplink = () =>
const sendDeeplink = () =>
authorizedPost({
url: nabuUrl,
contentType: 'application/json',
endPoint: '/kyc/resendDeeplink'
endPoint: '/kyc/verifications/mobile-email'
})

return {
Expand All @@ -84,7 +84,7 @@ export default ({ nabuUrl, get, post, authorizedGet, authorizedPost }) => {
fetchOnfidoSDKKey,
fetchUploadData,
syncOnfido,
resendDeeplink,
sendDeeplink,
uploadDocuments
}
}

0 comments on commit b0e235b

Please sign in to comment.