public class CarbonTerminal extends java.lang.Object implements PaymentTerminal
Constructor and Description |
---|
CarbonTerminal()
Constructor.
|
CarbonTerminal(java.lang.String applicationPackage,
java.lang.String serviceClassName)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
abortTransaction()
Aborts a transaction in progress.
|
boolean |
checkForUpdates(UpdateCheckResponseHandler response)
Checks for updates to the payment terminal.
|
protected void |
dailyCodeCallback(se.westpay.posapplib.DailyCode dailyCode)
Daily code callback.
|
boolean |
disableNavigationBar()
Makes the navigation bar disappear.
|
boolean |
doMaintenance(MaintenanceResponseHandler response)
Open the system menu in the payment terminal.
|
boolean |
doTransaction(TransactionRequest transaction,
TransactionResponseHandler response,
CardVerificationHandler cardCheck)
Performs a transaction.
|
boolean |
enableDataRoaming(boolean enable)
Enable/ Disable Data roaming.
|
boolean |
enableNavigationBar(NavigationBarButtons[] navigationBarButtons)
Show the navigation bar with back and/or home buttons.
|
boolean |
getLastTransactionResult(TransactionResponseHandler response)
Gets the result of the last completed transaction.
|
PrinterStatus |
getPrinterStatus() |
int |
getSleepTime()
Gets the sleep time value.
|
int |
getSuspendTime()
Gets the suspend time value.
|
boolean |
getTerminalStatus(TerminalStatusResponseHandler response) |
java.lang.String |
getVersion()
Retrieves the version number.
|
boolean |
initialise(TerminalSettings settings,
InitialisationResponseHandler response,
NotificationHandler notification)
Initialises the payment terminal.
|
protected void |
merchantPasswordCallback(se.westpay.posapplib.MerchantPassword merchantPassword) |
boolean |
openPaymentServiceMenu(MenuFeatures[] disabledMenuFeatures,
MaintenanceResponseHandler response)
Open the system menu in the payment terminal.
|
boolean |
readCustomCard(CustomCardRequest request,
CustomCardResponseHandler response)
Asks the payment application to read a custom card.
|
void |
register(Context context)
Registers the payment terminal, which involves creating resources needed by the terminal API.
|
boolean |
reverseLastTransaction(ReversalResponseHandler response)
Reverses the previous transaction.
|
boolean |
setApn(ApnInfo apnInfo)
Set APN settings.
|
boolean |
setParameter(Parameter parameter,
int value)
Set parameter.
|
boolean |
setScreenBrightness(int brightnessPercent)
Set screen brightness.
|
boolean |
setSleepTime(DisplayUtilities.SleepTime time)
Set the sleep time value.
|
boolean |
setSuspendTime(DisplayUtilities.SuspendTime time)
Set the suspend time value.
|
boolean |
setTransactionAmounts(TransactionAmounts transactionAmounts)
If a zero amount is provided in the transaction request,
this call can be used to update the transaction with an amount.
|
boolean |
shutdown(boolean restart)
Shuts down the payment terminal.
|
PrintJob |
startPrintJob()
Starts a new printer job.
|
void |
unregister()
Unregister the payment terminal, which involves freeing the resources used by the terminal API.
|
boolean |
validateMerchantPassword(java.lang.String password)
Validate the merchant password.
|
public CarbonTerminal()
public CarbonTerminal(java.lang.String applicationPackage, java.lang.String serviceClassName)
public java.lang.String getVersion()
public void register(Context context)
context
- android.content.Context.java.lang.IllegalArgumentException
- if context is null.public void unregister()
public boolean initialise(TerminalSettings settings, InitialisationResponseHandler response, NotificationHandler notification)
PaymentTerminal
initialise
in interface PaymentTerminal
settings
- The settings for the payment terminal.response
- A callback that will be called with the result of the initialisation.notification
- Optional. A callback that will be called for different events.true
if the request was sent successfully, otherwise false
.
Note that this does not indicate the success or failure of the initialisation.
If no InitialisationResponseHandler
is provided the method will return false.public boolean doTransaction(TransactionRequest transaction, TransactionResponseHandler response, CardVerificationHandler cardCheck)
PaymentTerminal
doTransaction
in interface PaymentTerminal
transaction
- The details of the transaction.response
- A callback that will be called with the result of the transaction.cardCheck
- Optional.true
if the request was sent successfully,
otherwise false.
. Note that this does not indicate the
success or failure of the transaction.
If no TransactionResponseHandler
is provided the method will return false.public boolean readCustomCard(CustomCardRequest request, CustomCardResponseHandler response)
PaymentTerminal
readCustomCard
in interface PaymentTerminal
request
- Contains parameters for the request. This is optional; set to null if
no extra parameters are required.response
- A callback that will be called with the result of the card read.true
if the request was sent successfully,
otherwise false.
. Note that this does not indicate the
success or failure of the action.
If no CustomCardResponseHandler
is provided the method will return false.public boolean setTransactionAmounts(TransactionAmounts transactionAmounts)
PaymentTerminal
setTransactionAmounts
in interface PaymentTerminal
true
if the set transaction amount was sent successfully,
otherwise false.
.public boolean doMaintenance(MaintenanceResponseHandler response)
PaymentTerminal
doMaintenance
in interface PaymentTerminal
response
- A callback that will be called when the maintenance is completed.true
if the request was sent successfully,
otherwise false.
. Note that this does not indicate the
success or failure of the maintenance.
If no MaintenanceResponseHandler
is provided the method will return false.public boolean openPaymentServiceMenu(MenuFeatures[] disabledMenuFeatures, MaintenanceResponseHandler response)
PaymentTerminal
openPaymentServiceMenu
in interface PaymentTerminal
disabledMenuFeatures
- An array of MenuFeatures that should not be visible in the payment service menu.response
- A callback that will be called when the maintenance is completed.true
if the request was sent successfully,
otherwise false.
. Note that this does not indicate the
success or failure of the maintenance.
If no MaintenanceResponseHandler
is provided the method will return false.public PrintJob startPrintJob()
PaymentTerminal
startPrintJob
in interface PaymentTerminal
public PrinterStatus getPrinterStatus()
getPrinterStatus
in interface PaymentTerminal
public boolean validateMerchantPassword(java.lang.String password)
PaymentTerminal
validateMerchantPassword
in interface PaymentTerminal
password
- The password in plain text.true
if the validation was successfully,
otherwise false.
.public boolean reverseLastTransaction(ReversalResponseHandler response)
PaymentTerminal
reverseLastTransaction
in interface PaymentTerminal
response
- A callback that will be called when the reversal is completed.true
if the request was sent successfully,
otherwise false.
. Note that this does not indicate the
success or failure of the reversal.
If no ReversalResponseHandler
is provided the method will return false.public boolean getLastTransactionResult(TransactionResponseHandler response)
PaymentTerminal
PaymentTerminal.doTransaction(TransactionRequest, TransactionResponseHandler, CardVerificationHandler)
.
The response can be null if the result of the previous transaction is not available.
This happens if there has not been a previous transaction, or if a new transaction has
been started, but not completed.
Note that this method cannot be called while a transaction is in progress. If it is
called then, it will return false
.
This method requires Westpay Payment Application v2.0.11 or higher.getLastTransactionResult
in interface PaymentTerminal
response
- A callback that will be called with the results of the last completed
transaction. This response contains the same data that is contained
in the transaction response.
If the callback is not given, the method returns false
.true
if the request was sent successfully, otherwise false
.public void abortTransaction()
PaymentTerminal
doTransaction
that the transaction was
cancelled.abortTransaction
in interface PaymentTerminal
public boolean checkForUpdates(UpdateCheckResponseHandler response)
PaymentTerminal
checkForUpdates
in interface PaymentTerminal
response
- Not used, reserved for future use.true
if the Application Updater was started,
otherwise false.
.
If no UpdateCheckResponseHandler
is provided the method will return false.public boolean shutdown(boolean restart)
PaymentTerminal
shutdown
in interface PaymentTerminal
restart
- If set to true, the terminal will restart after shut down.true
if the request was sent successfully,
otherwise false.
. Note that this does not indicate the
success or failure of the shutdown.
If no TerminalStatusResponseHandler
is provided the method will return false.public boolean getTerminalStatus(TerminalStatusResponseHandler response)
getTerminalStatus
in interface PaymentTerminal
public boolean enableNavigationBar(NavigationBarButtons[] navigationBarButtons)
PaymentTerminal
enableNavigationBar
in interface PaymentTerminal
navigationBarButtons
- Buttons to be enabled on the navigation bar.true
if operation was successful,
otherwise false.
.setSystemUiVisibility
NOTE: This method (enableNavigationBar) should not be used together with disableNavigationBar
in the same activity, this will cause a RuntimeException.
public boolean disableNavigationBar()
PaymentTerminal
NOTE: This method (disableNavigationBar) should not be used together with enableNavigationBar in the same activity, this will cause a RuntimeException.
disableNavigationBar
in interface PaymentTerminal
true
if operation was successful,
otherwise false.
.public boolean setParameter(Parameter parameter, int value)
PaymentTerminal
setParameter
in interface PaymentTerminal
parameter
- Parameter type.value
- Parameter value.true
if the timeout was successfully set,
otherwise false.
.public int getSleepTime()
PaymentTerminal
getSleepTime
in interface PaymentTerminal
public boolean setSleepTime(DisplayUtilities.SleepTime time)
PaymentTerminal
setSleepTime
in interface PaymentTerminal
time
- SleepTime
value.true
if operation was successful,
otherwise false.
.public int getSuspendTime()
PaymentTerminal
getSuspendTime
in interface PaymentTerminal
public boolean setSuspendTime(DisplayUtilities.SuspendTime time)
PaymentTerminal
setSuspendTime
in interface PaymentTerminal
time
- SuspendTime
value.true
if operation was successful,
otherwise false.
.public boolean setScreenBrightness(int brightnessPercent)
PaymentTerminal
setScreenBrightness
in interface PaymentTerminal
brightnessPercent
- Value for the brightness, valid values are 0 - 100 percent.public boolean setApn(ApnInfo apnInfo)
PaymentTerminal
setApn
in interface PaymentTerminal
apnInfo
- This object to set APN parameters.
false.
.public boolean enableDataRoaming(boolean enable)
PaymentTerminal
enableDataRoaming
in interface PaymentTerminal
enable
- Enable/Disable flag (if value is true, then enable the data roaming. otherwise disable).
false.
.protected void dailyCodeCallback(se.westpay.posapplib.DailyCode dailyCode)
dailyCode
- protected void merchantPasswordCallback(se.westpay.posapplib.MerchantPassword merchantPassword)