Class CustomerDraftBuilder
- All Implemented Interfaces:
Builder<CustomerDraft>
Example to create an instance using the builder pattern
CustomerDraft customerDraft = CustomerDraft.builder()
.email("{email}")
.build()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAddresses(Function<BaseAddressBuilder, BaseAddress> builder) Addresses of the Customer.addCustomerGroupAssignments(Function<CustomerGroupAssignmentDraftBuilder, CustomerGroupAssignmentDraft> builder) Customer Groups to assign the Customer to.addresses(BaseAddress... addresses) Addresses of the Customer.addresses(List<BaseAddress> addresses) Addresses of the Customer.Sets the Stores for the Customer.anonymousCart(CartResourceIdentifier anonymousCart) Assigns the Customer to the specified Cart.Assigns the Customer to the specified Cart.anonymousCartId(String anonymousCartId) Deprecated.anonymousId(String anonymousId) authenticationMode(AuthenticationMode authenticationMode) Set toPasswordto make thepasswordfield required for the Customer. Set toExternalAuthwhen the password is not required for the Customer.billingAddresses(Integer... billingAddresses) Indices of the billing addresses in theaddressesarray.billingAddresses(List<Integer> billingAddresses) Indices of the billing addresses in theaddressesarray.build()builds CustomerDraft with checking for non-null required valuesbuilds CustomerDraft without checking for non-null required valuescompanyName(String companyName) Company name of the Customer.custom(CustomFieldsDraft custom) Custom Fields for the Customer.Custom Fields for the Customer.customerGroup(CustomerGroupResourceIdentifier customerGroup) Sets the CustomerGroup for the Customer.customerGroup(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifierBuilder> builder) Sets the CustomerGroup for the Customer.customerGroupAssignments(CustomerGroupAssignmentDraft... customerGroupAssignments) Customer Groups to assign the Customer to.customerGroupAssignments(List<CustomerGroupAssignmentDraft> customerGroupAssignments) Customer Groups to assign the Customer to.customerNumber(String customerNumber) User-defined unique identifier for a Customer.dateOfBirth(LocalDate dateOfBirth) Date of birth of the Customer.defaultBillingAddress(Integer defaultBillingAddress) Index of the address in theaddressesarray to use as the default billing address.defaultShippingAddress(Integer defaultShippingAddress) Index of the address in theaddressesarray to use as the default shipping address.Email address of the Customer that must be unique for an entire Project or to a Store the Customer is assigned to.externalId(String externalId) Optional identifier for use in external systems like customer relationship management (CRM) or enterprise resource planning (ERP).Given name (first name) of the Customer.Addresses of the Customer.Assigns the Customer to the specified Cart.Deprecated.Set toPasswordto make thepasswordfield required for the Customer. Set toExternalAuthwhen the password is not required for the Customer.Indices of the billing addresses in theaddressesarray.Company name of the Customer.Custom Fields for the Customer.Sets the CustomerGroup for the Customer.Customer Groups to assign the Customer to.User-defined unique identifier for a Customer.Date of birth of the Customer.Index of the address in theaddressesarray to use as the default billing address.Index of the address in theaddressesarray to use as the default shipping address.getEmail()Email address of the Customer that must be unique for an entire Project or to a Store the Customer is assigned to.Optional identifier for use in external systems like customer relationship management (CRM) or enterprise resource planning (ERP).Given name (first name) of the Customer.Set totrueif the email address of the Customer has been verified already.getKey()User-defined unique identifier for the Customer.Family name (last name) of the Customer.Preferred language of the Customer.Middle name of the Customer.Required whenauthenticationModeis set toPassword.Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.Indices of the shipping addresses in theaddressesarray.Sets the Stores for the Customer.getTitle()Title of the Customer, for example, 'Dr.'.getVatId()Individual VAT ID of the Customer.isEmailVerified(Boolean isEmailVerified) Set totrueif the email address of the Customer has been verified already.User-defined unique identifier for the Customer.Family name (last name) of the Customer.Preferred language of the Customer.middleName(String middleName) Middle name of the Customer.static CustomerDraftBuilderof()factory method for an instance of CustomerDraftBuilderstatic CustomerDraftBuilderof(CustomerDraft template) create builder for CustomerDraft instanceRequired whenauthenticationModeis set toPassword.plusAddresses(BaseAddress... addresses) Addresses of the Customer.Addresses of the Customer.plusBillingAddresses(Integer... billingAddresses) Indices of the billing addresses in theaddressesarray.plusCustomerGroupAssignments(CustomerGroupAssignmentDraft... customerGroupAssignments) Customer Groups to assign the Customer to.plusCustomerGroupAssignments(Function<CustomerGroupAssignmentDraftBuilder, CustomerGroupAssignmentDraftBuilder> builder) Customer Groups to assign the Customer to.plusShippingAddresses(Integer... shippingAddresses) Indices of the shipping addresses in theaddressesarray.plusStores(StoreResourceIdentifier... stores) Sets the Stores for the Customer.Sets the Stores for the Customer.salutation(String salutation) Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.setAddresses(Function<BaseAddressBuilder, BaseAddress> builder) Addresses of the Customer.setCustomerGroupAssignments(Function<CustomerGroupAssignmentDraftBuilder, CustomerGroupAssignmentDraft> builder) Customer Groups to assign the Customer to.Sets the Stores for the Customer.shippingAddresses(Integer... shippingAddresses) Indices of the shipping addresses in theaddressesarray.shippingAddresses(List<Integer> shippingAddresses) Indices of the shipping addresses in theaddressesarray.stores(StoreResourceIdentifier... stores) Sets the Stores for the Customer.stores(List<StoreResourceIdentifier> stores) Sets the Stores for the Customer.Title of the Customer, for example, 'Dr.'.Individual VAT ID of the Customer.Addresses of the Customer.Assigns the Customer to the specified Cart.Custom Fields for the Customer.withCustomerGroup(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifier> builder) Sets the CustomerGroup for the Customer.withCustomerGroupAssignments(Function<CustomerGroupAssignmentDraftBuilder, CustomerGroupAssignmentDraftBuilder> builder) Customer Groups to assign the Customer to.Sets the Stores for the Customer.
-
Constructor Details
-
CustomerDraftBuilder
public CustomerDraftBuilder()
-
-
Method Details
-
key
User-defined unique identifier for the Customer. The
keyfield is preferred overcustomerNumberas it is mutable and provides more flexibility.This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing Customers with the Import API.
- Parameters:
key- value to be set- Returns:
- Builder
-
customerNumber
User-defined unique identifier for a Customer. Once set, it cannot be changed.
Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence).
- Parameters:
customerNumber- value to be set- Returns:
- Builder
-
externalId
Optional identifier for use in external systems like customer relationship management (CRM) or enterprise resource planning (ERP).
- Parameters:
externalId- value to be set- Returns:
- Builder
-
email
Email address of the Customer that must be unique for an entire Project or to a Store the Customer is assigned to. It is the mandatory unique identifier of a Customer.
- Parameters:
email- value to be set- Returns:
- Builder
-
password
Required when
authenticationModeis set toPassword. Provide the Customer's password in plain text. The API stores passwords in an encrypted format.- Parameters:
password- value to be set- Returns:
- Builder
-
firstName
Given name (first name) of the Customer.
- Parameters:
firstName- value to be set- Returns:
- Builder
-
lastName
Family name (last name) of the Customer.
- Parameters:
lastName- value to be set- Returns:
- Builder
-
middleName
Middle name of the Customer.
- Parameters:
middleName- value to be set- Returns:
- Builder
-
title
Title of the Customer, for example, 'Dr.'.
- Parameters:
title- value to be set- Returns:
- Builder
-
anonymousCartId
Deprecated.Deprecated since an anonymous Cart can be identified by its
idor externalkey.- Parameters:
anonymousCartId- value to be set- Returns:
- Builder
-
anonymousCart
public CustomerDraftBuilder anonymousCart(Function<CartResourceIdentifierBuilder, CartResourceIdentifierBuilder> builder) Assigns the Customer to the specified Cart.
- Parameters:
builder- function to build the anonymousCart value- Returns:
- Builder
-
withAnonymousCart
public CustomerDraftBuilder withAnonymousCart(Function<CartResourceIdentifierBuilder, CartResourceIdentifier> builder) Assigns the Customer to the specified Cart.
- Parameters:
builder- function to build the anonymousCart value- Returns:
- Builder
-
anonymousCart
Assigns the Customer to the specified Cart.
- Parameters:
anonymousCart- value to be set- Returns:
- Builder
-
anonymousId
Assigns the Customer to all Carts, Orders, ShoppingLists, and Payments with the same
anonymousId.If
anonymousCartis provided, this value must match theanonymousIdof the anonymous Cart; otherwise, an InvalidOperation error is returned.- Parameters:
anonymousId- value to be set- Returns:
- Builder
-
dateOfBirth
Date of birth of the Customer.
- Parameters:
dateOfBirth- value to be set- Returns:
- Builder
-
companyName
Company name of the Customer. When representing a company as a Customer, Business Units provide extended functionality.
- Parameters:
companyName- value to be set- Returns:
- Builder
-
vatId
Individual VAT ID of the Customer.
- Parameters:
vatId- value to be set- Returns:
- Builder
-
addresses
Addresses of the Customer.
- Parameters:
addresses- value to be set- Returns:
- Builder
-
addresses
Addresses of the Customer.
- Parameters:
addresses- value to be set- Returns:
- Builder
-
plusAddresses
Addresses of the Customer.
- Parameters:
addresses- value to be set- Returns:
- Builder
-
plusAddresses
Addresses of the Customer.
- Parameters:
builder- function to build the addresses value- Returns:
- Builder
-
withAddresses
Addresses of the Customer.
- Parameters:
builder- function to build the addresses value- Returns:
- Builder
-
addAddresses
Addresses of the Customer.
- Parameters:
builder- function to build the addresses value- Returns:
- Builder
-
setAddresses
Addresses of the Customer.
- Parameters:
builder- function to build the addresses value- Returns:
- Builder
-
defaultShippingAddress
Index of the address in the
addressesarray to use as the default shipping address. ThedefaultShippingAddressIdof the Customer will be set to theidof that address.- Parameters:
defaultShippingAddress- value to be set- Returns:
- Builder
-
shippingAddresses
Indices of the shipping addresses in the
addressesarray. TheshippingAddressIdsof the Customer will be set to the IDs of these addresses.- Parameters:
shippingAddresses- value to be set- Returns:
- Builder
-
shippingAddresses
Indices of the shipping addresses in the
addressesarray. TheshippingAddressIdsof the Customer will be set to the IDs of these addresses.- Parameters:
shippingAddresses- value to be set- Returns:
- Builder
-
plusShippingAddresses
Indices of the shipping addresses in the
addressesarray. TheshippingAddressIdsof the Customer will be set to the IDs of these addresses.- Parameters:
shippingAddresses- value to be set- Returns:
- Builder
-
defaultBillingAddress
Index of the address in the
addressesarray to use as the default billing address. ThedefaultBillingAddressIdof the Customer will be set to theidof that address.- Parameters:
defaultBillingAddress- value to be set- Returns:
- Builder
-
billingAddresses
Indices of the billing addresses in the
addressesarray. ThebillingAddressIdsof the Customer will be set to the IDs of these addresses.- Parameters:
billingAddresses- value to be set- Returns:
- Builder
-
billingAddresses
Indices of the billing addresses in the
addressesarray. ThebillingAddressIdsof the Customer will be set to the IDs of these addresses.- Parameters:
billingAddresses- value to be set- Returns:
- Builder
-
plusBillingAddresses
Indices of the billing addresses in the
addressesarray. ThebillingAddressIdsof the Customer will be set to the IDs of these addresses.- Parameters:
billingAddresses- value to be set- Returns:
- Builder
-
isEmailVerified
Set to
trueif the email address of the Customer has been verified already. The intended use is to leave this field unset upon sign-up of the Customer and initiate the email verification afterwards.- Parameters:
isEmailVerified- value to be set- Returns:
- Builder
-
customerGroup
public CustomerDraftBuilder customerGroup(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifierBuilder> builder) Sets the CustomerGroup for the Customer.
For new projects, use
customerGroupAssignmentsinstead. It supports assigning Customers to multiple Customer Groups and provides greater flexibility in complex pricing scenarios.- Parameters:
builder- function to build the customerGroup value- Returns:
- Builder
-
withCustomerGroup
public CustomerDraftBuilder withCustomerGroup(Function<CustomerGroupResourceIdentifierBuilder, CustomerGroupResourceIdentifier> builder) Sets the CustomerGroup for the Customer.
For new projects, use
customerGroupAssignmentsinstead. It supports assigning Customers to multiple Customer Groups and provides greater flexibility in complex pricing scenarios.- Parameters:
builder- function to build the customerGroup value- Returns:
- Builder
-
customerGroup
Sets the CustomerGroup for the Customer.
For new projects, use
customerGroupAssignmentsinstead. It supports assigning Customers to multiple Customer Groups and provides greater flexibility in complex pricing scenarios.- Parameters:
customerGroup- value to be set- Returns:
- Builder
-
customerGroupAssignments
public CustomerDraftBuilder customerGroupAssignments(@Nullable CustomerGroupAssignmentDraft... customerGroupAssignments) Customer Groups to assign the Customer to.
Used for Line Item price selection.
- Parameters:
customerGroupAssignments- value to be set- Returns:
- Builder
-
customerGroupAssignments
public CustomerDraftBuilder customerGroupAssignments(@Nullable List<CustomerGroupAssignmentDraft> customerGroupAssignments) Customer Groups to assign the Customer to.
Used for Line Item price selection.
- Parameters:
customerGroupAssignments- value to be set- Returns:
- Builder
-
plusCustomerGroupAssignments
public CustomerDraftBuilder plusCustomerGroupAssignments(@Nullable CustomerGroupAssignmentDraft... customerGroupAssignments) Customer Groups to assign the Customer to.
Used for Line Item price selection.
- Parameters:
customerGroupAssignments- value to be set- Returns:
- Builder
-
plusCustomerGroupAssignments
public CustomerDraftBuilder plusCustomerGroupAssignments(Function<CustomerGroupAssignmentDraftBuilder, CustomerGroupAssignmentDraftBuilder> builder) Customer Groups to assign the Customer to.
Used for Line Item price selection.
- Parameters:
builder- function to build the customerGroupAssignments value- Returns:
- Builder
-
withCustomerGroupAssignments
public CustomerDraftBuilder withCustomerGroupAssignments(Function<CustomerGroupAssignmentDraftBuilder, CustomerGroupAssignmentDraftBuilder> builder) Customer Groups to assign the Customer to.
Used for Line Item price selection.
- Parameters:
builder- function to build the customerGroupAssignments value- Returns:
- Builder
-
addCustomerGroupAssignments
public CustomerDraftBuilder addCustomerGroupAssignments(Function<CustomerGroupAssignmentDraftBuilder, CustomerGroupAssignmentDraft> builder) Customer Groups to assign the Customer to.
Used for Line Item price selection.
- Parameters:
builder- function to build the customerGroupAssignments value- Returns:
- Builder
-
setCustomerGroupAssignments
public CustomerDraftBuilder setCustomerGroupAssignments(Function<CustomerGroupAssignmentDraftBuilder, CustomerGroupAssignmentDraft> builder) Customer Groups to assign the Customer to.
Used for Line Item price selection.
- Parameters:
builder- function to build the customerGroupAssignments value- Returns:
- Builder
-
custom
public CustomerDraftBuilder custom(Function<CustomFieldsDraftBuilder, CustomFieldsDraftBuilder> builder) Custom Fields for the Customer.
- Parameters:
builder- function to build the custom value- Returns:
- Builder
-
withCustom
public CustomerDraftBuilder withCustom(Function<CustomFieldsDraftBuilder, CustomFieldsDraft> builder) Custom Fields for the Customer.
- Parameters:
builder- function to build the custom value- Returns:
- Builder
-
custom
Custom Fields for the Customer.
- Parameters:
custom- value to be set- Returns:
- Builder
-
locale
Preferred language of the Customer. Must be one of the languages supported by the Project.
- Parameters:
locale- value to be set- Returns:
- Builder
-
salutation
Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.
- Parameters:
salutation- value to be set- Returns:
- Builder
-
stores
Sets the Stores for the Customer.
- If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.
- If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.
- Parameters:
stores- value to be set- Returns:
- Builder
-
stores
Sets the Stores for the Customer.
- If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.
- If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.
- Parameters:
stores- value to be set- Returns:
- Builder
-
plusStores
Sets the Stores for the Customer.
- If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.
- If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.
- Parameters:
stores- value to be set- Returns:
- Builder
-
plusStores
public CustomerDraftBuilder plusStores(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifierBuilder> builder) Sets the Stores for the Customer.
- If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.
- If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.
- Parameters:
builder- function to build the stores value- Returns:
- Builder
-
withStores
public CustomerDraftBuilder withStores(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifierBuilder> builder) Sets the Stores for the Customer.
- If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.
- If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.
- Parameters:
builder- function to build the stores value- Returns:
- Builder
-
addStores
public CustomerDraftBuilder addStores(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifier> builder) Sets the Stores for the Customer.
- If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.
- If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.
- Parameters:
builder- function to build the stores value- Returns:
- Builder
-
setStores
public CustomerDraftBuilder setStores(Function<StoreResourceIdentifierBuilder, StoreResourceIdentifier> builder) Sets the Stores for the Customer.
- If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.
- If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.
- Parameters:
builder- function to build the stores value- Returns:
- Builder
-
authenticationMode
- Set to
Passwordto make thepasswordfield required for the Customer. - Set to
ExternalAuthwhen the password is not required for the Customer.
- Parameters:
authenticationMode- value to be set- Returns:
- Builder
- Set to
-
getKey
User-defined unique identifier for the Customer. The
keyfield is preferred overcustomerNumberas it is mutable and provides more flexibility.This field is optional for backwards compatibility reasons, but we strongly recommend setting it. Keys are mandatory for importing Customers with the Import API.
- Returns:
- key
-
getCustomerNumber
User-defined unique identifier for a Customer. Once set, it cannot be changed.
Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence).
- Returns:
- customerNumber
-
getExternalId
Optional identifier for use in external systems like customer relationship management (CRM) or enterprise resource planning (ERP).
- Returns:
- externalId
-
getEmail
Email address of the Customer that must be unique for an entire Project or to a Store the Customer is assigned to. It is the mandatory unique identifier of a Customer.
- Returns:
-
getPassword
Required when
authenticationModeis set toPassword. Provide the Customer's password in plain text. The API stores passwords in an encrypted format.- Returns:
- password
-
getFirstName
Given name (first name) of the Customer.
- Returns:
- firstName
-
getLastName
Family name (last name) of the Customer.
- Returns:
- lastName
-
getMiddleName
Middle name of the Customer.
- Returns:
- middleName
-
getTitle
Title of the Customer, for example, 'Dr.'.
- Returns:
- title
-
getAnonymousCartId
Deprecated.Deprecated since an anonymous Cart can be identified by its
idor externalkey.- Returns:
- anonymousCartId
-
getAnonymousCart
Assigns the Customer to the specified Cart.
- Returns:
- anonymousCart
-
getAnonymousId
Assigns the Customer to all Carts, Orders, ShoppingLists, and Payments with the same
anonymousId.If
anonymousCartis provided, this value must match theanonymousIdof the anonymous Cart; otherwise, an InvalidOperation error is returned.- Returns:
- anonymousId
-
getDateOfBirth
Date of birth of the Customer.
- Returns:
- dateOfBirth
-
getCompanyName
Company name of the Customer. When representing a company as a Customer, Business Units provide extended functionality.
- Returns:
- companyName
-
getVatId
Individual VAT ID of the Customer.
- Returns:
- vatId
-
getAddresses
Addresses of the Customer.
- Returns:
- addresses
-
getDefaultShippingAddress
Index of the address in the
addressesarray to use as the default shipping address. ThedefaultShippingAddressIdof the Customer will be set to theidof that address.- Returns:
- defaultShippingAddress
-
getShippingAddresses
Indices of the shipping addresses in the
addressesarray. TheshippingAddressIdsof the Customer will be set to the IDs of these addresses.- Returns:
- shippingAddresses
-
getDefaultBillingAddress
Index of the address in the
addressesarray to use as the default billing address. ThedefaultBillingAddressIdof the Customer will be set to theidof that address.- Returns:
- defaultBillingAddress
-
getBillingAddresses
Indices of the billing addresses in the
addressesarray. ThebillingAddressIdsof the Customer will be set to the IDs of these addresses.- Returns:
- billingAddresses
-
getIsEmailVerified
Set to
trueif the email address of the Customer has been verified already. The intended use is to leave this field unset upon sign-up of the Customer and initiate the email verification afterwards.- Returns:
- isEmailVerified
-
getCustomerGroup
Sets the CustomerGroup for the Customer.
For new projects, use
customerGroupAssignmentsinstead. It supports assigning Customers to multiple Customer Groups and provides greater flexibility in complex pricing scenarios.- Returns:
- customerGroup
-
getCustomerGroupAssignments
Customer Groups to assign the Customer to.
Used for Line Item price selection.
- Returns:
- customerGroupAssignments
-
getCustom
Custom Fields for the Customer.
- Returns:
- custom
-
getLocale
Preferred language of the Customer. Must be one of the languages supported by the Project.
- Returns:
- locale
-
getSalutation
Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.
- Returns:
- salutation
-
getStores
Sets the Stores for the Customer.
- If no Stores are specified, the Customer is a global customer, and can log in using the Password Flow for global Customers.
- If any Stores are specified, the Customer can only log in using the Password Flow for Customers in a Store for those specific Stores.
- Returns:
- stores
-
getAuthenticationMode
- Set to
Passwordto make thepasswordfield required for the Customer. - Set to
ExternalAuthwhen the password is not required for the Customer.
- Returns:
- authenticationMode
- Set to
-
build
builds CustomerDraft with checking for non-null required values- Specified by:
buildin interfaceBuilder<CustomerDraft>- Returns:
- CustomerDraft
-
buildUnchecked
builds CustomerDraft without checking for non-null required values- Returns:
- CustomerDraft
-
of
factory method for an instance of CustomerDraftBuilder- Returns:
- builder
-
of
create builder for CustomerDraft instance- Parameters:
template- instance with prefilled values for the builder- Returns:
- builder
-