Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INJIMOB-50]: Fix wrong Otp message of VC activation #1401

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions components/KebabPopUpController.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import {VCMetadata} from '../shared/VCMetadata';
import {ScanEvents} from '../machines/bleShare/scan/scanMachine';
import {BOTTOM_TAB_ROUTES, ScanStackParamList} from '../routes/routesConstants';
import {NavigationProp, useNavigation} from '@react-navigation/native';
import {MainBottomTabParamList} from '../routes/main';
import { MainBottomTabParamList } from '../routes/routeTypes';
abhip2565 marked this conversation as resolved.
Show resolved Hide resolved
import {selectIsScanning} from '../machines/bleShare/scan/selectors';
import {
VCItemEvents,
VCItemMachine,
} from '../machines/VerifiableCredential/VCItemMachine/VCItemMachine';
import {selectError} from '../machines/biometrics';
import { selectOtpError } from '../machines/VerifiableCredential/VCItemMachine/VCItemSelectors';

type ScanLayoutNavigation = NavigationProp<
ScanStackParamList & MainBottomTabParamList
Expand All @@ -50,8 +50,8 @@ export function useKebabPopUp(props) {
isAcceptingOtpInput: useSelector(service, selectAcceptingBindingOtp),
isWalletBindingError: useSelector(service, selectShowWalletBindingError),
walletBindingResponse: useSelector(service, selectWalletBindingResponse),
otpError: useSelector(service, selectError),
walletBindingError: useSelector(service, selectError),
otpError: useSelector(service, selectOtpError),
walletBindingError: useSelector(service, selectOtpError), // merge otperror and this
bindingAuthFailedError: useSelector(service, selectBindingAuthFailedError),
isKebabPopUp: useSelector(service, selectKebabPopUp),
isShowActivities: useSelector(service, selectShowActivities),
Expand Down
2 changes: 1 addition & 1 deletion components/VC/Views/VCCardViewContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const VCCardViewContent: React.FC<VCItemContentProps> = props => {
{isVCSelectable}
</Row>

<WalletBinding service={props.service} vcMetadata={props.vcMetadata} />
<WalletBinding service={props.service} vcMetadata={props.vcMetadata}/>

<RemoveVcWarningOverlay
testID="removeVcWarningOverlay"
Expand Down
3 changes: 2 additions & 1 deletion locales/ara.json
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@
"allowAccess": "اسمح بالوصول إلى الكاميرا"
},
"errors": {
"genericError": "هناك شئ غير صحيح. الرجاء معاودة المحاولة في وقت لاحق!"
"genericError": "هناك شئ غير صحيح. الرجاء معاودة المحاولة في وقت لاحق!",
"invaildOtp": "OTP غير صالح"
},
"clipboard": {
"copy": "ينسخ",
Expand Down
3 changes: 2 additions & 1 deletion locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,8 @@
"allowAccess": "Allow access to the camera"
},
"errors": {
"genericError": "Something is wrong. Please try again later!"
"genericError": "Something is wrong. Please try again later!",
"invalidOtp": "OTP is invalid"
},
"clipboard": {
"copy": "Copy",
Expand Down
3 changes: 2 additions & 1 deletion locales/fil.json
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@
},
"ignore": "Huwag pansinin",
"errors": {
"genericError": "May mali. Subukang muli mamaya!"
"genericError": "May mali. Subukang muli mamaya!",
"invalidOtp": "Di-wasto ang OTP"
},
"clipboard": {
"copy": "Kopya",
Expand Down
3 changes: 2 additions & 1 deletion locales/hin.json
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@
"allowAccess": "कैमरे तक पहुंच की अनुमति दें"
},
"errors": {
"genericError": "कुछ गलत हो गया। कृपया कुछ समय बाद पुन: प्रयास करें!"
"genericError": "कुछ गलत हो गया। कृपया कुछ समय बाद पुन: प्रयास करें!",
"invalidOtp": "OTP अमान्य है"
},
"clipboard": {
"copy": "प्रतिलिपि",
Expand Down
3 changes: 2 additions & 1 deletion locales/kan.json
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@
"allowAccess": "ಕ್ಯಾಮರಾಗೆ ಪ್ರವೇಶವನ್ನು ಅನುಮತಿಸಿ"
},
"errors": {
"genericError": "ಏನೋ ತಪ್ಪಾಗಿದೆ. ದಯವಿಟ್ಟು ಸ್ವಲ್ಪ ಸಮಯದ ನಂತರ ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ!"
"genericError": "ಏನೋ ತಪ್ಪಾಗಿದೆ. ದಯವಿಟ್ಟು ಸ್ವಲ್ಪ ಸಮಯದ ನಂತರ ಮತ್ತೆ ಪ್ರಯತ್ನಿಸಿ!",
"invalidOtp": "OTP ಅಮಾನ್ಯವಾಗಿದೆ"
},
"clipboard": {
"copy": "ನಕಲು ಮಾಡಿ",
Expand Down
3 changes: 2 additions & 1 deletion locales/tam.json
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@
"allowAccess": "கேமராவை அணுக அனுமதிக்கவும்"
},
"errors": {
"genericError": "ஏதோ தவறு நடந்துவிட்டது. சிறிது நேரம் கழித்து மீண்டும் முயற்சிக்கவும்!"
"genericError": "ஏதோ தவறு நடந்துவிட்டது. சிறிது நேரம் கழித்து மீண்டும் முயற்சிக்கவும்!",
"invalidOtp": "OTP தவறானது"
},
"clipboard": {
"copy": "நகலெடுக்கவும்",
Expand Down
156 changes: 62 additions & 94 deletions machines/QrLoginMachine.typegen.ts
Original file line number Diff line number Diff line change
@@ -1,95 +1,63 @@
// This file was automatically generated. Edits will be overwritten

export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
'done.invoke.QrLogin.linkTransaction:invocation[0]': {
type: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'done.invoke.QrLogin.sendingAuthenticate:invocation[0]': {
type: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]';
data: unknown;
__tip: 'See the XState TS docs to learn how to strongly type this.';
};
'error.platform.QrLogin.linkTransaction:invocation[0]': {
type: 'error.platform.QrLogin.linkTransaction:invocation[0]';
data: unknown;
};
'error.platform.QrLogin.sendingAuthenticate:invocation[0]': {
type: 'error.platform.QrLogin.sendingAuthenticate:invocation[0]';
data: unknown;
};
'error.platform.QrLogin.sendingConsent:invocation[0]': {
type: 'error.platform.QrLogin.sendingConsent:invocation[0]';
data: unknown;
};
'xstate.init': {type: 'xstate.init'};
};
invokeSrcNameMap: {
linkTransaction: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
sendAuthenticate: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]';
sendConsent: 'done.invoke.QrLogin.sendingConsent:invocation[0]';
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
SetErrorMessage:
| 'error.platform.QrLogin.linkTransaction:invocation[0]'
| 'error.platform.QrLogin.sendingAuthenticate:invocation[0]'
| 'error.platform.QrLogin.sendingConsent:invocation[0]';
expandLinkTransResp: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
forwardToParent: 'CANCEL' | 'DISMISS';
loadMyVcs: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
loadThumbprint: 'FACE_VALID';
resetFlowType: 'xstate.init';
resetLinkTransactionId: 'GET';
resetSelectedVc: 'xstate.init';
resetSelectedVoluntaryClaims: 'GET';
setClaims: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
setConsentClaims: 'TOGGLE_CONSENT_CLAIM';
setFaceAuthConsent: 'GET';
setLinkedTransactionId: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]';
setMyVcs: 'STORE_RESPONSE';
setScanData: 'GET';
setSelectedVc: 'SELECT_VC';
setShowFaceAuthConsent: 'FACE_VERIFICATION_CONSENT';
setThumbprint: 'STORE_RESPONSE';
setlinkTransactionResponse: 'done.invoke.QrLogin.linkTransaction:invocation[0]';
storeShowFaceAuthConsent: 'FACE_VERIFICATION_CONSENT';
};
eventsCausingDelays: {};
eventsCausingGuards: {
isConsentAlreadyCaptured: 'done.invoke.QrLogin.sendingAuthenticate:invocation[0]';
isSimpleShareFlow:
| 'CANCEL'
| 'done.invoke.QrLogin.linkTransaction:invocation[0]';
showFaceAuthConsentScreen: 'VERIFY';
};
eventsCausingServices: {
linkTransaction: 'GET';
sendAuthenticate: 'STORE_RESPONSE';
sendConsent: 'CONFIRM';
};
matchesStates:
| 'ShowError'
| 'done'
| 'faceAuth'
| 'faceVerificationConsent'
| 'invalidIdentity'
| 'linkTransaction'
| 'loadMyVcs'
| 'loadingThumbprint'
| 'requestConsent'
| 'sendingAuthenticate'
| 'sendingConsent'
| 'showvcList'
| 'success'
| 'waitingForData';
tags: never;
}
// This file was automatically generated. Edits will be overwritten

