diff --git a/src/actions/payment/index.ts b/src/actions/payment/index.ts index c6076d3cb7..acfc5adbe5 100644 --- a/src/actions/payment/index.ts +++ b/src/actions/payment/index.ts @@ -26,9 +26,20 @@ export const clearPaymentRequest = () => { } export const cancelPaymentRequest = () => { - return (dispatch: Dispatch) => { + return (dispatch: Dispatch, 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) + } } }