getApplicationData

Retrieves the result data from the EMV kernel for the current card transaction. It must not perform any operations on the card, just return the result data from the kernel.

This function provides a unified interface for obtaining transaction data elements after processing a card, whether the transaction was contact (chip), contactless (CTLS), or magnetic stripe (MSR). The exact content and structure of the returned TypeOutputCardData object depends on the transaction mode and card type:

  • Contact (chip): Returns a TLV-encoded string (sReceivedTLV) containing all EMV tags received from the kernel, including any tags explicitly requested in the TypeInputStartTransaction (sRequiredTLV), if used.

  • Contactless (CTLS): Returns all tags received from the contactless kernel in TLV format in sReceivedTLV. The function may include both default and kernel-specific tags present after the contactless flow.

  • Magstripe (MSR): Populates track data fields (sTrack1, sTrack2, sTrack3) in TypeOutputCardData, each containing the respective card track data without the initial sentinels. sReceivedTLV will be empty for MSR transactions.

Prerequisites:

Usage scenarios:

  • After completing application selection and data reading for contact cards

  • After contactless transaction processing is complete

  • After magnetic stripe card swipe detection

Thread safety: This method accesses kernel data and should be called from the same thread context as the transaction processing methods to ensure data consistency.

Exceptions: This function MUST NOT throw any exception. Any error must be indicated through TypeOutputCardData.iNexusRet Any unexpected error must be mapped as NexusRet.INTERR

Implementation notes:

  • For contact/contactless: All available EMV tags are returned, not just requested ones

  • For magnetic stripe: Only track data is populated, EMV TLV fields remain empty

  • Data is retrieved from kernel memory and reflects the current transaction state

  • Multiple calls may return the same data until a new transaction is started

Return

TypeOutputCardData containing:

  • sReceivedTLV: Concatenated TLV string of all received EMV tags (for contact/contactless transactions). Empty for magnetic stripe transactions.

  • sTrack1, sTrack2, sTrack3: Card track data (populated for MSR only; fields empty for EMV/CTLS). Track data is provided without initial sentinels and contains raw magnetic stripe information.

  • iNexusRet: Result code indicating the success or failure of the data retrieval

Example usage:

    val cardData = emvPort.getApplicationData()

// For EMV transactions (contact/contactless)
if (cardData.sReceivedTLV.isNotEmpty()) {
// Process EMV TLV data
println("Received EMV tags: ${cardData.sReceivedTLV}")
}