public final class CustomerUpdateActionUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CUSTOMER_NUMBER_EXISTS_WARNING |
Modifier and Type | Method and Description |
---|---|
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildAddAddressUpdateActions(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
List of a CustomerDraft.getAddresses() and a Customer.getAddresses() . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildAddBillingAddressUpdateActions(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
List of a Customer.getBillingAddresses() and a CustomerDraft.getBillingAddresses() . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildAddShippingAddressUpdateActions(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
List of a Customer.getShippingAddresses() and a CustomerDraft.getShippingAddresses() . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildAddStoreUpdateActions(java.util.List<io.sphere.sdk.models.KeyReference<io.sphere.sdk.stores.Store>> oldStores,
java.util.List<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.stores.Store>> newStores)
Compares the
List of Store KeyReference s and Store ResourceIdentifier s of a CustomerDraft and a Customer . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildAllAddressUpdateActions(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the addresses of a
Customer and a CustomerDraft . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildChangeAddressUpdateActions(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
List of a CustomerDraft.getAddresses() and a Customer.getAddresses() . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildChangeEmailUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
email values of a Customer and a CustomerDraft and returns
an Optional of update action, which would contain the "changeEmail" UpdateAction . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildRemoveAddressUpdateActions(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
List of a CustomerDraft.getAddresses() and a Customer.getAddresses() . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildRemoveBillingAddressUpdateActions(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
List of a Customer.getBillingAddresses() and a CustomerDraft.getBillingAddresses() . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildRemoveShippingAddressUpdateActions(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
List of a Customer.getShippingAddresses() and a CustomerDraft.getShippingAddresses() . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildRemoveStoreUpdateActions(java.util.List<io.sphere.sdk.models.KeyReference<io.sphere.sdk.stores.Store>> oldStores,
java.util.List<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.stores.Store>> newStores)
Compares the
List of Store KeyReference s and Store ResourceIdentifier s of a CustomerDraft and a Customer . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetCompanyNameUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
companyName values of a Customer and a CustomerDraft and
returns an Optional of update action, which would contain the "setCompanyName"
UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetCustomerGroupUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
CustomerGroup references of an old Customer and new CustomerDraft . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetCustomerNumberUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer,
CustomerSyncOptions syncOptions)
Compares the
customerNumber values of a Customer and a CustomerDraft
and returns an Optional of update action, which would contain the "setCustomerNumber" UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetDateOfBirthUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
dateOfBirth values of a Customer and a CustomerDraft and
returns an Optional of update action, which would contain the "setDateOfBirth"
UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetDefaultBillingAddressUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
Customer.getDefaultBillingAddress() and CustomerDraft.getDefaultBillingAddress() . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetDefaultShippingAddressUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
Customer.getDefaultShippingAddress() and CustomerDraft.getDefaultShippingAddress() . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetExternalIdUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
externalId values of a Customer and a CustomerDraft and
returns an Optional of update action, which would contain the "setExternalId"
UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetFirstNameUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
firstName values of a Customer and a CustomerDraft and
returns an Optional of update action, which would contain the "setFirstName"
UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetLastNameUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
lastName values of a Customer and a CustomerDraft and
returns an Optional of update action, which would contain the "setLastName"
UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetLocaleUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
locale values of a Customer and a CustomerDraft and
returns an Optional of update action, which would contain the "setLocale"
UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetMiddleNameUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
middleName values of a Customer and a CustomerDraft and
returns an Optional of update action, which would contain the "setMiddleName"
UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetSalutationUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
salutation values of a Customer and a CustomerDraft and
returns an Optional of update action, which would contain the "SetSalutation"
UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetTitleUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
title values of a Customer and a CustomerDraft and returns
an Optional of update action, which would contain the "setTitle" UpdateAction . |
static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildSetVatIdUpdateAction(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the
vatId values of a Customer and a CustomerDraft and returns
an Optional of update action, which would contain the "setVatId" UpdateAction . |
static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> |
buildStoreUpdateActions(io.sphere.sdk.customers.Customer oldCustomer,
io.sphere.sdk.customers.CustomerDraft newCustomer)
Compares the stores of a
Customer and a CustomerDraft . |
public static final java.lang.String CUSTOMER_NUMBER_EXISTS_WARNING
@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildChangeEmailUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
email
values of a Customer
and a CustomerDraft
and returns
an Optional
of update action, which would contain the "changeEmail"
UpdateAction
. If both Customer
and CustomerDraft
have the same email
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new email.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetFirstNameUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
firstName
values of a Customer
and a CustomerDraft
and
returns an Optional
of update action, which would contain the "setFirstName"
UpdateAction
. If both Customer
and CustomerDraft
have the same firstName
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new first name.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetLastNameUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
lastName
values of a Customer
and a CustomerDraft
and
returns an Optional
of update action, which would contain the "setLastName"
UpdateAction
. If both Customer
and CustomerDraft
have the same lastName
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new last name.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetMiddleNameUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
middleName
values of a Customer
and a CustomerDraft
and
returns an Optional
of update action, which would contain the "setMiddleName"
UpdateAction
. If both Customer
and CustomerDraft
have the same middleName
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new middle name.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetTitleUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
title
values of a Customer
and a CustomerDraft
and returns
an Optional
of update action, which would contain the "setTitle"
UpdateAction
. If both Customer
and CustomerDraft
have the same title
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new title.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetSalutationUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
salutation
values of a Customer
and a CustomerDraft
and
returns an Optional
of update action, which would contain the "SetSalutation"
UpdateAction
. If both Customer
and CustomerDraft
have the same salutation
values, then no update action is needed and empty optional will be returned.oldCustomer
- the Customer that should be updated.newCustomer
- the Customer draft that contains the new salutation.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetCustomerNumberUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer, @Nonnull CustomerSyncOptions syncOptions)
customerNumber
values of a Customer
and a CustomerDraft
and returns an Optional
of update action, which would contain the "setCustomerNumber"
UpdateAction
. If both Customer
and CustomerDraft
have the same customerNumber
values, then no update action is needed and empty optional
will be returned.
Note: Customer number should be unique across a project. Once it's set it cannot be changed. For this case, warning callback will be triggered and an empty optional will be returned.
oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new customer number.syncOptions
- responsible for supplying the sync options to the sync utility method. It is
used for triggering the warning callback when trying to change an existing customer number.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetExternalIdUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
externalId
values of a Customer
and a CustomerDraft
and
returns an Optional
of update action, which would contain the "setExternalId"
UpdateAction
. If both Customer
and CustomerDraft
have the same externalId
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new external id.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetCompanyNameUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
companyName
values of a Customer
and a CustomerDraft
and
returns an Optional
of update action, which would contain the "setCompanyName"
UpdateAction
. If both Customer
and CustomerDraft
have the same companyName
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new company name.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetDateOfBirthUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
dateOfBirth
values of a Customer
and a CustomerDraft
and
returns an Optional
of update action, which would contain the "setDateOfBirth"
UpdateAction
. If both Customer
and CustomerDraft
have the same dateOfBirth
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new date of birth.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetVatIdUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
vatId
values of a Customer
and a CustomerDraft
and returns
an Optional
of update action, which would contain the "setVatId"
UpdateAction
. If both Customer
and CustomerDraft
have the same vatId
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new vat id.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetLocaleUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
locale
values of a Customer
and a CustomerDraft
and
returns an Optional
of update action, which would contain the "setLocale"
UpdateAction
. If both Customer
and CustomerDraft
have the same locale
values, then no update action is needed and empty optional will be returned.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft that contains the new locale.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetCustomerGroupUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
CustomerGroup
references of an old Customer
and new CustomerDraft
. If they are different - return SetCustomerGroup
update action.
If the old value is set, but the new one is empty - the command will unset the customer group.
oldCustomer
- the customer that should be updated.newCustomer
- the customer draft with new CustomerGroup
reference.SetCustomerGroup
update action.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildStoreUpdateActions(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
Customer
and a CustomerDraft
. It returns a List
of UpdateAction
<Customer
> as a result. If no update action is
needed, for example in case where both the Customer
and the CustomerDraft
have
the identical stores, an empty List
is returned.
Note: Null values of the stores are filtered out.
oldCustomer
- the customer which should be updated.newCustomer
- the customer draft where we get the new data.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveStoreUpdateActions(@Nonnull java.util.List<io.sphere.sdk.models.KeyReference<io.sphere.sdk.stores.Store>> oldStores, @Nonnull java.util.List<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.stores.Store>> newStores)
List
of Store
KeyReference
s and Store
ResourceIdentifier
s of a CustomerDraft
and a Customer
. It returns a List
of RemoveStore
update actions as a result, if the old store needs to be removed
from a customer to have the same set of stores as the new customer. If both the Customer
and the CustomerDraft
have the same set of stores, then no update actions are
needed and hence an empty List
is returned.
Note: Null values of the stores are filtered out.
oldStores
- the stores which should be updated.newStores
- the stores where we get the new store.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddStoreUpdateActions(@Nonnull java.util.List<io.sphere.sdk.models.KeyReference<io.sphere.sdk.stores.Store>> oldStores, @Nonnull java.util.List<io.sphere.sdk.models.ResourceIdentifier<io.sphere.sdk.stores.Store>> newStores)
List
of Store
KeyReference
s and Store
ResourceIdentifier
s of a CustomerDraft
and a Customer
. It returns a List
of AddStore
update actions as a result, if the old store needs to be added to a
customer to have the same set of stores as the new customer. If both the Customer
and
the CustomerDraft
have the same set of stores, then no update actions are needed and
hence an empty List
is returned.
Note: Null values of the stores are filtered out.
oldStores
- the stores which should be updated.newStores
- the stores where we get the new store.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAllAddressUpdateActions(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
Customer
and a CustomerDraft
. It returns a List
of UpdateAction
<Customer
> as a result. If both the Customer
and the CustomerDraft
have the same set of addresses, then no update actions are needed
and hence an empty List
is returned.oldCustomer
- the customer which should be updated.newCustomer
- the customer draft where we get the new data.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveAddressUpdateActions(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
List
of a CustomerDraft.getAddresses()
and a Customer.getAddresses()
. It returns a List
of RemoveAddress
update actions as
a result, if the old address needs to be removed from the oldCustomer
to have the same
set of addresses as the newCustomer
. If both the Customer
and the CustomerDraft
have the same set of addresses, then no update actions are needed and hence an
empty List
is returned.
Notes:
oldCustomer
- the customer which should be updated.newCustomer
- the customer draft where we get the new addresses.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildChangeAddressUpdateActions(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
List
of a CustomerDraft.getAddresses()
and a Customer.getAddresses()
. It returns a List
of ChangeAddress
update actions as
a result, if the old address needs to be changed/updated from the oldCustomer
to have
the same set of addresses as the newCustomer
. If both the Customer
and the
CustomerDraft
have the same set of addresses, then no update actions are needed and
hence an empty List
is returned.
Notes:
oldCustomer
- the customer which should be updated.newCustomer
- the customer draft where we get the new addresses.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddAddressUpdateActions(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
List
of a CustomerDraft.getAddresses()
and a Customer.getAddresses()
. It returns a List
of AddAddress
update actions as a
result, if the new address needs to be added to have the same set of addresses as the newCustomer
. If both the Customer
and the CustomerDraft
have the same set of
addresses, then no update actions are needed and hence an empty List
is returned.
Notes:
oldCustomer
- the customer which should be updated.newCustomer
- the customer draft where we get the new addresses.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetDefaultShippingAddressUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
Customer.getDefaultShippingAddress()
and CustomerDraft.getDefaultShippingAddress()
. If they are different - return SetDefaultShippingAddress
update action. If the old shipping address is set, but the new one
is empty - the command will unset the default shipping address.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft with new default shipping address.SetDefaultShippingAddress
update action.@Nonnull public static java.util.Optional<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildSetDefaultBillingAddressUpdateAction(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
Customer.getDefaultBillingAddress()
and CustomerDraft.getDefaultBillingAddress()
. If they are different - return SetDefaultBillingAddress
update action. If the old billing address id value is set, but the
new one is empty - the command will unset the default billing address.oldCustomer
- the customer that should be updated.newCustomer
- the customer draft with new default billing address.SetDefaultBillingAddress
update action.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddShippingAddressUpdateActions(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
List
of a Customer.getShippingAddresses()
and a CustomerDraft.getShippingAddresses()
. It returns a List
of AddShippingAddressId
update actions as a result, if the new shipping address needs to be added
to have the same set of addresses as the newCustomer
. If both the Customer
and
the CustomerDraft
have the same set of shipping addresses, then no update actions are
needed and hence an empty List
is returned.
Notes:
IllegalArgumentException
will be thrown.
oldCustomer
- the customer which should be updated.newCustomer
- the customer draft where we get the new shipping addresses.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveShippingAddressUpdateActions(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
List
of a Customer.getShippingAddresses()
and a CustomerDraft.getShippingAddresses()
. It returns a List
of RemoveShippingAddressId
update actions as a result, if the old shipping address needs to be
removed to have the same set of addresses as the newCustomer
. If both the Customer
and the CustomerDraft
have the same set of shipping addresses, then no update
actions are needed and hence an empty List
is returned.
Notes:
IllegalArgumentException
will be thrown.
oldCustomer
- the customer which should be updated.newCustomer
- the customer draft where we get the new shipping addresses.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildAddBillingAddressUpdateActions(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
List
of a Customer.getBillingAddresses()
and a CustomerDraft.getBillingAddresses()
. It returns a List
of AddBillingAddressId
update actions as a result, if the new billing address needs to be added to have the same set
of addresses as the newCustomer
. If both the Customer
and the CustomerDraft
have the same set of billing addresses, then no update actions are needed and
hence an empty List
is returned.
Notes:
IllegalArgumentException
will be thrown.
oldCustomer
- the customer which should be updated.newCustomer
- the customer draft where we get the new billing addresses.@Nonnull public static java.util.List<io.sphere.sdk.commands.UpdateAction<io.sphere.sdk.customers.Customer>> buildRemoveBillingAddressUpdateActions(@Nonnull io.sphere.sdk.customers.Customer oldCustomer, @Nonnull io.sphere.sdk.customers.CustomerDraft newCustomer)
List
of a Customer.getBillingAddresses()
and a CustomerDraft.getBillingAddresses()
. It returns a List
of RemoveBillingAddressId
update actions as a result, if the old billing address needs to be
removed to have the same set of addresses as the newCustomer
. If both the Customer
and the CustomerDraft
have the same set of billing addresses, then no update
actions are needed and hence an empty List
is returned.
Notes:
IllegalArgumentException
will be thrown.
oldCustomer
- the customer which should be updated.newCustomer
- the customer draft where we get the new shipping addresses.