public class ClientsService
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CENTRE_ID |
Constructor and Description |
---|
ClientsService(MambuAPIService mambuAPIService)
Create a new client service
|
Modifier and Type | Method and Description |
---|---|
com.mambu.clients.shared.model.ClientExpanded |
createClient(com.mambu.clients.shared.model.ClientExpanded clientDetails)
Create a new client (expanded) using ClientExpanded object and sending it as a JSON api.
|
com.mambu.clients.shared.model.GroupExpanded |
createGroup(com.mambu.clients.shared.model.GroupExpanded groupDetails)
Create a new group using GroupExpanded object and sending it as a JSON api.
|
boolean |
deleteClient(java.lang.String clientId)
Delete Client.
|
boolean |
deleteClientProfilePicture(java.lang.String clientId)
Delete client profile picture file
|
boolean |
deleteClientSignatureFile(java.lang.String clientId)
Delete client signature file
|
com.mambu.clients.shared.model.Client |
getClient(java.lang.String clientId)
Requests a client by their Mambu ID
|
java.util.List<com.mambu.clients.shared.model.Client> |
getClientByFullName(java.lang.String clientLastName,
java.lang.String clientFirstName)
Requests a client by their Last name and first name
|
java.util.List<com.mambu.clients.shared.model.Client> |
getClientByLastNameBirthday(java.lang.String clientLastName,
java.lang.String birthDay)
Requests a client by their Last name and Birth date
|
java.util.List<com.mambu.clients.shared.model.Client> |
getClientByLastNameDocId(java.lang.String clientLastName,
java.lang.String documentId)
Requests a client by their Document ID and Last name
|
com.mambu.clients.shared.model.ClientExpanded |
getClientDetails(java.lang.String clientId)
Returns a client with their full details such as addresses or custom fields
|
java.lang.String |
getClientProfilePicture(java.lang.String clientId)
Get client profile picture API response message containing image type indicator and the base64 encoded picture
file
API response message format: "data:image/jpg;base64,/9j/4AAQSkZJRgABAgAA..."
|
java.lang.String |
getClientProfilePictureFile(java.lang.String clientId)
Convenience method to get get client profile picture file content only (base64 encoded)
|
java.util.List<com.mambu.clients.shared.model.Client> |
getClients(boolean active,
java.lang.Integer offset,
java.lang.Integer limit)
Requests a list of clients, limited by offset/limit
|
java.util.List<com.mambu.clients.shared.model.Client> |
getClients(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints,
java.lang.String offset,
java.lang.String limit)
Get clients by specifying filter constraints
|
java.util.List<com.mambu.clients.shared.model.Client> |
getClientsByBranchCentreOfficerState(java.lang.String branchId,
java.lang.String centreId,
java.lang.String creditOfficerUserName,
java.lang.String clientState,
java.lang.String offset,
java.lang.String limit)
Get Clients by branch id, centre id, credit officer, clientState
|
java.util.List<com.mambu.clients.shared.model.Client> |
getClientsByBranchOfficerState(java.lang.String branchId,
java.lang.String creditOfficerUserName,
java.lang.String clientState,
java.lang.String offset,
java.lang.String limit)
Get Clients by branch id, credit officer, clientState
|
java.lang.String |
getClientSignature(java.lang.String clientId)
Get client signature API response message containing image type indicator and the base64 encoded signature file
API response message format: "data:image/PNG;base64,iVBORw0KGgoAAAANSUhE..."
|
java.lang.String |
getClientSignatureFile(java.lang.String clientId)
Convenience method to get get client signature file content only (base64 encoded)
|
java.util.List<com.mambu.core.shared.model.ClientRole> |
getClientTypes()
Get client types for both clients and groups
|
java.util.List<com.mambu.core.shared.model.ClientRole> |
getClientTypes(com.mambu.accounts.shared.model.AccountHolderType clientType)
Get client types for clients or for groups
|
com.mambu.clients.shared.model.Group |
getGroup(java.lang.String groupId)
Requests a group by it's Mambu ID
|
com.mambu.clients.shared.model.GroupExpanded |
getGroupDetails(java.lang.String groupId)
Requests the details about a group
|
com.mambu.clients.shared.model.GroupRoleName |
getGroupRoleName(java.lang.String groupRoleNameId)
Requests details for the group role name by id
|
java.util.List<com.mambu.clients.shared.model.GroupRoleName> |
getGroupRoleNames()
Requests a list of group role names
This API doesn't accept pagination parameters (offset and limit ) and returns all group role names
|
java.util.List<com.mambu.clients.shared.model.Group> |
getGroups(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints,
java.lang.String offset,
java.lang.String limit)
Get groups by specifying filter constraints
|
java.util.List<com.mambu.clients.shared.model.Group> |
getGroupsByBranchCentreOfficer(java.lang.String branchId,
java.lang.String centreId,
java.lang.String creditOfficerUserName,
java.lang.String offset,
java.lang.String limit)
Get Groups by branch id, credit officer
|
java.util.List<com.mambu.clients.shared.model.Group> |
getGroupsByBranchOfficer(java.lang.String branchId,
java.lang.String creditOfficerUserName,
java.lang.String offset,
java.lang.String limit)
Get Groups by branch id, credit officer
|
boolean |
patchClient(com.mambu.clients.shared.model.Client client)
Patch client fields
|
boolean |
patchClient(com.mambu.clients.shared.model.Client client,
java.lang.String clientId)
Patch client fields
|
boolean |
patchClientState(java.lang.String clientId,
com.mambu.clients.shared.model.ClientState clientState)
Convenience method to Patch client state
|
boolean |
patchGroup(com.mambu.clients.shared.model.Group group)
Patch Group fields.
|
boolean |
patchGroup(com.mambu.clients.shared.model.GroupExpanded groupExpanded)
Patches Group fields through GroupExpanded.
|
com.mambu.clients.shared.model.ClientExpanded |
updateClient(com.mambu.clients.shared.model.ClientExpanded clientDetails)
Update an existent client (expanded) using ClientExpanded object and send it as a JSON api.
|
com.mambu.clients.shared.model.GroupExpanded |
updateGroup(com.mambu.clients.shared.model.GroupExpanded groupDetails)
Update an existent group using GroupExpanded object and send it as a JSON api.
|
boolean |
uploadClientProfilePicture(java.lang.String clientId,
com.mambu.api.server.handler.documents.model.JSONDocument pictureDocument)
Upload client profile picture file
|
boolean |
uploadClientSignatureFile(java.lang.String clientId,
com.mambu.api.server.handler.documents.model.JSONDocument signatureDocument)
Upload client signature file
|
public static final java.lang.String CENTRE_ID
@Inject public ClientsService(MambuAPIService mambuAPIService)
mambuAPIService
- the service responsible with the connection to the serverpublic com.mambu.clients.shared.model.Client getClient(java.lang.String clientId) throws MambuApiException
clientId
- MambuApiException
public java.util.List<com.mambu.clients.shared.model.Client> getClientByFullName(java.lang.String clientLastName, java.lang.String clientFirstName) throws MambuApiException
clientLastName
- clientFirstName
- MambuApiException
public java.util.List<com.mambu.clients.shared.model.Client> getClientByLastNameBirthday(java.lang.String clientLastName, java.lang.String birthDay) throws MambuApiException
clientLastName
- birthDay
- ("yyyy-MM-dd")MambuApiException
public java.util.List<com.mambu.clients.shared.model.Client> getClients(boolean active, java.lang.Integer offset, java.lang.Integer limit) throws MambuApiException
active
- True if active Clients should retrieved, false for inactive Clientsoffset
- Offset to start loading Clients, has to be >= 0 if not null. If null, Mambu default will be usedlimit
- Limit of Clients to load, has to be > 0 if not null. If null, Mambu default will be usedMambuApiException
public java.util.List<com.mambu.clients.shared.model.Client> getClientByLastNameDocId(java.lang.String clientLastName, java.lang.String documentId) throws MambuApiException
clientLastName
- documentId
- MambuApiException
public com.mambu.clients.shared.model.ClientExpanded getClientDetails(java.lang.String clientId) throws MambuApiException
clientId
- the id of the clientMambuApiException
public com.mambu.clients.shared.model.Group getGroup(java.lang.String groupId) throws MambuApiException
groupId
- the id of the groupMambuApiException
public com.mambu.clients.shared.model.GroupExpanded getGroupDetails(java.lang.String groupId) throws MambuApiException
groupId
- the id of the groupMambuApiException
public com.mambu.clients.shared.model.ClientExpanded createClient(com.mambu.clients.shared.model.ClientExpanded clientDetails) throws MambuApiException
clientDetails
- The encodedKey for the clientExpanded object must be null to create a new clientMambuApiException
java.lang.IllegalArgumentException
public com.mambu.clients.shared.model.ClientExpanded updateClient(com.mambu.clients.shared.model.ClientExpanded clientDetails) throws MambuApiException
clientDetails
- client details to be updated. See MBU-3603 for full details. The encodedKey for the clientExpanded
object must be NOT null to update an existent client. Client ID and Client Assignment are not
modifiableMambuApiException
java.lang.IllegalArgumentException
public boolean patchClientState(java.lang.String clientId, com.mambu.clients.shared.model.ClientState clientState) throws MambuApiException
clientId
- the id or the encoded key of a client. Must not be nullclientState
- new client state. Must not be null. Allowed states: BLACKLISTED, REJECTED, EXITED, INACTIVE
(approved), PENDING_APPROVAL (undo approval).
See MBU-11443 for more detailsMambuApiException
public boolean patchClient(com.mambu.clients.shared.model.Client client) throws MambuApiException
client
- client. Must not be null and client's encoded key or its id must not be null.
As of Mambu 4.1 the following fields can be patched: id, clientRoleId, firstName, lastName,
middleName, homePhone, mobilePhone1, birthDate, emailAddress, gender, state, notes, preferredLanguage
As of Mambu 4.5 the following fields can be patched: assignedBranchKey, assignedCentreKey, assignedUserId (credit officer)MambuApiException
public boolean patchClient(com.mambu.clients.shared.model.Client client, java.lang.String clientId) throws MambuApiException
client
- client. Must not be nullclientId
- client id or encoded key. Must not be nullMambuApiException
public boolean deleteClient(java.lang.String clientId) throws MambuApiException
clientId
- client id or encoded key. Must not be nullMambuApiException
public com.mambu.clients.shared.model.GroupExpanded createGroup(com.mambu.clients.shared.model.GroupExpanded groupDetails) throws MambuApiException
groupDetails
- The encodedKey for the groupDetails must be null to create a new groupMambuApiException
java.lang.IllegalArgumentException
public com.mambu.clients.shared.model.GroupExpanded updateGroup(com.mambu.clients.shared.model.GroupExpanded groupDetails) throws MambuApiException
groupDetails
- group details to be updated. The encodedKey for the groupDetails object must be NOT null to update an
existent group.MambuApiException
java.lang.IllegalArgumentException
public java.util.List<com.mambu.clients.shared.model.Client> getClientsByBranchCentreOfficerState(java.lang.String branchId, java.lang.String centreId, java.lang.String creditOfficerUserName, java.lang.String clientState, java.lang.String offset, java.lang.String limit) throws MambuApiException
branchId
- the ID of the Client's branchcentreId
- The ID of the centre to which the loan accounts are assigned to. If both branchId and centreId are
provided then this centre must be assigned to the branchIdcreditOfficerUserName
- the username of the credit officer to whom the CLients are assigned toclientState
- the desired state of a Client to filter on (eg: ACTIVE)offset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.clients.shared.model.Client> getClientsByBranchOfficerState(java.lang.String branchId, java.lang.String creditOfficerUserName, java.lang.String clientState, java.lang.String offset, java.lang.String limit) throws MambuApiException
branchId
- the ID of the Client's branchcreditOfficerUserName
- the username of the credit officer to whom the CLients are assigned toclientState
- the desired state of a Client to filter on (eg: ACTIVE)offset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.clients.shared.model.Client> getClients(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints, java.lang.String offset, java.lang.String limit) throws MambuApiException
filterConstraints
- filter constraints. Must not be nulloffset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.clients.shared.model.Group> getGroups(com.mambu.api.server.handler.core.dynamicsearch.model.JSONFilterConstraints filterConstraints, java.lang.String offset, java.lang.String limit) throws MambuApiException
filterConstraints
- filter constraints. Must not be nulloffset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.clients.shared.model.GroupRoleName> getGroupRoleNames() throws MambuApiException
MambuApiException
public com.mambu.clients.shared.model.GroupRoleName getGroupRoleName(java.lang.String groupRoleNameId) throws MambuApiException
groupRoleNameId
- group role name id or encoded key. Must be not nullMambuApiException
public java.util.List<com.mambu.clients.shared.model.Group> getGroupsByBranchCentreOfficer(java.lang.String branchId, java.lang.String centreId, java.lang.String creditOfficerUserName, java.lang.String offset, java.lang.String limit) throws MambuApiException
branchId
- the ID of the Group's branchcentreId
- The ID of the centre to which the loan accounts are assigned to. If both branchId and centreId are
provided then this centre must be assigned to the branchIdcreditOfficerUserName
- the username of the credit officer to whom the Groups are assigned tooffset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.clients.shared.model.Group> getGroupsByBranchOfficer(java.lang.String branchId, java.lang.String creditOfficerUserName, java.lang.String offset, java.lang.String limit) throws MambuApiException
branchId
- the ID of the Group's branchcreditOfficerUserName
- the username of the credit officer to whom the Groups are assigned tooffset
- pagination offset. If not null it must be an integer greater or equal to zerolimit
- pagination limit. If not null it must be an integer greater than zeroMambuApiException
public java.util.List<com.mambu.core.shared.model.ClientRole> getClientTypes(com.mambu.accounts.shared.model.AccountHolderType clientType) throws MambuApiException
clientType
- the account holder type (CLIENT or GROUP). Must be not nullMambuApiException
public java.util.List<com.mambu.core.shared.model.ClientRole> getClientTypes() throws MambuApiException
MambuApiException
public java.lang.String getClientProfilePicture(java.lang.String clientId) throws MambuApiException
clientId
- the encoded key or id of the Mambu ClientMambuApiException
public java.lang.String getClientProfilePictureFile(java.lang.String clientId) throws MambuApiException
clientId
- the encoded key or id of the Mambu ClientMambuApiException
public java.lang.String getClientSignature(java.lang.String clientId) throws MambuApiException
clientId
- the encoded key or id of the Mambu ClientMambuApiException
public java.lang.String getClientSignatureFile(java.lang.String clientId) throws MambuApiException
clientId
- the encoded key or id of the Mambu ClientMambuApiException
public boolean uploadClientProfilePicture(java.lang.String clientId, com.mambu.api.server.handler.documents.model.JSONDocument pictureDocument) throws MambuApiException
pictureDocument
- JSON document whose content is base64 encoded profile picture fileMambuApiException
public boolean uploadClientSignatureFile(java.lang.String clientId, com.mambu.api.server.handler.documents.model.JSONDocument signatureDocument) throws MambuApiException
signatureDocument
- JSON document whose content is base64 encoded signature fileMambuApiException
public boolean deleteClientProfilePicture(java.lang.String clientId) throws MambuApiException
clientId
- the encoded key or id of the Mambu ClientMambuApiException
public boolean deleteClientSignatureFile(java.lang.String clientId) throws MambuApiException
clientId
- the encoded key or id of the Mambu ClientMambuApiException
public boolean patchGroup(com.mambu.clients.shared.model.Group group) throws MambuApiException
group
- the Group to be patched. The Group and its encoded key or id must not be Null.MambuApiException
public boolean patchGroup(com.mambu.clients.shared.model.GroupExpanded groupExpanded) throws MambuApiException
groupExpanded
- the GroupExpanded to be patched. The GroupExpanded and its encoded key or id must not be null.MambuApiException