Skip to main content

Customers

Several methods are provided for managing the Customer within the SDK.

Create Customer#

Create a customer account using information from the user

Params#

NameTypeExample
customerCustomerInfo{ name: 'Abdelkhalek Zellat', carType: 'Tesla', carColor: 'Silver', licensePlate: 'AB 0496', phone: '555-555-5555' }

Example#

FlyBuy.Core.Customer.createCustomer({
name: 'Abdelkhalek Zellat',
carType: 'Tesla',
carColor: 'Silver',
licensePlate: 'AB 0496',
phone: '555-555-5555',
});

Login with Email/Password#

Login the user in using existing credentials

Params#

NameTypeExample
emailStr'name@email.com'
passwordStr'password'

Example#

FlyBuy.Core.Customer.login(`<email>`, `<password>`);

Login with Token#

Login the user with a previously obtained customer API token

Params#

NameTypeExample
tokenStr'F69PGKM1QXCN7Dj3ybEXCpU4'

Eample#

FlyBuy.Core.Customer.loginWithToken(`<token>`);

Logout#

Logs out the current customer.

Params#

NameType
NoneNone

Example#

FlyBuy.Core.Customer.logout();

Update Customer#

Update customer info for the logged in user

Params#

NameTypeExample
customerCustomerInfo{ name: 'Abdelkhalek Zellat', carType: 'Tesla', carColor: 'Silver', licensePlate: 'AB 0496', phone: '555-555-5555' }

Example#

FlyBuy.Core.Customer.updateCustomer({
name: 'Abdelkhalek Zellat',
carType: 'Tesla',
carColor: 'Purple',
licensePlate: 'AB 0496',
phone: '555-555-5555',
});

SignUp a Customer#

Link an email and password with the current anonymous logged in user.

Params#

NameTypeExample
emailStr'name@email.com'
passwordStr'password'

Example#

FlyBuy.Core.Customer.signUp('ha_zellat@esi.dz', 'password');

Get Current Customer#

Returns an instance of the current customer

Params#

NameType
NoneNone

Example#

FlyBuy.Core.Customer.getCurrentCustomer();