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) + } } } diff --git a/src/actions/sso/index.ts b/src/actions/sso/index.ts index 624421e489..0772157b45 100644 --- a/src/actions/sso/index.ts +++ b/src/actions/sso/index.ts @@ -126,11 +126,11 @@ interface AttributeSummary { export const consumeCredentialRequest = (decodedCredentialRequest: JSONWebToken) => { return async (dispatch: Dispatch, getState: Function, backendMiddleware: BackendMiddleware) => { - const { storageLib, identityWallet } = backendMiddleware + const { storageLib } = backendMiddleware const { did } = getState().account.did.toJS() try { - await identityWallet.validateJWT(decodedCredentialRequest) + // await identityWallet.validateJWT(decodedCredentialRequest) const requestedTypes = decodedCredentialRequest.interactionToken.requestedCredentialTypes const attributesForType = await Promise.all(requestedTypes.map(storageLib.get.attributesByType))