menu

SiteGenesis / Server-side JS / Module: models/ProfileModel

Classes

ProfileModel

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:

  • address1
  • address2
  • city
  • companyName
  • countryCode
  • firstName
  • lastName
  • postalCode
  • postBox
  • stateCode
Note: dw.customer.CustomerAddress objects can be passed and meet this criteria.

Source:
Returns:

Address object that is added to the address book.

Type
dw.customer.CustomerAddress

(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.

Source:
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.

Source:

(inner) ProfileModel/getDefaultBillingAddress() → {dw.customer.CustomerAddress}

Retrieves the default customer billing address.

Source:
Returns:

Address defined as the preferred address in the profile.

Type
dw.customer.CustomerAddress

(inner) ProfileModel/getDefaultShippingAddress() → {dw.customer.CustomerAddress}

Retrieves the default customer shipping address.

Source:
Returns:

Address defined as the preferred address in the profile.

Type
dw.customer.CustomerAddress

(inner) ProfileModel/getPreferredAddress() → {dw.customer.CustomerAddress}

Retrieves the preferred customer address.

Source:
Returns:

Address defined as the preferred address in the profile.

Type
dw.customer.CustomerAddress

(inner) ProfileModel/isDefaultBillingAddress(address) → {Boolean}

Checks if the address is the default billing address.

Parameters:
Name Type Description
address CustomerAddress

address to check

Source:
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

Source:
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.

Source:

(inner) ProfileModel/setDefaultShippingAddress(address)

Sets the default customer shipping address.

Parameters:
Name Type Description
address CustomerAddress

new preferred address to be set.

Source:

(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.

Source:
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.

Source:
Returns:

Returns an array with the valid PaymentInstruments.

Type
ArrayList