From ac7e6d3cf749d79ff20cf8fad983ce28bbd2e74f Mon Sep 17 00:00:00 2001 From: nataschaberg Date: Mon, 18 Feb 2019 10:24:20 +0100 Subject: [PATCH] deep link route on cancel - payment only --- src/actions/payment/index.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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) + } } }