Customer account management
Get customer account information
Use this method to get a Customer’s account information.
Declared In
lib/main/modules/ClientModule.js
Related
lib/classes/models/Client/ClientAccountInformation.js
Method
Synerise.Client.getAccount(onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.getAccount(function(clientAccountInformation) {
//success
}, function(error) {
//failure
});
Update customer account information
Use this method to update a Customer’s account information.
This method requires the ClientAccountUpdateContext
object with the Customer’s account information. Omitted fields are not modified.
Declared In
lib/main/modules/ClientModule.js
Related
lib/classes/models/Client/ClientAccountUpdateContext.js
Method
Synerise.Client.updateAccount(context, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
context |
ClientAccountUpdateContext |
yes | - | Object with the Customer’s update data |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
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
Use this method to change a Customer’s password.
Returns the HTTP 403 status code if the provided old password is invalid.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.changePassword(newPassword, oldPassword, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
newPassword |
string |
yes | - | Customer’s new password |
oldPassword |
string |
yes | - | Customer’s old password |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
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
Request a Customer’s password reset with email. The Customer will receive a token at the provided email address. That token is then used for Synerise.Client.confirmResetPassword
.
This method requires the Customer’s email. This method is a global operation and does not require authorization.
Declared In
lib/main/modules/ClientModule.js
Method
Client.requestPasswordReset(email, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
email |
string |
yes | - | Customer’s email |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.requestPasswordReset("EMAIL", function() {
// success
}, function(error) {
// failure
});
Confirm password reset for customer account
Confirm a Customer’s password reset with the new password and token provided by Synerise.Client.requestPasswordReset
.
This method requires the Customer’s new password and the confirmation token received by e-mail.
This method is a global operation and does not require authorization.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.confirmPasswordReset(password, token, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
password |
string |
yes | - | Customer’s new password |
token |
string |
yes | - | Customer’s token provided by email |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.confirmPasswordReset("PASSWORD", "TOKEN", function() {
// success
}, function(error) {
// failure
});
Request email change for customer account
Use this method to request a Customer’s email change.
Returns the HTTP 403 status code if the provided UUID does not exist or the password is invalid.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.requestEmailChange(email, password, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
email |
string |
yes | - | Customer’s new email |
password |
string |
yes | - | Customer’s password |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.requestEmailChange("EMAIL", "PASSWORD", function() {
// success
}, function(error) {
// failure
});
Confirm email change for customer account
Use this method to confirm an email change.
Returns the HTTP 403 status code if the provided token is invalid.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.confirmEmailChange(token, newsletterAgreement, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
token |
string |
yes | - | Customer’s token provided by email |
newsletterAgreement |
boolean |
yes | - | Agreement for newsletters to the provided email |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.confirmEmailChange("TOKEN", true, function() {
// success
}, function(error) {
// failure
});
Request phone update on customer account
Use this method to request a phone number update. This action requires additional validation by PIN code.
Returns the HTTP 403 status code if the provided UUID does not exist or the password is invalid.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.requestPhoneUpdate(phone, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
phone |
string |
yes | - | Customer’s new phone number |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.requestPhoneUpdate("PHONE", function() {
// success
}, function(error) {
// failure
});
Confirm phone update on customer account
Use this method to confirm a phone number update. This action requires the new phone number and confirmation code as parameters.
Returns the HTTP 403 status code if the provided UUID does not exist or the password is invalid.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.confirmPhoneUpdate(phone, confirmationCode, smsAgreement, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
phone |
string |
yes | - | New phone number |
confirmationCode |
string |
yes | - | Customer’s confirmation code received by phone |
smsAgreement |
boolean |
yes | - | Agreement for SMS marketing to the provided number |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.confirmPhoneUpdate("PHONE", "CONFIRMATION_CODE", true, function() {
// success
}, function(error) {
// failure
});
Delete Customer account by Identity Provider
Use this method to delete a Client’s account.
HTTP 403 status code is returned if the provided password is invalid.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.deleteAccountByIdentityProvider(clientAuthFactor, clientIdentityProvider, authID, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
clientAuthFactor |
string |
yes | - | Customer’s password |
clientIdentityProvider |
ClientIdentityProvider |
yes | - | Customer’s password |
authID |
string |
no | - | Customer’s password |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Delete customer account
Use this method to delete a Client’s account.
HTTP 403 status code is returned if the provided password is invalid.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.deleteAccount(password, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
password |
string |
yes | - | Customer’s password |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
let password = "PASSWORD";
Synerise.Client.deleteAccount(password, function(token) {
// success
}, function(error) {
// failure
});
Delete customer account by OAuth
Use this method to delete a Customer’s account by OAuth authentication.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.deleteAccountByOAuth(accessToken, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
accessToken |
string |
yes | - | Customer’s token |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.deleteAccountByOAuth(accessToken, function(token) {
// success
}, function(error) {
// failure
});
Delete customer account by Facebook
Use this method to delete a Customer’s account by Facebook authentication.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.deleteAccountByFacebook(facebookToken, onSuccess, onError)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
facebookToken |
string |
yes | - | Customer’s facebook token |
onSuccess |
function |
no | - | Callback function to be executed when the operation finishes successfully |
onError |
function |
no | - | Callback function to be executed when the operation finishes unsuccessfully |
Return Value
There is no return value.
Example
Synerise.Client.deleteAccountByFacebook(facebookToken, function(token) {
// success
}, function(error) {
// failure
});
Recognize anonymous customer
Method to recognize anonymous customers and save personal information in their database entries.
Declared In
lib/main/modules/ClientModule.js
Method
Synerise.Client.recognizeAnonymous(email, customIdentify, parameters)
Parameters
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
email |
string |
no | - | Customer’s email |
customIdentify |
string |
no | - | Customer’s custom identifier |
parameters |
object |
no | - | Customer’s custom parameters |
Return Value
There is no return value.
Example
Synerise.Client.recognizeAnonymous("EMAIL", "CUSTOM_IDENTIFY", {
"PARAM_1": "PARAM_1"
});