public interface TransactionDisplayListener
TransactionDisplayListener
interface should be implemented by the client-application
and registered to the Transaction
singleton class if the client-application wants to receive:
TransactionDisplayListener
interface to the Transaction
singleton class via the method
Transaction.registerTransactionDisplayListener(com.yello.api.payment.emv.TransactionDisplayListener)
.
TransactionDisplayListener
are called during a transaction
by a dedicated background thread within the Yello transaction library.
TransactionDisplayListener
implementation cannot be registered or
unregistered while an EMV transaction is in progress. Any attempt to do so via the method
Transaction.registerTransactionDisplayListener(com.yello.api.payment.emv.TransactionDisplayListener)
or
the method Transaction.unregisterCurrentTransactionDisplayListener()
respectively
will generate an IllegalAccessException
.
TransactionDisplayListener
interface
to the Transaction
singleton classpublic class MySimpleDisplayListener implements TransactionDisplayListener { public void displayText(String text) { System.out.println("MySimpleDisplayListener: display " + text); } public void alertText(String text) { System.out.println("MySimpleDisplayListener: alert " + text); } public void displayMenu(TransactionDisplayMenuEvent displayMenuEvent) { System.out.println("MySimpleDisplayListener:title " + displayMenuEvent.getTitle()); for (String s: displayMenuEvent.getChoices()) { System.out.println("Choice: " + s); } // Our simple listener always select the first choice. try { displayMenuEvent.sendSelection(0); } catch (IOException e) { System.out.println("displayMenu: error sending selection " + e); } } } ... MySimpleDisplayListener displayListener = new MySimpleDisplayListener(); Transaction trans = Transaction.getInstance(); trans.registerTransactionDisplayListener(displayListener);
TransactionDisplayListener
from the
Transaction
singleton classTransaction trans = Transaction.getInstance(); trans.unregisterCurrentTransactionDisplayListener();For more information about starting an EMV transaction see the
Transaction
singleton class.Modifier and Type | Method and Description |
---|---|
void |
alertText(java.lang.String text)
Called by the Yello transaction library upon error to inform user about the type of
error that has occured.
|
void |
displayMenu(TransactionDisplayMenuEvent displayMenuEvent)
Called by the Yello transaction library when a selection menu needs to be displayed
|
void |
displayText(java.lang.String text)
Called by the Yello transaction library when a text needs to be displayed
|
void |
enableCancel(boolean enable)
Called by the Yello transaction library to indicate to UI layer
when it can show cancel button to cancel transaction or not
|
void displayText(java.lang.String text)
text
- String representing the text to be displayedvoid displayMenu(TransactionDisplayMenuEvent displayMenuEvent)
displayMenuEvent
- TransactionDisplayMenuEvent
used for handling the menuvoid alertText(java.lang.String text)
text
- String describing the error that has occured.void enableCancel(boolean enable)
enable
- indicate whether to enable or disable cancel buttonCopyright © 2019 Yello. All rights reserved.