Customer account management
Get customer account information
This method gets a customer’s account information.
This method requires customer authentication.
API_PERSONAL_INFORMATION_CLIENT_READ
permission from the Client group.Method name:
Client.getAccount()
Declaration:
public static IDataApiCall<GetAccountInformation> getAccount()
Parameters:
No parameters required.
Return Value:
IDataApiCall<GetAccountInformation> object to execute the request.
Example:
private IDataApiCall<GetAccountInformation> getAccountCall;
private void getAccount(boolean isFacebook) {
if (getAccountCall != null) getAccountCall.cancel();
getAccountCall = Client.getAccount();
getAccountCall.execute(({ this.onGetAccountSuccessful() }), ({ this.onGetAccountFailure() });
}
Get customer’s events
This method retrieves events for an authenticated customer.
This method requires customer authentication.
Method name:
Client.getEvents(clientEventsQuery)
Declaration:
public static IDataApiCall<List<ClientEventData>> getEvents(ClientEventsQuery clientEventsQuery)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
clientEventsQuery | ClientEventsQuery | yes | - | Object to create clientEvent query |
Return Value:
IDataApiCall<List<ClientEventData» object to execute the request.
Example:
private IDataApiCall<List<ClientEventData>> getEventClientsCall;
if (getEventClientsCall != null) getEventClientsCall.cancel();
getEventClientsCall = Client.getEvents(clientEventsQuery);
getEventClientsCall.execute(({ this.onSuccess() }), ({ this.onFailure() });
Update customer account basic information
This method updates a customer’s account’s basic information.
This method requires the context object with the customer’s account information. Omitted fields are not modified.
API_BASIC_INFORMATION_CLIENT_UPDATE
permission from the Client group.Method name:
Client.updateAccountBasicInformation(accountInformation)
Declaration:
public static IApiCall updateAccountBasicInformation(@NonNull UpdateAccountBasicInformation accountInformation)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
accountInformation | UpdateAccountBasicInformation | yes | - | Builder Pattern object with the Customer’s basic account information |
Return Value:
IApiCall object to execute the request.
Example:
if (apiCall != null) apiCall.cancel();
apiCall = Client.updateAccountBasicInformation(accountInformation);
apiCall.execute(this::onSuccess, this::onFailure);
Update customer account information
This method updates a customer’s account information.
This method requires the context object with the customer’s account information. Omitted fields are not modified.
This method requires customer authentication.
API_PERSONAL_INFORMATION_CLIENT_UPDATE
permission from the Client group.Method name:
Client.updateAccount(accountInformation)
Declaration:
public static IApiCall updateAccount(@NonNull UpdateAccountInformation accountInformation)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
accountInformation | UpdateAccountInformation | yes | - | Builder Pattern object with the Customer’s account information |
Return Value:
IApiCall object to execute the request.
Example:
if (apiCall != null) apiCall.cancel();
apiCall = Client.updateAccount(accountInformation);
apiCall.execute(this::onSuccess, this::onFailure);
Change customer’s account password
This method changes a customer’s password.
This method requires customer authentication.
SAUTH_CHANGE_PASSWORD_CLIENT_UPDATE
permission from the Client group.Method name:
Client.changePassword(oldPassword, password)
Declaration:
public static IApiCall changePassword(@NonNull String oldPassword, @NonNull String password)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
oldPassword | String | yes | - | Client’s old password |
password | String | yes | — | Client’s new password |
Return Value:
IApiCall object to execute the request.
Example:
private IApiCall apiCall;
if (apiCall != null) apiCall.cancel();
apiCall = Client.changePassword(oldPassword, password);
apiCall.execute(this::onSuccess, this::onFailure);
Request password reset for customer account
This method requests a customer’s password reset with email. The customer will receive a token to the provided email address. That token is then used for the confirmation of password reset.
This method requires the customer’s email.
This method is a global operation and doesn’t require customer authentication.
SAUTH_PASSWORD_RESET_CLIENT_CREATE
permission from the Client group.Method name:
Client.requestPasswordReset(resetRequest)
Declaration:
public static IApiCall requestPasswordReset(@NonNull PasswordResetRequest resetRequest)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
resetRequest | PasswordResetRequest | yes | - | PasswordResetRequest object with the Client’s email. |
Return Value:
IApiCall object to execute the request.
Example:
if (call != null) call.cancel();
call = Client.requestPasswordReset(new PasswordResetRequest(email));
EspressoTestingIdlingResource.increment();
call.execute(this::onSuccess, this::onFailure);
Confirm password reset for customer account
This method confirm a customer’s password reset with the new password and token provided by password reset request.
This method requires the customer’s new password and the confirmation token received by e-mail.
This method is a global operation and doesn’t require customer authentication.
SAUTH_PASSWORD_RESET_CLIENT_CREATE
permission from the Client group.Method name:
Client.confirmPasswordReset(resetConfirmation)
Declaration:
public static IApiCall confirmPasswordReset(@NonNull PasswordResetConfirmation resetConfirmation)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
resetConfirmation | PasswordResetConfirmation | yes | - | PasswordResetConfirmation object with the Client’s new password and confirmation token. |
Return Value:
IApiCall object to execute the request.
Example:
private IApiCall call;
if (call != null) call.cancel();
call = Client.confirmPasswordReset(confirmation);
call.execute(this::onSuccess, this::onFailure);
Request email change for customer account
This method requests a customer’s email change.
This method is a global operation and doesn’t require customer authentication.
SAUTH_CHANGE_EMAIL_CLIENT_UPDATE
permission from the Client group.Method name:
Client.requestEmailChange(email, password, externalToken, authId)
Declaration:
public static IApiCall requestEmailChange(String email, String password, @Nullable String externalToken, @Nullable String authId)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
String | yes | - | Customer’s email | |
password | String | yes | - | Customer’s password |
externalToken | String | no | - | ExternalToken should be used for Facebook, Oauth. For Synerise account, pass null |
authId | String | no | - | Optional identifier of authorization. For Synerise account, pass null. |
Return Value:
IApiCall object to execute the request.
Example:
IApiCall apiCall;
apiCall = Client.requestEmailChange(email, password, null, null);
apiCall.execute(this::onSuccess, this::onFailure);
Confirm email change for customer account
This method confirms an email change.
This method is a global operation and doesn’t require customer authentication.
SAUTH_CHANGE_EMAIL_CLIENT_UPDATE
permission from the Client group.Method name:
Client.confirmEmailChange(token, newsletterAgreement)
Declaration:
public static IApiCall confirmEmailChange(String token, boolean newsletterAgreement)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
token | String | yes | - | Token from customer’s email |
newsletterAgreement | boolean | yes | - | Newsletter agreement |
Return Value:
IApiCall object to execute the request.
Example:
IApiCall apiCall;
apiCall = Client.confirmEmailChange(token, newsletterAgreement.isChecked());
apiCall.execute(this::onSuccess, this::onFailure);
Request phone update on customer account
Requests a customer’s phone update. A confirmation code is sent to the phone number.
This method is a global operation and doesn’t require customer authentication.
API_PERSONAL_PHONE_CLIENT_CREATE
permission from the Client group.Method name:
Client.requestPhoneUpdate(phone)
Declaration:
public static IApiCall requestPhoneUpdate(String phone)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
phone | String | yes | - | Customer’s phone number. |
Return Value:
IApiCall object to execute the request.
Example:
IApiCall apiCall;
apiCall = Client.requestPhoneUpdate(phone);
apiCall.execute(this::onSuccess, this::onFailure);
Confirm phone update on customer account
This method confirms a phone number update. This action requires the new phone number and confirmation code as parameters.
This method is a global operation and doesn’t require customer authentication.
API_PERSONAL_PHONE_CLIENT_CREATE
permission from the Client group.Method name:
Client.confirmPhoneUpdate(phone, confirmationCode, smsAgreement)
Declaration:
public static IApiCall confirmPhoneUpdate(String phone, String confirmationCode, @Nullable Boolean smsAgreement)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
phone | String | yes | - | Phone number that will be confirmed |
confirmationCode | String | yes | - | Code received in SMS |
smsAgreement | Boolean | no | - | Optional SMS marketing agreement |
Return Value:
IApiCall object to execute the request.
Example:
IApiCall apiCall;
apiCall = Client.confirmPhoneUpdate(phone, code, enableAgreement.isChecked() ? null : smsAgreement.isChecked());
apiCall.execute(this::onSuccess, this::onFailure);
Delete customer account by Identity Provider
This method deletes a customer’s account.
This method requires customer authentication.
SAUTH_CLIENT_DELETE
, SAUTH_OAUTH_CLIENT_DELETE
, SAUTH_FACEBOOK_CLIENT_DELETE
, SAUTH_APPLE_CLIENT_DELETE
permissions from the Client group.Method name:
Client.deleteAccount(clientAuthFactor, clientIdentityProvider, authId)
Declaration:
public static IApiCall deleteAccount(String clientAuthFactor, ClientIdentityProvider clientIdentityProvider, @Nullable String authId)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
clientAuthFactor | String | yes | - | In case of oauth, fb, or google this is token. If you have synerise account this is password. |
clientIdentityProvider | ClientIdentityProvider | yes | - | Provider of your account. Example: FACEBOOK, OAUTH, SYNERISE, GOOGLE |
authId | String | no | - | Customer’s optional unique identifier |
Return Value:
IApiCall object to execute the request.
Example:
IApiCall deleteCall = Client.deleteAccount(password, ClientIdentityProvider.SYNERISE, null);
deleteCall.execute(this::onSuccess, this::onFailure);
Deprecated methods
Delete customer account
This method deletes a customer’s account.
This method requires customer authentication.
SAUTH_CLIENT_DELETE
permission from the Client group.Method name:
Client.deleteAccount(password)
Declaration:
public static IApiCall deleteAccount(String password)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
password | String | yes | - | Customer’s current password. |
Return Value:
IApiCall object to execute the request.
Example:
IApiCall deleteCall = Client.deleteAccount(password);
deleteCall.execute(this::onSuccess, this::onFailure);
Delete customer account by OAuth
This method deletes a customer’s account by OAuth.
This method requires customer authentication.
SAUTH_CLIENT_DELETE
and SAUTH_OAUTH_CLIENT_DELETE
permissions from the Client group.Method name:
Client.deleteAccountByOAuth(accessToken, uuid)
Declaration:
public static IApiCall deleteAccountByOAuth(String accessToken, @Nullable String uuid)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
accessToken | String | yes | - | user’s token |
uuid | String | no | — | Optional Customer UUID, internal UUID is used if this parameter is null |
Return Value:
IApiCall object to execute the request.
Example:
IApiCall deleteCall = Client.deleteAccountByOAuth(accessToken, uuid)
deleteCall.execute(this::onSuccess, this::onFailure);
Delete customer account by Facebook
This method deletes a customer’s account by Facebook.
This method requires customer authentication.
SAUTH_CLIENT_DELETE
and SAUTH_FACEBOOK_CLIENT_DELETE
permissions from the Client group.Method name:
Client.deleteAccountByFacebook(facebookToken, uuid)
Declaration:
public static IApiCall deleteAccountByFacebook(String facebookToken, @Nullable String uuid)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
facebookToken | String | yes | - | Customer’s facebook token |
uuid | String | no | — | Optional Customer UUID, internal UUID is used if this parameter is null |
Return Value:
IApiCall object to execute the request.
Example:
IApiCall deleteCall = Client.deleteAccountByFacebook(facebookToken, uuid)
deleteCall.execute(this::onSuccess, this::onFailure);