Constructor
new Customer(customerId, name, email, phoneNumber, address, loyaltyPointsopt)
Creates a new Customer instance.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
customerId |
number | Unique identifier for the customer. | ||
name |
string | Full name of the customer. | ||
email |
string | Email address of the customer. | ||
phoneNumber |
string | Contact number of the customer. | ||
address |
string | Residential or shipping address of the customer. | ||
loyaltyPoints |
number |
<optional> |
0 | Loyalty points accumulated by the customer (default is 0). |
- Source:
Methods
addLoyaltyPoints(points)
Adds loyalty points to the customer.
Parameters:
| Name | Type | Description |
|---|---|---|
points |
number | The number of points to add (must be positive). |
- Source:
getCustomerDetails() → {Object}
Retrieves the customer's details.
- Source:
Returns:
An object containing all customer details.
- Type
- Object
updateContactInfo(newEmailopt, newPhoneNumberopt, newAddressopt)
Updates the customer's contact information.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
newEmail |
string |
<optional> |
New email address (optional). |
newPhoneNumber |
string |
<optional> |
New phone number (optional). |
newAddress |
string |
<optional> |
New physical address (optional). |
- Source: