Skip to content

Commit

Permalink
deep link route on cancel - payment only
Browse files Browse the repository at this point in the history
  • Loading branch information
nataschaberg committed Feb 18, 2019
1 parent a61be43 commit ac7e6d3
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/actions/payment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,20 @@ export const clearPaymentRequest = () => {
}

export const cancelPaymentRequest = () => {
return (dispatch: Dispatch<AnyAction>) => {
return (dispatch: Dispatch<AnyAction>, getState: Function) => {
const { callbackURL } = getState().payment.activePaymentRequest
dispatch(clearPaymentRequest())
dispatch(navigationActions.navigatorReset({ routeName: routeList.Home }))

/**
* This needs to be cleaned up after demo
* TODO: consolidate routing back to callbackURL for deep linking for payment & sso
*/
if (callbackURL.includes('http')) {
dispatch(navigationActions.navigatorReset({ routeName: routeList.Home }))
} else {
const url = callbackURL + Buffer.from(JSON.stringify({token: false})).toString('base64')
Linking.openURL(url)
}
}
}

Expand Down

0 comments on commit ac7e6d3

Please sign in to comment.