Package com.clover.sdk.v1.merchant
Class MerchantConnector
- java.lang.Object
-
- com.clover.sdk.v1.ServiceConnector<IMerchantService>
-
- com.clover.sdk.v1.merchant.MerchantConnector
-
- All Implemented Interfaces:
ServiceConnection
public class MerchantConnector extends ServiceConnector<IMerchantService>
A class that encapsulates interaction withIMerchantService
. This class automatically binds and provides both synchronous and asynchronous service method invocation.Clients of this class may optionally call
ServiceConnector.connect()
to force pre-binding to the underlying service, and must calldisconnect()
when finished interacting with the underlying service.For all service methods, this class provides both synchronous and asynchronous call options. The synchronous methods must not be called on the UI thread.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MerchantConnector.MerchantCallback<T>
An implementation of theServiceConnector.Callback
interface for receiving asynchronous results fromMerchantConnector
methods that provides default method implementations.static interface
MerchantConnector.OnMerchantChangedListener
A listener that is invoked when the merchant changes.-
Nested classes/interfaces inherited from class com.clover.sdk.v1.ServiceConnector
ServiceConnector.Callback<T>, ServiceConnector.OnServiceConnectedListener, ServiceConnector.ServiceCallable<S,T>, ServiceConnector.ServiceRunnable<S>
-
-
Field Summary
-
Fields inherited from class com.clover.sdk.v1.ServiceConnector
mAccount, mClient, mConnected, mContext, mHandler, mService
-
-
Constructor Summary
Constructors Constructor Description MerchantConnector(Context context, Account account, ServiceConnector.OnServiceConnectedListener client)
Construct a new merchant connector.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disconnect()
Merchant
getMerchant()
void
getMerchant(ServiceConnector.Callback<Merchant> callback)
protected String
getServiceIntentAction()
protected String
getServiceIntentPackage()
The package which hosts the service to connect to.protected int
getServiceIntentVersion()
Connectors that are versioned include a version number in the action returned byServiceConnector.getServiceIntentAction()
instead of using this mechanism.protected IMerchantService
getServiceInterface(IBinder iBinder)
protected void
notifyServiceConnected(ServiceConnector.OnServiceConnectedListener client)
void
setAddress(MerchantAddress address)
void
setAddress(MerchantAddress address, ServiceConnector.Callback<Void> callback)
void
setOnMerchantChangedListener(MerchantConnector.OnMerchantChangedListener listener)
Set the listener that will be called when merchant properties change.void
setPhoneNumber(String phoneNumber)
void
setPhoneNumber(String phoneNumber, ServiceConnector.Callback<Void> callback)
void
setTrackStock(boolean trackStock)
void
setTrackStock(boolean trackStock, ServiceConnector.Callback<Void> callback)
void
setUpdateStock(boolean updateStock)
void
setUpdateStock(boolean updateStock, ServiceConnector.Callback<Void> callback)
-
Methods inherited from class com.clover.sdk.v1.ServiceConnector
connect, execute, execute, execute, execute, getService, getStartIntent, isConnected, isInstalled, notifyServiceDisconnected, onServiceConnected, onServiceDisconnected, postResults, throwOnFailure, waitForConnection
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface android.content.ServiceConnection
onBindingDied, onNullBinding
-
-
-
-
Constructor Detail
-
MerchantConnector
public MerchantConnector(Context context, Account account, ServiceConnector.OnServiceConnectedListener client)
Construct a new merchant connector.- Parameters:
context
- The Context in which this connector will bind to the underlying service.account
- The Clover account which is used when binding to the underlying service.client
- A listener, or null to receive no notifications.
-
-
Method Detail
-
setOnMerchantChangedListener
public void setOnMerchantChangedListener(MerchantConnector.OnMerchantChangedListener listener)
Set the listener that will be called when merchant properties change.
-
getServiceIntentAction
protected String getServiceIntentAction()
- Specified by:
getServiceIntentAction
in classServiceConnector<IMerchantService>
-
getServiceIntentPackage
protected String getServiceIntentPackage()
Description copied from class:ServiceConnector
The package which hosts the service to connect to. Returning null is OK for api target < 21. Once you try to build with 21 or higher returning null will cause an illegal argument exception- Overrides:
getServiceIntentPackage
in classServiceConnector<IMerchantService>
-
getServiceIntentVersion
protected int getServiceIntentVersion()
Description copied from class:ServiceConnector
Connectors that are versioned include a version number in the action returned byServiceConnector.getServiceIntentAction()
instead of using this mechanism.- Overrides:
getServiceIntentVersion
in classServiceConnector<IMerchantService>
-
getServiceInterface
protected IMerchantService getServiceInterface(IBinder iBinder)
- Specified by:
getServiceInterface
in classServiceConnector<IMerchantService>
-
notifyServiceConnected
protected void notifyServiceConnected(ServiceConnector.OnServiceConnectedListener client)
- Overrides:
notifyServiceConnected
in classServiceConnector<IMerchantService>
-
disconnect
public void disconnect()
- Overrides:
disconnect
in classServiceConnector<IMerchantService>
-
getMerchant
public void getMerchant(ServiceConnector.Callback<Merchant> callback)
-
getMerchant
public Merchant getMerchant() throws RemoteException, ClientException, ServiceException, BindingException
-
setAddress
public void setAddress(MerchantAddress address, ServiceConnector.Callback<Void> callback)
-
setAddress
public void setAddress(MerchantAddress address) throws RemoteException, ClientException, ServiceException, BindingException
-
setPhoneNumber
public void setPhoneNumber(String phoneNumber, ServiceConnector.Callback<Void> callback)
-
setPhoneNumber
public void setPhoneNumber(String phoneNumber) throws RemoteException, ClientException, ServiceException, BindingException
-
setUpdateStock
public void setUpdateStock(boolean updateStock, ServiceConnector.Callback<Void> callback)
-
setUpdateStock
public void setUpdateStock(boolean updateStock) throws RemoteException, ClientException, ServiceException, BindingException
-
setTrackStock
public void setTrackStock(boolean trackStock, ServiceConnector.Callback<Void> callback)
-
setTrackStock
public void setTrackStock(boolean trackStock) throws RemoteException, ClientException, ServiceException, BindingException
-
-