public class SynchronousTerminalListener extends Object implements TerminalListener
Helper class for handle synchronous method calls in the Terminal
class.
Used internally by the Terminal
instance to provide synchronous
behavior. TimApi users can though use this class as base for their own synchronous
use of the TimApi by using asynchronous function calls only. Provides the
user with the ability to work also with intermediate completed request data in
contrary to the synchronous method calls provided by Terminal
.
The listener collects all response data received for all possible requests. The
user can then examine those at a later time. The most recent request data is
stored. TimEvent
is not stored. Stores the last received TimException
.
To use the listener call it like this:
SynchronousTerminalListener listener = new SynchronousTerminalListener();
listener.prepareWait(RequestType.TRANSACTION);
// run action potentially completing straight away
listener.waitForRequestCompleted();
// work with the result in listener
Warning! Do not use instances of this class as monitor. Instances of this class use themselves as monitor in different ways including notify/wait calls. Trying to use it as monitor can result in unpredictable behavior.
Constructor and Description |
---|
SynchronousTerminalListener() |
public void prepareWait(RequestType requestType)
SynchronousTerminalListener.waitForRequestCompleted()
is called. Used to avoid lost completed response if action called
before SynchronousTerminalListener.waitForRequestCompleted()
manages to complete before
SynchronousTerminalListener.waitForRequestCompleted()
can be called.public void waitForRequestCompleted()
public TimException getLastException()
public ActivateResponse getLastActivateResponse()
public BalanceResponse getLastBalanceResposne()
public PrintData getLastCommitResponse()
public Counters getLastCountersRequestResponse()
public DeactivateResponse getLastDeactivateResponse()
public PrintData getLastDccRatesResponse()
public HardwareInformationResponse getLastHardwareInformationResponse()
public ReconciliationResponse getLastReconciliationResponse()
public ReceiptRequestResponse getLastReceiptRequestResponse()
public PrintData getLastReconfigResponse()
public PrintData getLastRollbackResponse()
public UpdateStatus getLastSoftwareUpdateResponse()
public SystemInformationResponse getLastSystemInformationResponse()
public TransactionResponse getLastTransactionResponse()
public ShowSignatureCaptureResponse getLastShowSignatureCaptureResponse()
public ShowDialogResponse getLastShowDialogResponse()
public List<CommandResponse> getLastSendCardCommandResponse()
public BalanceInquiryResponse getLastBalanceInquiryResponse()
public CardData getLastInitTransactionResponse()
public String getLastRequestAliasResponse()
public void connectCompleted(TimEvent event)
TerminalListener
Terminal.connect()
started request finished.connectCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void activateCompleted(TimEvent event, ActivateResponse data)
TerminalListener
Terminal.activateAsync()
started request finished.activateCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains activation sequence counter and print information for the merchant.public void applicationInformationCompleted(TimEvent event)
TerminalListener
Terminal.applicationInformationAsync()
started request finished.applicationInformationCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void balanceCompleted(TimEvent event, BalanceResponse data)
TerminalListener
Terminal.balanceAsync()
started request finished.balanceCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains counters and print information for the merchant.public void changeSettingsCompleted(TimEvent event)
TerminalListener
Terminal.changeSettingsAsync(java.util.Map)
started request finished.changeSettingsCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void commitCompleted(TimEvent event, PrintData data)
TerminalListener
Terminal.commitAsync()
started request finished.commitCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void counterRequestCompleted(TimEvent event, Counters data)
TerminalListener
Terminal.counterRequestAsync(com.six.timapi.constants.CounterType)
started request finished.counterRequestCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains counters.public void deactivateCompleted(TimEvent event, DeactivateResponse data)
TerminalListener
Terminal.deactivateAsync()
started request finished.deactivateCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains counters and print information for the merchant.public void dccRatesCompleted(TimEvent event, PrintData data)
TerminalListener
Terminal.dccRatesAsync()
started request finished.dccRatesCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains print information for merchant.public void hardwareInformationCompleted(TimEvent event, HardwareInformationResponse data)
TerminalListener
Terminal.hardwareInformationAsync()
started request finished.hardwareInformationCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains information about EFT Terminal hardware and EMV kernels and configuration
parameters supported by the EFT Terminal.public void initTransactionCompleted(TimEvent event, CardData data)
TerminalListener
Terminal.initTransactionAsync(boolean, Amount)
started request finished.initTransactionCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void loginCompleted(TimEvent event)
TerminalListener
Terminal.loginAsync()
started request finished.loginCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void logoutCompleted(TimEvent event)
TerminalListener
Terminal.logoutAsync()
started request finished.logoutCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void rebootCompleted(TimEvent event)
TerminalListener
Terminal.rebootAsync()
started request finished.rebootCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void reconciliationCompleted(TimEvent event, ReconciliationResponse data)
TerminalListener
Terminal.reconciliationAsync()
started request finished.reconciliationCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains counters and print information for the merchant.public void receiptRequestCompleted(TimEvent event, ReceiptRequestResponse data)
TerminalListener
Terminal.receiptRequestAsync(com.six.timapi.constants.ReceiptRequestType)
started request finished.receiptRequestCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains all requested receipts up to a maximum number of receipts the EFT Terminal
can send. if HasMoreReceipts is True not all receipts could be send by the EFT
Terminal. call ReceiptRequest again to obtain more receipts.public void reconfigCompleted(TimEvent event, PrintData data)
TerminalListener
Terminal.reconfigAsync()
started request finished.reconfigCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains print information for the merchant.public void rollbackCompleted(TimEvent event, PrintData data)
TerminalListener
Terminal.rollbackAsync()
started request finished.rollbackCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains print information for the merchant and cardholder.public void softwareUpdateCompleted(TimEvent event, UpdateStatus data)
TerminalListener
Terminal.softwareUpdateAsync()
started request finished.softwareUpdateCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains update status.public void systemInformationCompleted(TimEvent event, SystemInformationResponse data)
TerminalListener
Terminal.systemInformationAsync()
started request finished.systemInformationCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains configuration and network information of the terminal.public void transactionCompleted(TimEvent event, TransactionResponse data)
TerminalListener
Terminal.transactionAsync(com.six.timapi.constants.TransactionType, Amount)
or Terminal.transactionAsync(com.six.timapi.constants.TransactionType, TransactionRequest)
started request finished.transactionCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.data
- Contains transaction result information and print information for the merchant and cardholder.public void terminalStatusChanged(Terminal terminal)
TerminalListener
terminalStatusChanged
in interface TerminalListener
terminal
- Terminal sending the notification.public void disconnected(Terminal terminal, TimException exception)
TerminalListener
disconnected
in interface TerminalListener
terminal
- Terminal sending the notification.public void closeReaderCompleted(TimEvent event)
Terminal.closeReaderAsync()
started request finished.
Supported only if Guides.UNATTENDED
is enabled.closeReaderCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void openReaderCompleted(TimEvent event)
Terminal.openReaderAsync()
started request finished.
Supported only if Guides.UNATTENDED
is enabled.openReaderCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void ejectCardCompleted(TimEvent event)
Terminal.ejectCardAsync()
started request finished.
Supported only if Guides.UNATTENDED
is enabled.ejectCardCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void openMaintenanceWindowCompleted(TimEvent event)
Terminal.openMaintenanceWindowAsync()
started request finished.
Supported only if Guides.UNATTENDED
is enabled.openMaintenanceWindowCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void closeMaintenanceWindowCompleted(TimEvent event)
Terminal.closeMaintenanceWindowAsync()
started request finished.
Supported only if Guides.UNATTENDED
is enabled.closeMaintenanceWindowCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void activateServiceMenuCompleted(TimEvent event)
Terminal.activateServiceMenuAsync()
started request finished.
Supported only if Guides.UNATTENDED
is enabled.activateServiceMenuCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void openDialogModeCompleted(TimEvent event)
Terminal.openDialogModeAsync()
started request finished.
Supported only if Guides.DIALOG
is enabled.openDialogModeCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void closeDialogModeCompleted(TimEvent event)
Terminal.closeDialogModeAsync()
started request finished.
Supported only if Guides.DIALOG
is enabled.closeDialogModeCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void showSignatureCaptureCompleted(TimEvent event, ShowSignatureCaptureResponse data)
Terminal.showSignatureCaptureAsync(com.six.timapi.ShowSignatureCaptureRequest)
started request finished.
Supported only if Guides.DIALOG
is enabled.showSignatureCaptureCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void showDialogCompleted(TimEvent event, ShowDialogResponse data)
Terminal.showDialogAsync(com.six.timapi.ShowDialogRequest)
started request finished.
Supported only if Guides.DIALOG
is enabled.showDialogCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void sendCardCommandCompleted(TimEvent event, List<CommandResponse> data)
Terminal.sendCardCommand(List)
started request finished.
Supported only if Guides.DIALOG
is enabled.sendCardCommandCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void balanceInquiryCompleted(TimEvent event, BalanceInquiryResponse data)
Terminal.balanceInquiryAsync()
started request finished.
Supported only if Guides.ADVANCED_RETAIL
is enabled.balanceInquiryCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.public void requestAliasCompleted(TimEvent event, String data)
Terminal#requestAlias()
started request finished.requestAliasCompleted
in interface TerminalListener
event
- Contains the terminal sending the event and error information if the request failed.