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_ISSUE_CARD_SCREEN_INITIALISED":
        // Do something to indicate that Parameter is missing
        break;
      case "C91_ISSUE_CARD_AUTHENTICATION_FAILURE":
        // Do something to indicate that the API calls have Unauthorized
        break;
      case "C91_ISSUE_CARD_SERVER_FAILURE":
        // Do something to indicate that the API calls have Server Error
        break;
      case "C91_ISSUE_CARD_SCREEN_SUCCESS":
        // Do something to indicate that the API calls have succeeded
        break;
      case "C91_ISSUE_CARD_MISSING_PARAMETER":
        // Do something to indicate that the API calls have succeeded
        break;
      case 'C91_ISSUE_CARD_API_FAILURE':
        // Do something to indicate that the API calls have failed
        break;
       case "C91_ISSUE_CARD_EXTERNAL_AUTHENTICATION_FAILURE":
        // Do something to indicate that the API calls have Unauthorized
        break;
      case "C91_ISSUE_CARD_EXTERNAL_SERVER_FAILURE":
        // Do something to indicate that the API calls have Server Error
        break;
      case "C91_ISSUE_CARD_TOKEN_API_SUCCESS":
        // Do something to indicate that the API calls have succeeded
        break;
      case 'C91_ISSUE_CARD_TOKEN_API_FAILURE':
        // Do something to indicate that the API calls have failed
        break;
      case 'C91_ISSUE_CARD_EXTERNAL_MISSING_PARAMETER':
        // Do something to indicate that the API calls have failed
        break;
    }
  };
  
  return (
    <View>
	  	<IssueCard ... onEvent={onIssueCardEvent} />
		</View>
  );
}

The events are as follows:

Event NameDescription
C91_ISSUE_CARD_SCREEN_INITIALISEDThe issue card screen has been initialised.
C91_ISSUE_CARD_SCREEN_SUCCESSThe API request related to the issue card screen was successful.
C91_ISSUE_CARD_API_FAILUREThe API request related to the issue card screen has failed.
C91_ISSUE_CARD_AUTHENTICATION_FAILUREAuthentication for the issue card screen has failed.
C91_ISSUE_CARD_SERVER_FAILUREThe server encountered an error while processing the issue card request.
C91_ISSUE_CARD_MISSING_PARAMETERA required parameter is missing in the issue card request.
C91_ISSUE_CARD_TOKEN_API_SUCCESSThe API request for retrieving a token related to the issue card was successful.
C91_ISSUE_CARD_TOKEN_API_FAILUREThe API request for retrieving a token related to the issue card has failed.
C91_ISSUE_CARD_EXTERNAL_SERVER_FAILUREAn external server encountered an error while processing the issue card request.
C91_ISSUE_CARD_EXTERNAL_MISSING_PARAMETERA required parameter is missing in the external issue card request.
C91_ISSUE_CARD_EXTERNAL_AUTHENTICATION_FAILUREAuthentication for the external issue card request has failed.