Listening to events

You can listen to various events in the IssueCard using the onEvent prop.

import { IssueCard } from '@card91/react-native-issue-card';

export function IssueCardPage() {
	const onIssueCardEvent = (event) => {
  	switch (event) {
      case "C91_MIN_KYC_INITIALISED":
        // Do something to indicate that library is initialized
        break;
      case "C91_MIN_KYC_SUCCESS":
         // Do something to indicate that the API calls have succeeded
        break;
      case "C91_MIN_KYC_API_FAILURE":
        // Do something to indicate that the API calls have failed
        break;
      case "C91_MIN_KYC_AUTHENTICATION_FAILURE":
       // Do something to indicate that the API calls have Unauthorized
        break;
      case "C91_MIN_KYC_SERVER_FAILURE":
         // Do something to indicate that the API calls have Server Error
        break;
      case 'C91_ISSUE_CARD_API_FAILURE':
        // Do something to indicate that the API calls have failed
        break;
       case "C91_MIN_KYC_MISSING_PARAMETER":
         // Do something to indicate that Parameter is missing
        break;
      case "C91_MIN_KYC_OTP_SEND_FAIL":
        // Do something to indicate that the API fails to send the OTP
        break;
      case "C91_MIN_KYC_OTP_VERIFICATION_FAIL":
        // Do something to indicate that the API MIN KYC Verification is failed
        break;
      case 'C91_MIN_KYC_MOBILE_ALREADY_EXIST_OR_INVALID':
        // Do something to indicate that the KYC already done or mobile number invalid 
       // Check the payload to identify the two cases here 
        
    }
  };
  
  return (
    <View>
	  	<IssueCard ... onEvent={onIssueCardEvent} />
		</View>
  );
}

The events are as follows:

Event NameDescription
C91_MIN_KYC_INITIALISEDThe NSDL MIN KYC screen has been initialised.
C91_MIN_KYC_SUCCESSThe API request related to the NSDL MIN KYC screen was successful.
C91_MIN_KYC_API_FAILUREThe API request related to theNSDL MIN KYC screen has failed.
C91_MIN_KYC_AUTHENTICATION_FAILUREAuthentication for the NSDL MIN KYC screen has failed.
C91_MIN_KYC_SERVER_FAILUREThe server encountered an error while processing the NSDL MIN KYC request.
C91_MIN_KYC_MISSING_PARAMETERA required parameter is missing in the NSDL MIN KYC request.
C91_MIN_KYC_OTP_SEND_FAILThe API request for generating the OTP for the NSDL MIN KYC has failed.
C91_MIN_KYC_OTP_VERIFICATION_FAILThe API request for validating the OTP has failed for the NSDL MIN KYC
C91_MIN_KYC_MOBILE_ALREADY_EXIST_OR_INVALIDKYC for this mobile number is already done or the mobile number is not valid.
Payload of both these event will be different.