Skip to main content

Using Predefined Behaviors

Overview

The SDKFakePreDefinedReaderBehaviourProvider is a utility object designed to simplify the simulation of common behaviors for card readers. It provides a variety of ready-to-use behaviors for different card types and scenarios, making it easier to test specific cases without manually configuring the details each time.

The predefined behaviors include support for approved card transactions (contact, contactless, and magnetic stripe), multiple application selection, declines (offline and after online authorization), and connection failures.


Approved Card Behaviors

approvedCardBehaviourWithContact

Simulates a successful card read using a contact card.

Parameters:

  • brand (SDKFakeCardBrand): The brand of the card.
SDKFakeInstallerProvider.getInstaller(
SDKFakePreDefinedReaderBehaviourProvider.approvedCardBehaviourWithContact(SDKFakeCardBrand.Visa)
)

approvedCardBehaviourWithContactless

Simulates a successful card read using a contactless card.

Parameters:

  • brand (SDKFakeCardBrand): The brand of the card.
SDKFakeInstallerProvider.getInstaller(
SDKFakePreDefinedReaderBehaviourProvider.approvedCardBehaviourWithContactless(SDKFakeCardBrand.Visa)
)

approvedCardBehaviourWithMagnetic

Simulates a successful card read using a magnetic stripe card.

Parameters:

  • brand (SDKFakeCardBrand): The brand of the card.
SDKFakeInstallerProvider.getInstaller(
SDKFakePreDefinedReaderBehaviourProvider.approvedCardBehaviourWithMagnetic(SDKFakeCardBrand.Visa)
)

contactCardWithMultipleApplicationsToSelect

Simulates a contact card with multiple EMV applications available for selection during a transaction.

Parameters:

  • brand (SDKFakeCardBrand): The brand of the card.
SDKFakeInstallerProvider.getInstaller(
SDKFakePreDefinedReaderBehaviourProvider.contactCardWithMultipleApplicationsToSelect(SDKFakeCardBrand.Visa)
)

Decline

declineOffline

Simulates an offline decline with a specified reason.

Parameters:

  • reason (SDKFakeReaderActionRequest.OnCardBehaviourRequired.CardReadBehaviour.Decline.BeforeGoingOnline.Reason): The reason for the decline. Possible values include:
    • OfflineDeclined
    • DoFallback
    • NfcTryAgain
    • SeePhone
    • EmvCardBlocked
    • Terminated
SDKFakeInstallerProvider.getInstaller(
SDKFakePreDefinedReaderBehaviourProvider.declineOffline(
reason = SDKFakeReaderActionRequest.OnCardBehaviourRequired.CardReadBehaviour.Decline.BeforeGoingOnline.Reason.EmvCardBlocked
)
)

requestOnlineAuthorizationButDeclineAfterGoingOnline

Simulates a scenario where the card requests online authorization but is declined after the authorization process.

Parameters:

  • brand (SDKFakeCardBrand): The brand of the card.
SDKFakeInstallerProvider.getInstaller(
SDKFakePreDefinedReaderBehaviourProvider.requestOnlineAuthorizationButDeclineAfterGoingOnline(
brand = SDKFakeCardBrand.Visa
)
)

failConnectionToReader

Simulates a scenario where the connection to the card reader fails.

Parameters:

  • None.
SDKFakeInstallerProvider.getInstaller(
SDKFakePreDefinedReaderBehaviourProvider.failConnectionToReader()
)