Model for customer profiles.
module:models/ProfileModel
The profile class
Classes
Methods
(inner) ProfileModel/addAddressToAddressBook(addressToAdd) → {dw.customer.CustomerAddress}T
Adds the given address to the address book of the current profile. The address attribute "city" is used to generate the address ID within the address book.
Parameters:
Name | Type | Description |
---|---|---|
addressToAdd |
Object |
Address with following attributes:
|
Returns:
Address object that is added to the address book.
(inner) ProfileModel/determineUniqueAddressID(city) → {String|null}
Determines a unique address ID for an address to be saved in the profiles address book. The function first checks the city as the candidate ID or appends a counter to the city (if already used as address ID) and then checks the existence of the resulting ID candidate. If the resulting ID is unique this ID is returned, if not the counter is incremented and checked again.
Parameters:
Name | Type | Description |
---|---|---|
city |
String |
an address ID. Preferably the city used in the address. Must not be null. |
Returns:
Returns a unique address ID. If the city parameter is null, returns null.
- Type
- String | null
(inner) ProfileModel/get(parameter)
Gets a new instance of a profile.
Parameters:
Name | Type | Description |
---|---|---|
parameter |
String | Object |
Customer number of the profile to get if a string or the profile object to wrap with a ProfileModel if an object. |
(inner) ProfileModel/getDefaultBillingAddress() → {dw.customer.CustomerAddress}
Retrieves the default customer billing address.
Returns:
Address defined as the preferred address in the profile.
(inner) ProfileModel/getDefaultShippingAddress() → {dw.customer.CustomerAddress}
Retrieves the default customer shipping address.
Returns:
Address defined as the preferred address in the profile.
(inner) ProfileModel/getPreferredAddress() → {dw.customer.CustomerAddress}
Retrieves the preferred customer address.
Returns:
Address defined as the preferred address in the profile.
(inner) ProfileModel/isDefaultBillingAddress(address) → {Boolean}
Checks if the address is the default billing address.
Parameters:
Name | Type | Description |
---|---|---|
address |
CustomerAddress |
address to check |
Returns:
true if the address is the default billing address.
- Type
- Boolean
(inner) ProfileModel/isDefaultShippingAddress(address) → {Boolean}
Checks if address is the default shipping address.
Parameters:
Name | Type | Description |
---|---|---|
address |
dw.customer.CustomerAddress |
address to check |
Returns:
true if the address is the default shipping address.
- Type
- Boolean
(inner) ProfileModel/setDefaultBillingAddress(address)
Sets the default customer billing address.
Parameters:
Name | Type | Description |
---|---|---|
address |
dw.customer.CustomerAddress |
new default billing address. |
(inner) ProfileModel/setDefaultShippingAddress(address)
Sets the default customer shipping address.
Parameters:
Name | Type | Description |
---|---|---|
address |
CustomerAddress |
new preferred address to be set. |
(inner) ProfileModel/validateWalletPaymentInstruments(paymentContainer, countryCode, amount) → {ArrayList}
Validates payment instruments and returns valid payment instruments.
Parameters:
Name | Type | Description |
---|---|---|
paymentContainer |
dw.customer.Wallet | dw.order.Basket |
Entity that possesses payment instruments |
countryCode |
String |
Billing country code or null. |
amount |
Number |
Payment amount to check valid payment instruments for. |
Returns:
Returns an array with the valid PaymentInstruments.
- Type
- ArrayList
(inner) ProfileModel/validateWalletPaymentInstruments(countryCode, amount) → {ArrayList}
Validates payment instruments and returns valid payment instruments.
Parameters:
Name | Type | Description |
---|---|---|
countryCode |
String |
Billing country code or null. |
amount |
Number |
Payment amount to check valid payment instruments for. |
Returns:
Returns an array with the valid PaymentInstruments.
- Type
- ArrayList