Customer account
Get customer account information
Use this method to get a customer’s account information.
This method returns a IDataApiCall with a parameterized GetAccountInformation
object needed to execute the request.
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() });
}
Update customer account information
Use this method to update a customer’s account information.
This method requires the UpdateAccountInformation
Builder Pattern object with the customer’s account information. Only the provided fields are modified. The method returns an IApiCall object needed to execute the request.
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 account password
Use this method to change a customer’s password.
This method returns HTTP 403 if the provided old password is invalid. The method returns an IApiCall needed to execute the request.
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 a customer’s account
Request a customer’s password reset with email.
The customer will receive a token to the provided email address in order to use Client.confirmResetPassword(password, token)
.
This method requires the customer’s email. The method returns an IApiCall object needed to execute the request. This method is a global operation and does not require authorization.
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 a customer’s account
Confirm a customer’s password reset with the new password and a token provided by Client.requestPasswordReset(email)
.
This method requires a customer’s password and the confirmation token sent to the email address. The method returns an IApiCall object needed to execute the request. This method is a global operation and does not require authorization.
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 a customer’s account
Use this method to request an email change.
Returns HTTP 403 if the provided UUID does not exist or the password is invalid. The method returns an IApiCall needed to execute the request.
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 | - | customId for Oauth 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 a customer’s account
Use this method to confirm an email change.
Returns HTTP 403 if the provided token is invalid. The method returns an IApiCall needed to execute the request.
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 a customer’s account
Use this method to request a phone number update. This action requires additional validation via PIN code. The method returns an IApiCall needed to execute the request.
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 a customer’s account
Use this method to confirm a phone number update. This action requires the phone number and confirmation code as parameters. The method returns an IApiCall needed to execute the request.
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);
Request account activation by pin
Use this method to request a new pinCode to confirm account registration.
Method name: Client.requestAccountActivationByPin(email)
Declaration
public static IApiCall requestAccountActivationByPin(String email)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
String | yes | - | Email to which the pinCode will be sent |
Return Value
IApiCall object to execute the request.
Example
IApiCall apiCall;
apiCall = Client.requestAccountActivationByPin(email);
apiCall.execute(this::onSuccess, this::onFailure);
Confirm account activation by pin
Use this method to confirm account registration process with the pinCode.
Method name: Client.confirmAccountActivationByPin(pinCode, email)
Declaration
public static IApiCall confirmAccountActivationByPin(String pinCode, String email)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
pinCode | String | yes | - | Code sent to the customer’s email |
String | yes | - | Email used in the registration process |
Return Value
IApiCall object to execute the request.
Example
IApiCall apiCall;
apiCall = Client.confirmAccountActivationByPin(pinCode, email);
apiCall.execute(this::onSuccess, this::onFailure);
Register for Push Notifications
Use this method to pass the Firebase token to Synerise for notifications.
Method name: Client.registerForPush(firebaseId)
Declaration
public static IApiCall registerForPush(@NonNull String firebaseId, boolean mobilePushAgreement)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
firebaseId | String | yes | - | FirebaseInstanceId |
mobilePushAgreement | boolean | yes | - | Agreement (consent) for mobile push campaigns |
Return Value
IApiCall object to execute the request.
Example
IApiCall call = Client.registerForPush(refreshedToken, true);
call.execute(() -> Log.d(TAG, "Register for Push succeed: " + refreshedToken),
apiError -> Log.w(TAG, "Register for push failed: " + refreshedToken));
Delete a customer’s account
Use this method to delete a customer’s account.
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);
Delete a customer’s account by Synerise
Use this method to delete a customer’s account. HTTP 403 status code is returned when the provided password is invalid. The method returns an IApiCall needed to execute the request.
Method name: Client.deleteAccount(password)
This method is deprecated. Please use Client.deleteAccount(Client.deleteAccount(clientAuthFactor, clientIdentityProvider, authId)) instead.
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 a customer’s account by Facebook
Use this method to delete an account by Facebook. Returns:
- HTTP 400 status code if the provided data is invalid.
- HTTP 403 status code if the provided token is invalid.
- HTTP 404 status code if the Facebook customer does not exist.
The method returns an IApiCall needed to execute the request.
Method name: Client.deleteAccountByFacebook(facebookToken, uuid)
This method is deprecated. Please use Client.deleteAccount(Client.deleteAccount(clientAuthFactor, clientIdentityProvider, authId)) instead.
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);
Delete a customer’s account by OAuth
Use this method to delete an account by OAuth.
Method name: Client.deleteAccountByOAuth(accessToken, uuid)
This method is deprecated. Please use Client.deleteAccount(Client.deleteAccount(clientAuthFactor, clientIdentityProvider, authId)) instead.
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);