export interface Typegen0 {
'@@xstate/typegen': true;
internalEvents: {
"done.invoke.QrLogin.linkTransaction:invocation[0]": { type: "done.invoke.QrLogin.linkTransaction:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
"done.invoke.QrLogin.sendingAuthenticate:invocation[0]": { type: "done.invoke.QrLogin.sendingAuthenticate:invocation[0]"; data: unknown; __tip: "See the XState TS docs to learn how to strongly type this." };
"error.platform.QrLogin.linkTransaction:invocation[0]": { type: "error.platform.QrLogin.linkTransaction:invocation[0]"; data: unknown };
"error.platform.QrLogin.sendingAuthenticate:invocation[0]": { type: "error.platform.QrLogin.sendingAuthenticate:invocation[0]"; data: unknown };
"error.platform.QrLogin.sendingConsent:invocation[0]": { type: "error.platform.QrLogin.sendingConsent:invocation[0]"; data: unknown };
"xstate.init": { type: "xstate.init" };
};
invokeSrcNameMap: {
"linkTransaction": "done.invoke.QrLogin.linkTransaction:invocation[0]";
"sendAuthenticate": "done.invoke.QrLogin.sendingAuthenticate:invocation[0]";
"sendConsent": "done.invoke.QrLogin.sendingConsent:invocation[0]";
};
missingImplementations: {
actions: never;
delays: never;
guards: never;
services: never;
};
eventsCausingActions: {
"SetErrorMessage": "error.platform.QrLogin.linkTransaction:invocation[0]" | "error.platform.QrLogin.sendingAuthenticate:invocation[0]" | "error.platform.QrLogin.sendingConsent:invocation[0]";
"expandLinkTransResp": "done.invoke.QrLogin.linkTransaction:invocation[0]";
"forwardToParent": "CANCEL" | "DISMISS";
"loadMyVcs": "done.invoke.QrLogin.linkTransaction:invocation[0]";
"loadThumbprint": "FACE_VALID";
"resetFlowType": "xstate.init";
"resetLinkTransactionId": "GET";
"resetSelectedVc": "xstate.init";
"resetSelectedVoluntaryClaims": "GET";
"setClaims": "done.invoke.QrLogin.linkTransaction:invocation[0]";
"setConsentClaims": "TOGGLE_CONSENT_CLAIM";
"setFaceAuthConsent": "GET";
"setLinkedTransactionId": "done.invoke.QrLogin.sendingAuthenticate:invocation[0]";
"setMyVcs": "STORE_RESPONSE";
"setScanData": "GET";
"setSelectedVc": "SELECT_VC";
"setShowFaceAuthConsent": "FACE_VERIFICATION_CONSENT";
"setThumbprint": "STORE_RESPONSE";
"setlinkTransactionResponse": "done.invoke.QrLogin.linkTransaction:invocation[0]";
"storeShowFaceAuthConsent": "FACE_VERIFICATION_CONSENT";
};
eventsCausingDelays: {

};
eventsCausingGuards: {
"isConsentAlreadyCaptured": "done.invoke.QrLogin.sendingAuthenticate:invocation[0]";
"isSimpleShareFlow": "CANCEL" | "done.invoke.QrLogin.linkTransaction:invocation[0]";
"showFaceAuthConsentScreen": "VERIFY";
};
eventsCausingServices: {
"linkTransaction": "GET";
"sendAuthenticate": "STORE_RESPONSE";
"sendConsent": "CONFIRM";
};
matchesStates: "ShowError" | "done" | "faceAuth" | "faceVerificationConsent" | "invalidIdentity" | "linkTransaction" | "loadMyVcs" | "loadingThumbprint" | "requestConsent" | "sendingAuthenticate" | "sendingConsent" | "showvcList" | "success" | "waitingForData";
tags: never;
}

11 changes: 9 additions & 2 deletions machines/VerifiableCredential/VCItemMachine/VCItemActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,11 @@ export const VCItemActions = model => {
ns: 'common',
}),
}),
setErrorAsInvalidOtpError:assign({
error:()=>i18n.t('errors.invalidOtp', {
ns: 'common',
}),
}),
setErrorAsVerificationError: assign({
//todo handle error message from different actions
error: (_context, event) => (event.data as Error).message,
Expand All @@ -196,8 +201,10 @@ export const VCItemActions = model => {
},
),
setWalletBindingResponse: assign({
walletBindingResponse: (_context, event) =>
event.data as WalletBindingResponse,
walletBindingResponse: (_context, event) =>{
return event.data as WalletBindingResponse
abhip2565 marked this conversation as resolved.
Show resolved Hide resolved
}

}),
incrementDownloadCounter: model.assign({
downloadCounter: ({downloadCounter}) => downloadCounter + 1,
Expand Down
6 changes: 3 additions & 3 deletions machines/VerifiableCredential/VCItemMachine/VCItemMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ export const VCItemMachine = model.createMachine(
},
],
},
},
},
acceptingBindingOTP: {
entry: ['unSetOTP'],
on: {
Expand Down Expand Up @@ -302,11 +302,11 @@ export const VCItemMachine = model.createMachine(
onError: [
{
actions: [
'setErrorAsWalletBindingError',
'setErrorAsInvalidOtpError',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to add condition to check the error message if it is a binding_auth_failed msg only then we will show invalid input error.

'sendWalletBindingErrorEvent',
'logWalletBindingFailure',
],
target: 'showingWalletBindingError',
target: '#vc-item-machine.walletBinding.acceptingBindingOTP',
},
],
},
Expand Down
Loading
Loading