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 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, uuid)

Declaration

public static IApiCall requestEmailChange(String email, String password, @Nullable String uuid)

Parameters

Parameter Type Mandatory Default Description
email String yes - Customer’s email
password String yes - Customer’s password
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 apiCall;
apiCall = Client.requestEmailChange(email, password, uuid);
            apiCall.execute(this::onSuccess, this::onFailure);

Request email change by Facebook


Use this method to request an email change.

Returns HTTP 403 if the provided UUID does not exist. The method returns an IApiCall needed to execute the request.

Method name: Client.requestEmailChangeByFacebook(email, uuid)

Declaration

public static IApiCall requestEmailChangeByFacebook(String email, @Nullable String uuid)

Parameters

Parameter Type Mandatory Default Description
email String yes - Customer’s email
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 apiCall;
apiCall = Client.requestEmailChangeByFacebook(email, uuid);
            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);

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)

Parameters

Parameter Type Mandatory Default Description
firebaseId String yes - FirebaseInstanceId

Return Value

IApiCall object to execute the request.

Example

IApiCall call = Client.registerForPush(refreshedToken);
            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. 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)

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)

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);
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.