ShippingProfileService
Provides layer to manipulate profiles.
Implements
constructor
Parameters
__namedParameters
InjectedDependenciesRequiredProperties
manager_
EntityManagerRequiredtransactionManager_
undefined | EntityManagerRequired__container__
anyRequiredfeatureFlagRouter_
FlagRouterRequired__configModule__
Record<string, unknown>__moduleDeclaration__
Record<string, unknown>Accessors
activeManager_
Returns
EntityManager
EntityManagerRequiredMethods
withTransaction
Parameters
transactionManager
EntityManagerReturns
this
thisRequiredshouldRetryTransaction_
Parameters
err
Record<string, unknown> | objectRequiredReturns
boolean
booleanRequiredatomicPhase_
Wraps some work within a transactional block. If the service already has a transaction manager attached this will be reused, otherwise a new transaction manager is created.
Type Parameters
TResult
objectRequiredTError
objectRequiredParameters
work
(transactionManager: EntityManager) => Promise<TResult>RequiredisolationOrErrorHandler
IsolationLevel | (error: TError) => Promise<void | TResult>maybeErrorHandlerOrDontFail
(error: TError) => Promise<void | TResult>Returns
Promise
Promise<TResult>Requiredlist
Parameters
Default: {}
Returns
getMapProfileIdsByProductIds
Parameters
productIds
string[]RequiredReturns
Promise
Promise<Map<string, string>>Requiredretrieve
Gets a profile by id. Throws in case of DB Error and if profile was not found.
Parameters
profileId
stringRequiredDefault: {}
Returns
retrieveForProducts
Parameters
productIds
string | string[]RequiredReturns
Promise
Promise<object>RequiredretrieveDefault
Returns
createDefault
Creates a default shipping profile, if this does not already exist.
Returns
retrieveGiftCardDefault
Retrieves the default gift card profile
Returns
createGiftCardDefault
Creates a default shipping profile, for gift cards if unless it already exists.
Returns
create
Creates a new shipping profile.
Parameters
profile
CreateShippingProfileRequiredReturns
update
Updates a profile. Metadata updates and product updates should use
dedicated methods, e.g. setMetadata
, addProduct
, etc. The function
will throw errors if metadata or product updates are attempted.
Parameters
profileId
stringRequiredupdate
UpdateShippingProfileRequiredReturns
delete
Deletes a profile with a given profile id.
Parameters
profileId
stringRequiredReturns
Promise
Promise<void>RequiredaddProduct
Parameters
profileId
stringRequiredproductId
string | string[]RequiredReturns
Deprecated
use addProducts instead
addProducts
Adds a product or an array of products to the profile.
Parameters
profileId
stringRequiredproductId
string | string[]RequiredReturns
removeProducts
Removes a product or an array of products from the profile.
Parameters
profileId
null | stringRequiredproductId
string | string[]RequiredReturns
addShippingOption
Adds a shipping option to the profile. The shipping option can be used to fulfill the products in the products field.
Parameters
profileId
stringRequiredoptionId
string | string[]RequiredReturns
fetchCartOptions
Finds all the shipping profiles that cover the products in a cart, and validates all options that are available for the cart.
Parameters
cart
anyRequiredReturns
getProfilesInCart
Returns a list of all the productIds in the cart.
Parameters
Returns
Promise
Promise<string[]>Required