Skip to content

Commit

Permalink
feat(simple buy): allow user retry card payment if pending_depo
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip London committed Apr 27, 2020
1 parent 210fc74 commit 4a53492
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,7 @@ type MessagesType = {
'modals.simplebuy.summary.created': 'Created'
'modals.simplebuy.summary.paymentmethod': 'Payment Method'
'modals.simplebuy.summary.purchasing': 'Purchasing'
'modals.simplebuy.summary.retry_card': 'Retry Card Payment'
'modals.simplebuy.summary.txid': 'Transaction ID'
'modals.simplebuy.summary.viewtransferdets': 'View Bank Transfer Details'
'modals.simplebuy.transactionfeed.canceled': '{type} Canceled'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,12 +459,15 @@ export default ({
api.getSBCard,
cardId
)
let step = S.getStep(yield select())

while (
(card.state === 'CREATED' || card.state === 'PENDING') &&
retryAttempts < maxRetryAttempts
retryAttempts < maxRetryAttempts &&
step === '3DS_HANDLER'
) {
card = yield call(api.getSBCard, cardId)
step = S.getStep(yield select())
retryAttempts++
yield delay(3000)
}
Expand All @@ -489,12 +492,15 @@ export default ({
api.getSBOrder,
orderId
)
let step = S.getStep(yield select())

while (
order.state === 'PENDING_DEPOSIT' &&
retryAttempts < maxRetryAttempts
retryAttempts < maxRetryAttempts &&
step === '3DS_HANDLER'
) {
order = yield call(api.getSBOrder, orderId)
step = S.getStep(yield select())
retryAttempts++
yield delay(3000)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,27 @@ const Success: React.FC<Props> = props => {
</Button>
</Bottom>
))}
{props.order.paymentMethodId && props.order.state === 'PENDING_DEPOSIT' && (
<Bottom>
<Button
data-e2e='sbRetryCard'
size='16px'
height='48px'
nature='primary'
onClick={() =>
props.simpleBuyActions.setStep({
step: '3DS_HANDLER',
order: props.order
})
}
>
<FormattedMessage
id='modals.simplebuy.summary.retry_card'
defaultMessage='Retry Card Payment'
/>
</Button>
</Bottom>
)}
</Wrapper>
)
}
Expand Down

0 comments on commit 4a53492

Please sign in to comment.