Poq.SDK.Node

Home > @poq/sdk-sfcc > ICustomersClient

ICustomersClient interface

Signature:

export interface ICustomersClient 

Methods

Method Description
deleteCustomersAuth(authorization, options) Invalidates the JWT provided in the header.
deleteCustomersByIDAddressesByID(customerId, addressName, options) Deletes a customers address by address name.
deleteCustomersByIDPaymentInstrumentsByID(customerId, paymentInstrumentId, options) Deletes a customers payment instrument.
deleteCustomersByIDProductListsByID(customerId, listId, options) Deletes a customer product list.
deleteCustomersByIDProductListsByIDItemsByID(customerId, listId, itemId, options) Removes an item from a customer product list.
getCustomersByID(customerId, expand, options) Gets a customer.
getCustomersByIDAddresses(customerId, start, count, options) Returns a sorted pageable list of all customer addresses in the address book. The default page size is 10 customer addresses. The addresses are sorted so that the preferred address is always sorted first. The remaining addresses are sorted alphabetically by ID. When the customer cannot be found CustomerNotFoundException is thrown in a case of an agent but an empty result list is returned in a case of JWT.
getCustomersByIDAddressesByID(customerId, addressName, options) Retrieves a customers address by address name.
getCustomersByIDBaskets(customerId, options) Gets the baskets of a customer.
getCustomersByIDOrders(customerId, start, count, crossSites, from, until, status, options) Returns a pageable list of all customers orders. The default page size is 10.
getCustomersByIDPaymentInstruments(customerId, paymentMethodId, options) Gets customer payment instruments for an customer. Can be limited to a specific payment method by providing query parameter payment_method_id. When the customer cannot be found CustomerNotFoundException is thrown in a case of an agent but an empty result list is returned in a case of JWT.
getCustomersByIDPaymentInstrumentsByID(customerId, paymentInstrumentId, options) Retrieves a customers payment instrument by its id.
getCustomersByIDProductLists(customerId, expand, start, count, options) Returns all customer product lists in a paginated manner.
getCustomersByIDProductListsByID(customerId, listId, expand, options) Returns a customer product list of the given customer.
getCustomersByIDProductListsByIDItems(customerId, listId, expand, start, count, options) Returns a pageable list of all items of a customers product list. The default page size is 10.
getCustomersByIDProductListsByIDItemsByID(customerId, listId, itemId, expand, options) Returns an item of a customer product list.
getCustomersByIDProductListsByIDItemsByIDPurchases(customerId, listId, itemId, options) Returns a list of all purchases of an item from a customers product list.
getCustomersByIDProductListsByIDItemsByIDPurchasesByID(customerId, listId, itemId, purchaseId, options) Returns a purchase of an item from a customers product list.
getCustomersExtProfile(externalId, authenticationProviderId, options) Gets the customerExtProfile based on the passed in query parameters of external_id and authentication_provider_id
patchCustomersByID(customerId, body, options) Updates a customer. This endpoint cant update login credentials.
patchCustomersByIDAddressesByID(customerId, addressName, body, options) Updates a customers address by address name.
patchCustomersByIDProductListsByID(customerId, listId, body, options) Changes a product list. Changeable properties are the name, description and if the list is public.
patchCustomersByIDProductListsByIDItemsByID(customerId, listId, itemId, body, options) Updates an item of a customers product list. Considered values from the request body are: priority: This is the priority of the customers product list item. public: This is the flag whether the customers product list item is public. quantity: used for product item type only. This is the quantity of the customers product list item. custom properties in the form c_<CUSTOM_NAME>: the custom property must correspond to a custom attribute (<CUSTOM_NAME>) defined for ProductListItem. The value of this property must be valid for the type of custom attribute defined for ProductListItem.
patchCustomersByIDProductListsByIDItemsByIDPurchasesByID(customerId, listId, itemId, purchaseId, body, options) Updates a purchase of an item from a customers product list. Considered values from the request body are: custom properties in the form c_<CUSTOM_NAME>: the custom property must correspond to a custom attribute (<CUSTOM_NAME>) defined for ProductListItemPurchase. The value of this property must be valid for the type of custom attribute defined for ProductListItemPurchase.
postCustomers(body, options) Registers a customer. You must specify the login credentials, last name, and email address. This method ignores all other data, which can only be set for an existing customer. To set other values, make calls after the customer is created. When using OAuth, dont include the password in the request. In this case, including the password throws an InvalidPasswordException. When using JWT, the password is required. Also returns the hashedLoginId for Einstein use cases.
postCustomersAuth(body, authorization, options) Obtains a new JWT (JSON Web Token) for a guest or registered customer. Tokens are returned as a HTTP Authorization:Bearer response header entry. These kinds of request are supported, as specified by the type: Type guest - creates a new guest (non-authenticated) customer and returns a token for the customer. Type credentials - authenticates credentials passed in the HTTP Authorization:Basic request header, returning a token for a successfully authenticated customer, otherwise it throws an AuthenticationFailedException. Type session - authenticates the customer (anonymous or registered) based on the dwsid and dwsecuretoken cookies. It returns a token for a successfully authenticated customer, otherwise it throws an AuthenticationFailedException. Type refresh - examines the token passed in the HTTP Authorization:Bearer request header and when valid returns a new token with an updated expiry time. For a request of type credentials: Updates profile attributes for the customer (for example, “last-visited). Handles the maximum number of failed login attempts. For a request of type session: The session and corresponding dwsecuretoken must be active and valid. An expired session cant be used. The dwsecuretoken cookie must have been used for at least one previous HTTPS request with the same dwsid cookie. Does not touch profile attributes for the registered customer (for example, “last-visited), since this is not a real login. Returns different tokens for multiple requests with the same session id. Means, there should be only one call per session. About JWT The token contains 3 sections: the header section (specifies token type and algorithm used) the payload section (contains customer information, client id, issue and expiration time) finally the signature section records the token signature. A token is created and returned to the client whenever a registered customer logs in (type “credentials) or a guest customer requests it (type “guest). The token is returned in the response header as Authorization: Bearer –token– The client has to include the token in the request header as Authorization: Bearer –token– in any follow up request. The server declines any follow up requests without a token or which cannot be verified based on the token signature or expiration time. A token nearing its expiration time should be exchanged for a new one (type “refresh). See “API Usage > JWT” for more details on using JWT as an authentication mechanism.
postCustomersAuthTrustedsystem(body, options) Obtain the JWTs for registered customers whose credentials are stored using a third party system. Accepts login_id and client_id Returns a customer object in the response body, and the JWT generated against the client_id in the response header. In addition, the returned response will include the hashedLoginId field for Einstein use.
postCustomersByIDAddresses(customerId, body, options) Creates a new address with the given name for the given customer.
postCustomersByIDAuth(customerId, options) Obtains a new agent on behalf token for a registered customer. Token is returned as a HTTP Authorization:Bearer response header entry. A token is created and returned to the client whenever an agent with Create_Order_On_Behalf_Of permission calls the resource for a registered customer. The token is returned in the response header as Authorization: Bearer –token–. The client has to include the token in the request header as Authorization: Bearer –token– in any follow up request, the agent will do on behalf of the customer. About the order on behalf token The token contains 3 sections: the header section (specifies token type and algorithm used) the payload section (contains customer information, client id, issue and expiration time) finally the signature section records the token signature. A token nearing its expiration time should be exchanged for a new one by calling this resource once more.
postCustomersByIDPasswordReset(customerId, options) Starts a password reset process. The user must be an agent logged in on behalf of a customer. Generates a password reset token and passes it with the specified customer as the path parameter to the dw.ocapi.shop.customer.password_reset.afterPOST hook. The hook can use the provided reset token to perform actions such as sending a reset email.
postCustomersByIDPaymentInstruments(customerId, body, options) Adds a payment instrument to a customer. Note that it cant update the read-only credit_card_token on a payment_card record.
postCustomersByIDProductLists(customerId, body, options) Creates a customer product list.
postCustomersByIDProductListsByIDItems(customerId, listId, body, options) Adds an item to the customers product list. Considered values from the request body are: type: a valid type, mandatory. This is the type of the item to be added to the customers product list. priority: This is the priority of the item to be added to the customers product list. public: This is the flag whether the item to be added to the customers product list is public. product_id: a valid product id, used for product item type only. This is the id (sku) of the product related to the item to be added to the customers product list. It is mandatory for product item type and it must be a valid product id, otherwise ProductListProductIdMissingException or ProductListProductNotFoundException will be thrown. quantity: used for product item type only. This is the quantity of the item to be added to the customers product list. custom properties in the form c_<CUSTOM_NAME>: the custom property must correspond to a custom attribute (<CUSTOM_NAME>) defined for ProductListItem. The value of this property must be valid for the type of custom attribute defined for ProductListItem.
postCustomersByIDProductListsByIDItemsByIDPurchases(customerId, listId, itemId, body, options) Adds a purchase to an item in the customers product list. Considered values from the request body are: purchaser_name: name of the purchaser, mandatory. This is the full name of the purchaser of this product list item. quantity: amount purchased, mandatory. This is the quantity of the items purchased from the product list. custom properties in the form c_<CUSTOM_NAME>: the custom property must correspond to a custom attribute (<CUSTOM_NAME>) defined for ProductListItemPurchase. The value of this property must be valid for the type of custom attribute defined for ProductListItemPurchase.
postCustomersExtProfile(body, options) Register a customerExtProfile. The mandatory data are the external_id and authentication_provider_id. While using JWT the guest JWT needs to be used. This will not be supporting hooks
postCustomersPasswordActionsCreateResetToken(body, options) Returns a reset password token for the passed in customers login that will be used with the customers/reset_password endpoint to change the customers password. This differs from the customers/password_reset endpoint as it does not require or allow before or after hook processing.
postCustomersPasswordActionsReset(body, options) Changes the customers password to the new password value in the call using the reset password token that was returned from the customers/reset_password_token endpoint. This differs from the customers/password_reset endpoint as it does not require or allow before or after hook processing.
postCustomersPasswordReset(body, options) First the beforePOST hook is called. After that the validation of the customer information provided in the the password reset document is performed. Then a password reset token is generated and together with the resolved customer is passed to a afterPOST hook. The customer resolution is based on the password reset request type. Both hooks are performed in a single transaction. Currently the resolution can be done by email or login. In case of an email the password reset hook is only executed if one and only one customer has been identified for that email. In the case that more than one customers have been identified for the provided email the resource does nothing.
putCustomersByIDPassword(customerId, body, options) Updates a customers password. The default implementation updates the password in the resource. Versions prior to 21.3 updated the password in the afterPUT hook, which was incompatible with the Mercury API. Starting in version 21.3, the afterPUT_v2 hook replaces the afterPUT hook.