Skip to content

Commit

Permalink
feat(simple buy): add email to create sb card call
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Apr 29, 2020
1 parent 5672887 commit 1a0b166
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,7 @@ type MessagesType = {
'modals.simplebuy.gatheringinfo': 'Gathering Some Info...'
'modals.simplebuy.linking_card': 'Securely Linking Your Card'
'modals.simplebuy.linking_card.time': 'This could take up to 20 seconds. Please do not close this window.'
'modals.simplebuy.linking_card.time_extended': 'This could take up to 2 minutes. Please do not close this window.'
'modals.simplebuy.localcurrency': 'Select the local currency for your wallet.'
'modals.simplebuy.name_on_card': 'Name on Card'
'modals.simplebuy.ordersummary': 'Buy Order Summary'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,14 @@ export default ({
const address = billingAddressForm || userData.address
if (!address) throw new Error('NO_USER_ADDRESS')

card = yield call(api.createSBCard, currency, {
...address
})
card = yield call(
api.createSBCard,
currency,
{
...address
},
userData.email
)
} else {
card = yield call(api.getSBCard, cardId)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ const Success: React.FC<InjectedFormProps<{}, Props> & Props> = props => {
)}
<FormGroup>
<Link
style={{ textAlign: 'center', width: '100%' }}
size='13px'
style={{
textAlign: 'center',
width: '100%'
}}
onClick={() =>
props.simpleBuyActions.setStep({ step: 'CC_BILLING_ADDRESS' })
}
Expand All @@ -137,7 +141,7 @@ const Success: React.FC<InjectedFormProps<{}, Props> & Props> = props => {
/>
</Link>
</FormGroup>
<FormGroup>
<FormGroup margin='20px'>
<Button
nature='primary'
data-e2e='addCardEnter'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,17 @@ const Loading: React.FC<Props> = ({ order, polling }) => {
color='grey600'
style={{ marginTop: '20px' }}
>
<FormattedMessage
id='modals.simplebuy.linking_card.time'
defaultMessage='This could take up to 20 seconds. Please do not close this window.'
/>
{polling ? (
<FormattedMessage
id='modals.simplebuy.linking_card.time_extended'
defaultMessage='This could take up to 2 minutes. Please do not close this window.'
/>
) : (
<FormattedMessage
id='modals.simplebuy.linking_card.time'
defaultMessage='This could take up to 20 seconds. Please do not close this window.'
/>
)}
</Text>
</Wrapper>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
SBSuggestedAmountType
} from './types'
import { Moment } from 'moment'
import { UserDataType } from 'data/types'
import axios from 'axios'

export default ({
Expand Down Expand Up @@ -45,15 +46,18 @@ export default ({

const createSBCard = (
currency: FiatType,
address: NabuAddressType
address: NabuAddressType,
email: UserDataType['email']
): SBCardType =>
authorizedPost({
url: nabuUrl,
endPoint: '/payments/cards',
contentType: 'application/json',
removeDefaultPostData: true,
data: {
currency,
address
address,
email
}
})

Expand Down

0 comments on commit 1a0b166

Please sign in to comment.