Package com.wallee.android.till.sdk
Class ApiClient
- java.lang.Object
-
- com.wallee.android.till.sdk.ApiClient
-
public class ApiClient extends Object
The public interface to the service API. The activity that uses this class should callbind(Activity)
in onCreate andunbind(Activity)
in onDestroy.
-
-
Constructor Summary
Constructors Constructor Description ApiClient(ResponseHandler handler)
Instantiate anApiClient
with the givenResponseHandler
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
authorizeTransaction(Transaction transaction)
Authorize a transaction.boolean
bind(Activity activity)
Bind the API server to the givenActivity
.boolean
bind(Context context)
Bind the API server to the givenContext
.void
cancelLastTransactionOperation()
Cancel last authorized transaction operation.void
checkApiServiceCompatibility()
Checks if the current SDK versionVERSION
is compatible with the service API.void
completeTransaction(TransactionCompletion transaction)
Complete a reserved transaction.void
executeConfiguration()
Start a configuration operation.void
executeFinalBalance()
Start a final balance operation.void
executeGeneratePanToken()
Start a generate pantoken operation.void
executeInitialisation()
Start a initialization operation.void
executeSubmission()
Start a submission operation.void
executeTransmission()
Start a transmission operation.void
getConfigData()
Start an operation to get the configuration data When the operation will be finished aResponseHandler.executeGetConfigDataResponse(GetConfigDataResponse)
method will be called.void
getPinPadInformation()
Start an operation to get the pinpadinformation When the operation will be finished aResponseHandler.executeGetConfigInfoResponse(GetPinpadInformationResponse)
method will be called.void
unbind(Activity activity)
Unbind the API server from the givenActivity
.void
unbind(Context context)
Unbind the API server from the givenContext
.void
voidTransaction(TransactionVoid transactionVoid)
Void a reserved transaction.
-
-
-
Field Detail
-
VERSION
public static final String VERSION
-
-
Constructor Detail
-
ApiClient
public ApiClient(ResponseHandler handler)
Instantiate anApiClient
with the givenResponseHandler
.- Parameters:
handler
- the handler for any responses from the API server.
-
-
Method Detail
-
bind
public boolean bind(Activity activity)
Bind the API server to the givenActivity
. This will initialize the API server and enable calling API methods.- Parameters:
activity
- the activity the service will get bound to. I.e. the lifecycle of the API service will be the same as thisActivity
.
-
unbind
public void unbind(Activity activity)
Unbind the API server from the givenActivity
.- Parameters:
activity
- the activity the service will get unbound from. Must be the same activity that was passed intobind(Activity)
.
-
bind
public boolean bind(Context context)
Bind the API server to the givenContext
. This will initialize the API server and enable calling API methods.- Parameters:
context
- the context the service will get bound to. Depending on the type of context provided (Application, Activity, or Service), the API service will have a different lifecycle: Application context: The API service will have the same lifetime as the application and will persist across all activities and services. Activity context: The API service will have the same lifetime as the activity and will be destroyed when the activity is destroyed. Service context: The API service will have the same lifetime as the service and will be destroyed when the service is destroyed.
-
unbind
public void unbind(Context context)
Unbind the API server from the givenContext
.- Parameters:
context
- the context the service will get unbound from. Must be the same context that was passed intobind(Context)
.
-
checkApiServiceCompatibility
public void checkApiServiceCompatibility() throws RemoteException
Checks if the current SDK versionVERSION
is compatible with the service API. When the operation will be finished aResponseHandler.checkApiServiceCompatibilityReply(Boolean, String)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
authorizeTransaction
public void authorizeTransaction(Transaction transaction) throws RemoteException
Authorize a transaction. A dedicated transaction application will take the focus after calling this function. When the operation will be finished aResponseHandler.authorizeTransactionReply(TransactionResponse)
method will be called, and the caller application will receive focus back.Supported transaction types for authorization include: - Purchase - Credit - Reservation - Reservation Adjustment
- Parameters:
transaction
- the transaction that should be authorized.- Throws:
RemoteException
- any errors while communicating with the API server.
-
completeTransaction
public void completeTransaction(TransactionCompletion transaction) throws RemoteException
Complete a reserved transaction. A dedicated transaction application will take the focus after calling this function. When the operation will be finished aResponseHandler.completeTransactionReply(TransactionCompletionResponse)
method will be called, and the caller application will receive focus back.- Parameters:
transaction
- the transaction that should be completed.- Throws:
RemoteException
- any errors while communicating with the API server.
-
voidTransaction
public void voidTransaction(TransactionVoid transactionVoid) throws RemoteException
Void a reserved transaction. A dedicated transaction application will take the focus after calling this function. When the operation will be finished aResponseHandler.voidTransactionReply(TransactionVoidResponse)
method will be called, and the caller application will receive focus back.- Parameters:
transactionVoid
- the void that should be processed.- Throws:
RemoteException
- any errors while communicating with the API server.
-
cancelLastTransactionOperation
public void cancelLastTransactionOperation() throws RemoteException
Cancel last authorized transaction operation. The operation will be processed in background. When the operation will be finished aResponseHandler.cancelLastTransactionOperationReply(CancelationResult)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
executeSubmission
public void executeSubmission() throws RemoteException
Start a submission operation. The operation will be processed in background. When the operation will be finished aResponseHandler.executeSubmissionReply(SubmissionResult)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
executeTransmission
public void executeTransmission() throws RemoteException
Start a transmission operation. The operation will be processed in background. When the operation will be finished aResponseHandler.executeTransmissionReply(TransmissionResult)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
executeFinalBalance
public void executeFinalBalance() throws RemoteException
Start a final balance operation. The operation will be processed in background. When the operation will be finished aResponseHandler.executeFinalBalanceReply(FinalBalanceResult)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
executeGeneratePanToken
public void executeGeneratePanToken() throws RemoteException
Start a generate pantoken operation. This will initiate payment trx for 0 amount in order to read card data and extract pan. When the operation will be finished aResponseHandler.executeGeneratePanTokenResponse(GeneratePanTokenResponse)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
getPinPadInformation
public void getPinPadInformation() throws RemoteException
Start an operation to get the pinpadinformation When the operation will be finished aResponseHandler.executeGetConfigInfoResponse(GetPinpadInformationResponse)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
getConfigData
public void getConfigData() throws RemoteException
Start an operation to get the configuration data When the operation will be finished aResponseHandler.executeGetConfigDataResponse(GetConfigDataResponse)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
executeConfiguration
public void executeConfiguration() throws RemoteException
Start a configuration operation. The operation will be processed in background. When the operation will be finished aResponseHandler.executeConfigurationReply(ConfigurationResult)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
executeInitialisation
public void executeInitialisation() throws RemoteException
Start a initialization operation. The operation will be processed in background. When the operation will be finished aResponseHandler.executeInitialisationReply(InitialisationResult)
method will be called.- Throws:
RemoteException
- any errors while communicating with the API server.
-
-