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.Declared In:
lib/main/modules/ClientModule.js
Related To:
ClientAccountInformation
Class:
ClientModule
Declaration:
public getAccount(onSuccess: (clientAccountInformation: ClientAccountInformation) => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Synerise.Client.getAccount(function(clientAccountInformation) {
//success
}, function(error) {
//failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Related To:
ClientAccountUpdateContext
Class:
ClientModule
Declaration:
public updateAccount(context: ClientAccountUpdateContext, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
context | ClientAccountUpdateContext | yes | - | Object with customer’s email, password, and other optional data |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let context = new ClientAccountUpdateContext();
context.email = 'hello@synerise.com';
context.phone = '123456789';
context.customId = '000111';
context.firstName = 'John';
context.lastName = 'Rise';
context.displayName = 'John Rise';
context.sex = ClientSex.Male;
context.birthDate = '1989-08-03';
context.company = 'Synerise';
context.address = 'Marszałkowska';
context.city = 'Warszawa';
context.province = 'Mazowieckie';
context.zipCode = '00-000';
context.countryCode = '+48';
context.agreements = new ClientAgreements({
email: true,
sms: true,
push: true,
bluetooth: true,
rfid: true,
wifi: true
});
context.attributes = { ATTRIBUTE_1: 'ATTRIBUTE_1' }
context.tags = ['TAG_1', 'TAG_2']
Synerise.Client.updateAccount(context, function() {
// success
}, function(error) {
// failure
})
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public changePassword(oldPassword: string, newPassword: string, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
newPassword | string | yes | - | Customer’s new password |
oldPassword | string | yes | - | Customer’s old password |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let newPassword = "NEW_PASSWORD";
let oldPassword = "OLD_PASSWORD";
Synerise.Client.changePassword(newPassword, oldPassword, function() {
// success
}, function(error) {
// failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public requestPasswordReset(email: string, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
string | yes | - | Customer’s email | |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Synerise.Client.requestPasswordReset("EMAIL", function() {
// success
}, function(error) {
// failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public confirmPasswordReset(password: string, token: string, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
password | string | yes | - | Customer’s new password |
token | string | yes | - | Customer’s token provided in an email |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Synerise.Client.confirmPasswordReset("PASSWORD", "TOKEN", function() {
// success
}, function(error) {
// failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public requestEmailChange(email: string, password: string | null, externalToken: string | null, authID: string | null, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
string | yes | - | Customer’s new email | |
password | string | yes | - | Customer’s password |
externalToken | AnyObject | no | - | Customer’s token (if OAuth, Facebook, and so on) |
authID | String | no | - | Optional identifier of authorization |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Synerise.Client.requestEmailChange("EMAIL", "PASSWORD", function() {
// success
}, function(error) {
// failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public confirmEmailChange(token: string, newsletterAgreement: Boolean, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
token | string | yes | - | Customer’s token provided in an email |
newsletterAgreement | boolean | yes | - | Agreement for sending newsletters to the provided email |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Synerise.Client.confirmEmailChange("TOKEN", true, function() {
// success
}, function(error) {
// failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public requestPhoneUpdate(phone: string, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
phone | string | yes | - | Customer’s new phone number |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Synerise.Client.requestPhoneUpdate("PHONE", function() {
// success
}, function(error) {
// failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public confirmPhoneUpdate(phone: string, confirmationCode: string, smsAgreement: Boolean, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
phone | string | yes | - | New phone number |
confirmationCode | string | yes | - | A confirmation code received by a text message |
smsAgreement | boolean | yes | - | Agreement for sending SMS to the provided number |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Synerise.Client.confirmPhoneUpdate("PHONE", "CONFIRMATION_CODE", true, function() {
// success
}, function(error) {
// failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Related To:
ClientIdentityProvider
Class:
ClientModule
Declaration:
public deleteAccountByIdentityProvider(clientAuthFactor: string, clientIdentityProvider: ClientIdentityProvider, authID: string | null, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
clientAuthFactor | string | yes | - | Token retrieved from provider |
clientIdentityProvider | ClientIdentityProvider | yes | - | Provider of your token |
authID | string | no | null | Optional identifier of authorization |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public deleteAccount(password: string, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
password | string | yes | - | Customer’s password |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
let password = "PASSWORD";
Synerise.Client.deleteAccount(password, function(token) {
// success
}, function(error) {
// failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public deleteAccountByOAuth(accessToken: string, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
accessToken | string | yes | - | OAuth Access Token |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Synerise.Client.deleteAccountByOAuth(accessToken, function(token) {
// success
}, function(error) {
// failure
});
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.Declared In:
lib/main/modules/ClientModule.js
Class:
ClientModule
Declaration:
public deleteAccountByFacebook(facebookToken: string, onSuccess: () => void, onError: (error: Error) => void)
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
facebookToken | string | yes | - | Facebook Access Token |
onSuccess | Function | no | - | Function to be executed when the operation is completed successfully |
onError | Function | no | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
Example:
Synerise.Client.deleteAccountByFacebook(facebookToken, function(token) {
// success
}, function(error) {
// failure
});