Terminal methods overview
The basic operation modes of terminal method calls are:
-
Synchronous
Method calls are blocking and return after the operation is finished successfully or throw a TimException otherwise. Please not that it is highly discouraged to use synchronous method calls on mobile platforms like iOS because the main thread will be blocked by a synchronous call which may not be tolerated by the platform, as they are quite strict regarding blocking calls. This may result in a crash of the mobile App. -
Asynchronous
Method returns immediately after the operation has started or throws a TimException otherwise. A listener-event-method will be called after the operation is finished successfully. All listener-event-methods contain a TimEvent. In case of failure a TimException is included. User-implemented listener-handlers can be added to the Terminal-instance with addListener.
If asynchronous functions are used there are two ways to handle the callbacks:
* Either the protocol [TerminalListener](https://six-tim.github.io/timapi/doc/swift/doc/Protocols/TerminalListener.html#) can be used directly. Which means that all defined protocol function must be implemented.
* Or the prepared default protocol implementation [DefaultTerminalListener](https://six-tim.github.io/timapi/doc/swift/doc/Classes/DefaultTerminalListener.html#) can be used and only the necessary protocol function must be overwritten.
Code example for adding a terminal listener:
//
// Handle asynchronous terminal events.
//
class TerminalHandler: DefaultTerminalListener {
//
// The status of the terminal changed. This includes processing status and display content
//
override func terminalStatusChanged(terminal: Terminal) {
// Events usually originate from a different thread than the main thread.
// Always use DispatchQueue.main.async to be safe
DispatchQueue.main.async {
// handle terminal status change
}
}
//
// A call to Terminal.transactionAsync finished.
//
override func transactionCompleted(event: TimEvent, data: TransactionResponse?) {
// Events usually originate from a different thread than the main thread.
// Always use DispatchQueue.main.async to be safe
DispatchQueue.main.async {
// handle transaction finished using data
}
}
}
class ExampleECR {
func createTerminal(settings: terminalSettings) {
// create terminal from terminal settings
guard let terminal = Terminal(settings: terminalSettings) else {
// throw error, since creating terminal from settings failed
return
}
// add listener (can be done at sany time, not just during init)
terminal.addListener(listener: TerminalHandler())
}
}
Main / guide Retail terminal functions
Sync method
Async method
| Completed event | Description |
|---|---|
| activate | |
| activateAsync | |
| activateCompleted | Open a user shift. |
| applicationInformation | |
| applicationInformationAsync | |
| applicationInformationCompleted | Request the list of brands available on the terminal. |
| balance | |
| balanceAsync | |
| balanceCompleted | Force the EFT Terminal to transmit all transactions to the |
| host system as well to do the daily closing. | |
| cancel | Aborts an open asynchronous Financial Transaction or Non-Financial Transaction request, except for a commit or rollback request, which cannot be cancelled. |
| changeSettings | |
| changeSettingsAsync | |
| changeSettingsCompleted | Change configuration parameters of the EFT Terminal. |
| commit | |
| commitAsync | |
| commitCompleted | Perform Commit-operation after a successful Transaction call. |
| connect | |
| connectAsync | |
| connectCompleted | Initiates a connection to the EFT Terminal. |
| counterRequest | |
| counterRequestAsync | |
| counterRequestCompleted | Get counter informations from the EFT Terminal. |
| dccRates | |
| dccRatesAsync | |
| dccRatesCompleted | Request DCC rates from the EFT Terminal. |
| deactivate | |
| deactivateAsync | |
| deactivateCompleted | Close a user shift. |
| disconnect | |
| disconnectAsync | |
| disconnected | Interrupts the connection to the EFT Terminal. |
| hardwareInformation | |
| hardwareInformationAsync | |
| hardwareInformationCompleted | Get hardware information from the EFT Terminal. |
| login | |
| loginAsync | |
| loginCompleted | Activate a communication session between the ECR and |
| the terminal. | |
| logout | |
| logoutAsync | |
| logoutCompleted | Terminate an active communication session between the ECR |
| and the terminal. | |
| reboot | |
| rebootAsync | |
| rebootCompleted | Force the EFT Terminal to reboot. |
| receiptRequest | |
| receiptRequestAsync | |
| receiptRequestCompleted | Receive the latest receipt or a list of silent receipts. |
| reconciliation | |
| reconciliationAsync | |
| reconciliationCompleted | Force the EFT Terminal to transmit all financial transactions |
| to the host system. | |
| reconfig | |
| reconfigAsync | |
| reconfigCompleted | Force the EFT Terminal to get the configuration from the service center. |
| rollback | |
| rollbackAsync | |
| rollbackCompleted | Prevent a transaction from being committed to the transaction |
| log and generates a technical reversal of the authorization. | |
| softwareUpdate | |
| softwareUpdateAsync | |
| softwareUpdateCompleted | Force the EFT Terminal to start a Software Update. |
| systemInformation | |
| systemInformationAsync | |
| systemInformationCompleted | Request system information from the EFT Terminal. |
| transaction | |
| transactionAsync | |
| transactionCompleted | Starts an EFT Terminal Transaction. |
Guide Petrol terminal functions
Sync method
Async method
| Completed event | Description |
|---|---|
| initTransaction | |
| initTransactionAsync | |
| initTransactionCompleted | Retrieve card data for the presented card. |
Guide Unattended terminal functions
Sync method
Async method
| Completed event | Description |
|---|---|
| openReader | |
| openReaderAsync | |
| openReaderCompleted | Opens the shutter of the card reader. |
| amtAdjustment | Send an amount adjustment notification to the terminal during an open transaction. The amount is used as the new amount for the transaction. |
| closeMaintenanceWindow | |
| closeMaintenanceWindowAsync | |
| closeMaintenanceWindowCompleted | Prohibits the EFT terminal from performing any triggered maintenance tasks. |
| closeReader | |
| closeReaderAsync | |
| closeReaderCompleted | Closes the shutter of the card reader. |
| commit | |
| commitAsync | |
| commitCompleted | Commits a transaction after succesful authorization. A lower amount may be commited than the authorized amount. |
| ejectCard | |
| ejectCardAsync | |
| ejectCardCompleted | Ejects the card from the card reader. |
| holdCommit | Increases the commit timeout. |
| openMaintenanceWindow | |
| openMaintenanceWindowAsync | |
| openMaintenanceWindowCompleted | Opens a maintenance window where the terminal can perform all maintenance processes it was not able to perform before.> |
Banking terminal functions
Sync method
Async method
| Completed event | Description |
|---|---|
| balanceInquiry | |
| balanceInquiryAsync | |
| balanceInquiryCompleted | Perform a balance check of a card/account on the terminal. |
Guide Dialog terminal functions
Sync method
Async method
| Completed event | Description |
|---|---|
| openDialogMode | |
| openDialogModeAsync | |
| openDialogModeCompleted | Open dialog mode on the terminal. |
| closeDialogMode | |
| closeDialogModeAsync | |
| closeDialogModeCompleted | Close dialog mode on the terminal. |
| showDialog | |
| showDialogAsync | |
| showDialogCompleted | Show dialog on the terminal. |
| showSignatureCapture | |
| showSignatureCaptureAsync | |
| showSignatureCaptureCompleted | Show signature capture on the terminal. |
Additional terminal listener-events
| Listener-event | Description |
|---|---|
| requestCompleted | Operation started by an asynchronous function has finished. |
| Applications can use both operation specific completion callback | |
| in combination with this generic completion callback. | |
| terminalStatusChanged | The terminal status has changed. The new status can be |
| retrieved from the TerminalStatus property. |