starts Contact App Selection
Initiates the application selection process specifically for contact-based EMV cards.
This method starts the application selection procedure when a contact card is inserted and multiple applications (AIDs) may be present on the card or a single application needs cardholder confirmation. The terminal will either display a list of available applications for cardholder selection or automatically select an application based on predefined terminal rules and priorities.
Prerequisites:
startTransaction must have been called successfully
startTransaction must have returned CardType.CONTACT
Contact card must be properly inserted and powered up
Application selection process:
Application discovery - Reads the Payment System Environment (PSE) or performs directory listing to identify available applications on the card
Application filtering - Matches card applications against terminal-supported AIDs
Priority handling - Applies application priority rules for selection
User interaction - May invoke display callbacks for application selection menu if multiple valid applications are found
Selection scenarios:
Single application - no cardholder confirmation needed: Automatically selected without user interaction
Single application - cardholder confirmation needed: User selection via display callbacks (INexusDspCallbacks.MenuShow)
Multiple applications: User selection via display callbacks (INexusDspCallbacks.MenuShow)
Post-conditions:
An application is selected for the transaction
Card is prepared for subsequent performFinalSelection call
Next step: After successful completion, call performFinalSelection to finalize the selection and read application data records.
Thread safety: This method may invoke display callbacks for user interaction. Ensure the calling thread can handle UI operations or delegate appropriately.
Exceptions: This function MUST NOT throw any exception. Any error must be indicated through NexusRet Any unexpected error must be mapped as NexusRet.INTERR
Return
NexusRet indicating the application selection result:
NexusRet.OK: Application selection completed successfully (either automatically or via user selection)
NexusRet.CANCEL: User cancelled the application selection process
NexusRet.TIMEOUT: Selection process timed out waiting for user input
NexusRet.INTERR: Internal error during application discovery or selection
Other values: Specific selection errors as defined by the implementation
Implementation notes:
Method may block waiting for user input during application selection
Display callbacks should be properly configured before calling this method
Failed selection may require transaction restart
If this method is called but the current card type is not CardType.CONTACT, it must return immediately and NOT throw an exception.
Example usage:
val cardType = emvPort.startTransaction()
if (cardType == CardType.CONTACT) {
val result = emvPort.startsContactAppSelection()
if (result == NexusRet.OK) {
// Application selected successfully, proceed to final selection
val finalResult = emvPort.performFinalSelection()
} else {
// Handle application selection failure
println("Application selection failed: $result")
}
}