Hook Method Details

This document lists all available SCAPI hooks with method details.

For custom property type details, see Custom Properties.

Authentication hooks for the Shopper API.


dw.ocapi.shop.auth.afterPOST

POST /customers/auth

Method details

afterPOST (customer : dw.customer.Customer, authRequestType : dw.value.EnumValue) : dw.system.Status

The function is called after the customer has been authenticated.

Parameters:
customer - the authenticated customer
authRequestType - does the request specify a guest, login or refresh authentication
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.auth.beforePOST

POST /customers/auth

Method details

beforePOST (authorizationHeader : String, authRequestType : dw.value.EnumValue) : dw.system.Status

The function is called before the customer has been authenticated.

Parameters:
authorizationHeader - the authorization header. Differs depending on the type:
  • guest - no content relevant to the authentication.
  • credentials - Base64 encoded username and password. For example Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=. It is possible to extract the username or password: var credentials = authHeader.substr(6); // cut out Basic var base64decoded : String = StringUtils.decodeBase64(credentials, "UTF-8"); var userName : String = base64decoded.split(":")[0]; var password : String = base64decoded.split(":")[1];
  • refresh - A refresh token, for example Authorization: Bearer XXXXXXXXXXXXXXXXXXXXXXX
  • session - no content relevant to the authentication. Authentication based on cookies.
authRequestType - does the request specify a guest, login or refresh authentication
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.auth.modifyPOSTResponse

POST /customers/auth

Method details

modifyPOSTResponse (customer : dw.customer.Customer, customerResponse : Customer, authRequestType : dw.value.EnumValue) : dw.system.Status

Parameters:
customer - the auth customer
customerResponse - customer response object
authRequestType - auth request type enum
Returns:
a non-null Status ends the hook execution

Basket hooks for the Shopper API.


dw.ocapi.baskets.actions.afterMerge

POST /baskets/actions/merge

Method details

afterMerge (basket : dw.order.Basket) : dw.system.Status

The function is called after the basket is merged.

Parameters:
destinationBasket - the registered user basket into which the guest basket was merged.
Returns:
a non-null Status ends the hook execution

dw.ocapi.baskets.actions.afterTransfer

POST /baskets/actions/transfer

Method details

afterTransfer (basket : dw.order.Basket) : dw.system.Status

The function is called after the basket is transferred.

Parameters:
transferredBasket - the basket that was transferred to the registered user.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.afterDELETE

DELETE /baskets/{basket_id}

Method details

afterDELETE (basketId : String) : dw.system.Status

The function is called after removing a basket.

Parameters:
basketId - the identifier of the removed basket
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.afterPATCH

PATCH /baskets/{basket_id}

Method details

afterPATCH (basket : dw.order.Basket, basketInput : Basket) : dw.system.Status

The function is called after updating of the basket.

Parameters:
basket - the basket that was updated
basketInput - the basket delta containing the desired changes
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.afterPOST

POST /baskets

Method details

afterPOST (basket : dw.order.Basket) : dw.system.Status

The function is called after the basket was created.

Parameters:
basket - the created basket
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.beforeDELETE

DELETE /baskets/{basket_id}

Method details

beforeDELETE (basket : dw.order.Basket) : dw.system.Status

The function is called before removing a basket.

Parameters:
basket - the basket to be removed
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.beforeGET

GET /baskets/{basket_id}

Method details

beforeGET (basketId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
basketId - the basket id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.beforePATCH

PATCH /baskets/{basket_id}

Method details

beforePATCH (basket : dw.order.Basket, basketInput : Basket) : dw.system.Status

The function is called before updating of the basket.

Parameters:
basket - the basket to be updated
basketInput - the basket delta containing the desired changes
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.beforePOST_v2

POST /baskets

Method details

beforePOST_v2 (basketRequest : Basket) : dw.system.Status

The function is called before the request will be processed.

Parameters:
basketRequest - the basket request
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.billing_address.afterPUT

PUT /baskets/{basket_id}/billing_address

Method details

afterPUT (basket : dw.order.Basket, billingAddress : OrderAddress) : dw.system.Status

The function is called after setting of the billing address to the basket.

Parameters:
basket - the basket based on which the order is created
billingAddress - the billing address that was set to the basket
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.billing_address.beforePUT

PUT /baskets/{basket_id}/billing_address

Method details

beforePUT (basket : dw.order.Basket, billingAddress : OrderAddress) : dw.system.Status

The function is called before setting of the billing address to the basket.

Parameters:
basket - the basket based on which the order is created
billingAddress - the billing address to be set to the basket
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.billing_address.modifyPUTResponse

PUT /baskets/{basket_id}/billing_address

Method details

modifyPUTResponse (basket : dw.order.Basket, basketResponse : Basket, addressRequest : OrderAddress) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
addressRequest - address request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.coupon.afterDELETE

DELETE /baskets/{basket_id}/coupons/{coupon_item_id}

Method details

afterDELETE (basket : dw.order.Basket, couponItemID : String) : dw.system.Status

The function is called after removing a coupon from a basket.

Parameters:
basket - the basket the coupon get removed from
couponItemID - the coupon information
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.coupon.afterPOST

POST /baskets/{basket_id}/coupons

Method details

afterPOST (basket : dw.order.Basket, couponItem : Basket, addressRequest : CouponItem) : dw.system.Status

The function is called after adding a coupon to a basket.

Parameters:
basket - the basket the coupon get added to
couponItem - the coupon information
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.coupon.beforeDELETE

DELETE /baskets/{basket_id}/coupons/{coupon_item_id}

Method details

beforeDELETE (basket : dw.order.Basket, couponItemID : String) : dw.system.Status

The function is called before removing a coupon from a basket.

Parameters:
basket - the basket the coupon get removed from
couponItemID - the coupon information
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.coupon.beforePOST

POST /baskets/{basket_id}/coupons

Method details

beforePOST (basket : dw.order.Basket, couponItem : Basket, addressRequest : CouponItem) : dw.system.Status

The function is called before adding a coupon to a basket.

Parameters:
basket - the basket the coupon get added to
couponItem - the coupon information
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.coupon.modifyDELETEResponse

DELETE /baskets/{basket_id}/coupons/{coupon_item_id}

Method details

modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, couponItemId : String) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
couponItemId - coupon item id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.coupon.modifyPOSTResponse

POST /baskets/{basket_id}/coupons

Method details

modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, couponRequest : Basket, addressRequest : CouponItem) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
couponRequest - coupon request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.customer.afterPUT

PUT /baskets/{basket_id}/customer

Method details

afterPUT (basket : dw.order.Basket, customerInfo : CustomerInfo) : dw.system.Status

The function is called after setting of customer information for the basket.

Parameters:
basket - the basket based on which the order is created
customerInfo - the customer information that were set to the basket
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.customer.beforePUT

PUT /baskets/{basket_id}/customer

Method details

beforePUT (basket : dw.order.Basket, customerInfo : CustomerInfo) : dw.system.Status

The function is called before setting of customer information for the basket.

Parameters:
basket - the basket based on which the order is created
customerInfo - the customer information to be set to the basket
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.customer.modifyPUTResponse

PUT /baskets/{basket_id}/customer

Method details

modifyPUTResponse (basket : dw.order.Basket, basketResponse : Basket, customerRequest : CustomerInfo) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
customerRequest - customer request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.gift_certificate_item.afterDELETE

DELETE /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}

Method details

afterDELETE (basket : dw.order.Basket, giftCertificateItemId : String) : dw.system.Status

The function is called after deleting a gift certificate item from a basket.

Parameters:
basket - the basket based on which the order is created
giftCertificateItemId - the id of the deleted gift certificate item
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.gift_certificate_item.afterPATCH

PATCH /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}

Method details

afterPATCH (basket : dw.order.Basket, giftCertificateItemId : String, item : GiftCertificateItem) : dw.system.Status

The function is called after updating a gift certificate item of a basket.

Parameters:
basket - the basket based on which the order is created
giftCertificateItemId - the id of the updated gift certificate item
item - the new gift certificate item data
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.gift_certificate_item.afterPOST

POST /baskets/{basket_id}/gift_certificate_items

Method details

afterPOST (basket : dw.order.Basket, item : GiftCertificateItem) : dw.system.Status

The function is called after adding a gift certificate item to a basket.

Parameters:
basket - the basket based on which the order is created
item - the gift certificate item to add
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.gift_certificate_item.beforeDELETE

DELETE /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}

Method details

beforeDELETE (basket : dw.order.Basket, giftCertificateItemId : String) : dw.system.Status

The function is called before deleting a gift certificate item from a basket.

Parameters:
basket - the basket based on which the order is created
giftCertificateItemId - the id of the gift certificate item to be deleted
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.gift_certificate_item.beforePATCH

PATCH /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}

Method details

beforePATCH (basket : dw.order.Basket, giftCertificateItemId : String, item : GiftCertificateItem) : dw.system.Status

The function is called before updating a gift certificate item of a basket.

Parameters:
basket - the basket based on which the order is created
giftCertificateItemId - the id of the gift certificate item to be updated
item - the new gift certificate item data
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.gift_certificate_item.beforePOST

POST /baskets/{basket_id}/gift_certificate_items

Method details

beforePOST (basket : dw.order.Basket, item : GiftCertificateItem) : dw.system.Status

The function is called before adding a gift certificate item to a basket.

Parameters:
basket - the basket based on which the order is created
item - the gift certificate item to add
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.gift_certificate_item.modifyDELETEResponse

DELETE /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}

Method details

modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, giftCertificateItemId : String) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
giftCertificateItemId - the id of the deleted gift certificate item
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.gift_certificate_item.modifyPATCHResponse

PATCH /baskets/{basket_id}/gift_certificate_items/{gift_certificate_item_id}

Method details

modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket, giftCertificateItemId : String) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
giftCertificateItemId - the id of the updated gift certificate item
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.gift_certificate_item.modifyPOSTResponse

POST /baskets/{basket_id}/gift_certificate_items

Method details

modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, certificateItemRequest : GiftCertificateItem) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
certificateItemRequest - certificateItem request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.item.afterDELETE

DELETE /baskets/{basket_id}/items/{item_id}

Method details

afterDELETE (basket : dw.order.Basket, productItemId : String) : dw.system.Status

The function is called after a basket item is removed.

Parameters:
basket - the basket based on which the order is created
productItemId - the id of the removed product item
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.item.afterPATCH

PATCH /baskets/{basket_id}/items/{item_id}

Method details

afterPATCH (basket : dw.order.Basket, item : ProductItem) : dw.system.Status

The function is called after updating of the basket's item.

Parameters:
basket - the basket based on which the order is created
item - the product item delta containing the desired changes to the product item
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.item.beforeDELETE

DELETE /baskets/{basket_id}/items/{item_id}

Method details

beforeDELETE (basket : dw.order.Basket, productItemId : String) : dw.system.Status

The function is called before a basket item is removed.

Parameters:
basket - the basket based on which the order is created
productItemId - the id of the product item to be removed
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.item.beforePATCH

PATCH /baskets/{basket_id}/items/{item_id}

Method details

beforePATCH (basket : dw.order.Basket, item : ProductItem) : dw.system.Status

The function is called before updating of the basket's item.

Parameters:
basket - the basket based on which the order is created
item - the product item delta containing the desired changes to the product item
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.item.modifyDELETEResponse

DELETE /baskets/{basket_id}/items/{item_id}

Method details

modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, productItemId : String) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
productItemId - productItemId request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.item.modifyPATCHResponse

PATCH /baskets/{basket_id}/items/{item_id}

Method details

modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket, productItemId : String) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
productItemId - productItemId request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.items.afterPOST

POST /baskets/{basket_id}/items

Method details

afterPOST (basket : dw.order.Basket, items : ProductItem) : dw.system.Status

Parameters:
basket - the target basket
items - productItems array of product items
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.items.beforePOST

POST /baskets/{basket_id}/items

Method details

beforePOST (basket : dw.order.Basket, items : ProductItem) : dw.system.Status

Parameters:
basket - the target basket
items - productItems array of product items
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.items.modifyPOSTResponse

POST /baskets/{basket_id}/items

Method details

modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, productItems : ProductItem) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
productItems - productItems array of product items
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.modifyGETResponse

GET /baskets/{basket_id}

Method details

modifyGETResponse (basket : dw.order.Basket, basketResponse : Basket) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.modifyPATCHResponse

PATCH /baskets/{basket_id}

Method details

modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.modifyPOSTResponse

POST /baskets

Method details

modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket) : dw.system.Status

Parameters:
basket - the created basket
basketResponse - basket response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_instrument.afterDELETE

DELETE /baskets/{basket_id}/payment_instruments/{payment_instrument_id}

Method details

afterDELETE (basket : dw.order.Basket) : dw.system.Status

It is called after the order payment instrument is removed from the basket.

Parameters:
basket - the basket the payment instrument was removed from
paymentInstrument - the payment instrument to be deleted
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_instrument.afterPATCH

PATCH /baskets/{basket_id}/payment_instruments/{payment_instrument_id}

Method details

afterPATCH (basket : dw.order.Basket, paymentInstrument : dw.order.OrderPaymentInstrument, paymentInstrumentRequest : BasketPaymentInstrumentRequest) : dw.system.Status

The function is called after updating a payment instrument of a basket.

Parameters:
basket - the basket based on which the order is created
paymentInstrument - the updated payment instrument
paymentInstrumentRequest - the new payment instrument data
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_instrument.afterPOST

POST /baskets/{basket_id}/payment_instruments

Method details

afterPOST (basket : dw.order.Basket, paymentInstrument : BasketPaymentInstrumentRequest) : dw.system.Status

The function is called after payment instrument adding to a basket.

Parameters:
basket - the basket based on which the order is created
paymentInstrument - the payment instrument added to the basket
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_instrument.beforeDELETE

DELETE /baskets/{basket_id}/payment_instruments/{payment_instrument_id}

Method details

beforeDELETE (basket : dw.order.Basket, delete : dw.order.OrderPaymentInstrument) : dw.system.Status

It is called before the order payment instrument is removed from the basket.

Parameters:
basket - the basket to remove the payment instrument from
delete - the order payment instrument document.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_instrument.beforePATCH

PATCH /baskets/{basket_id}/payment_instruments/{payment_instrument_id}

Method details

beforePATCH (basket : dw.order.Basket, paymentInstrument : dw.order.OrderPaymentInstrument, newPaymentInstrument : BasketPaymentInstrumentRequest) : dw.system.Status

The function is called before updating a payment instrument of a basket.

Parameters:
basket - the basket based on which the order is created
paymentInstrument - the payment instrument to be updated
newPaymentInstrument - the new payment instrument data
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_instrument.beforePOST

POST /baskets/{basket_id}/payment_instruments

Method details

beforePOST (basket : dw.order.Basket, paymentInstrument : BasketPaymentInstrumentRequest) : dw.system.Status

The function is called before payment instrument adding to a basket.

Parameters:
basket - the basket based on which the order is created
paymentInstrument - the payment instrument to be added to the basket
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_instrument.modifyDELETEResponse

DELETE /baskets/{basket_id}/payment_instruments/{payment_instrument_id}

Method details

modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, paymentInstrumentId : String) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
paymentInstrumentRequest - payment instrument id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_instrument.modifyPATCHResponse

PATCH /baskets/{basket_id}/payment_instruments/{payment_instrument_id}

Method details

modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket, paymentInstrumentId : String) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
paymentInstrumentRequest - payment instrument id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_instrument.modifyPOSTResponse

POST /baskets/{basket_id}/payment_instruments

Method details

modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, paymentInstrumentRequest : BasketPaymentInstrumentRequest) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
paymentInstrumentRequest - payment instrument request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_methods.afterGET

GET /baskets/{basket_id}/payment_methods

Method details

afterGET (basket : dw.order.Basket, paymentMethods : PaymentMethodResult) : dw.system.Status

Called before returning the list of available payment methods to the customer. Allowing modifications of the result.

Parameters:
basket - the basket
paymentMethods - the available payment methods
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_methods.beforeGET

GET /baskets/{basket_id}/payment_methods

Method details

beforeGET (basketId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
basketId - the basket id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.payment_methods.modifyGETResponse_v2

GET /baskets/{basket_id}/payment_methods

Method details

modifyGETResponse_v2 (basket : dw.order.Basket, paymentMethodResultResponse : PaymentMethodResult) : dw.system.Status

Parameters:
basket - the basket the payment method result retrieved for.
paymentMethodResultResponse - paymentMethodResult response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.afterDELETE

DELETE /baskets/{basket_id}/shipments/{shipment_id}

Method details

afterDELETE (basket : dw.order.Basket, shipmentId : String) : dw.system.Status

Called after the basket's shipment was removed.

Parameters:
basket - the basket that was updated
shipmentId - the id of the deleted shipment
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.afterPATCH

PATCH /baskets/{basket_id}/shipments/{shipment_id}

Method details

afterPATCH (basket : dw.order.Basket, shipment : dw.order.Shipment, shipmentInfo : Shipment) : dw.system.Status

The function is called after patching of a shipment for a basket.

Parameters:
basket - the basket based on which the shipment was changed
shipment - the shipment that has been updated
shipmentInfo - the shipment information for the shipment update
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.afterPOST

POST /baskets/{basket_id}/shipments

Method details

afterPOST (basket : dw.order.Basket, shipment : Shipment) : dw.system.Status

The function is called after the creation of a shipment for a basket.

Parameters:
basket - the basket based on which the shipment was created
shipment - the shipment information for the shipment creation
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.beforeDELETE

DELETE /baskets/{basket_id}/shipments/{shipment_id}

Method details

beforeDELETE (basket : dw.order.Basket, shipment : dw.order.Shipment) : dw.system.Status

Called before the basket's shipment is removed.

Parameters:
basket - the basket to be updated
shipment - the shipment to be deleted
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.beforePATCH

PATCH /baskets/{basket_id}/shipments/{shipment_id}

Method details

beforePATCH (basket : dw.order.Basket, shipment : dw.order.Shipment, shipmentInfo : Shipment) : dw.system.Status

The function is called before changing of a shipment for a basket.

Parameters:
basket - the basket based on which the shipment will be updated
shipment - the current shipment to be updated
shipmentInfo - the shipment information for the shipment update (update data)
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.beforePOST

POST /baskets/{basket_id}/shipments

Method details

beforePOST (basket : dw.order.Basket, shipment : Shipment) : dw.system.Status

The function is called before the creation of a shipment for a basket.

Parameters:
basket - the basket based on which the shipment will be created
shipment - the shipment information for the shipment creation
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.modifyDELETEResponse

DELETE /baskets/{basket_id}/shipments/{shipment_id}

Method details

modifyDELETEResponse (basket : dw.order.Basket, basketResponse : Basket, shipmentId : String) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
shipmentId - shipment id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.modifyPATCHResponse

PATCH /baskets/{basket_id}/shipments/{shipment_id}

Method details

modifyPATCHResponse (basket : dw.order.Basket, basketResponse : Basket, shipmentId : String) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
shipmentId - shipment id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.modifyPOSTResponse

POST /baskets/{basket_id}/shipments

Method details

modifyPOSTResponse (basket : dw.order.Basket, basketResponse : Basket, shipmentRequest : Shipment) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
shipmentRequest - shipment request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.shipping_address.afterPUT

PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_address

Method details

afterPUT (basket : dw.order.Basket, shipment : dw.order.Shipment, shippingAddress : OrderAddress) : dw.system.Status

The function is called after setting of the shipping address to a certain shipment of the basket.

Parameters:
basket - the basket based on which the order is created
shipment - the shipment information for the shipment creation
shippingAddress - the shipping address that was set to the shipment
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.shipping_address.beforePUT

PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_address

Method details

beforePUT (basket : dw.order.Basket, shipment : dw.order.Shipment, shippingAddress : OrderAddress) : dw.system.Status

The function is called before setting of the shipping address to a certain shipment of the basket.

Parameters:
basket - the basket based on which the order is created
shipment - the shipment information for the shipment creation
shippingAddress - the shipping address to be set to the shipment
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.shipping_address.modifyPUTResponse

PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_address

Method details

modifyPUTResponse (basket : dw.order.Basket, basketResponse : Basket, orderAddressRequest : OrderAddress) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
orderAddressRequest - order address request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.shipping_method.afterPUT

PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_method

Method details

afterPUT (basket : dw.order.Basket, shipment : dw.order.Shipment, shippingMethod : ShippingMethod) : dw.system.Status

The function is called after setting of the shipping method to a certain shipment of the basket.

Parameters:
basket - the basket based on which the order is created
shipment - the shipment information for the shipment creation
shippingMethod - the shipping method that was set to the shipment
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.shipping_method.beforePUT

PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_method

Method details

beforePUT (basket : dw.order.Basket, shipment : dw.order.Shipment, shippingMethod : ShippingMethod) : dw.system.Status

The function is called before setting of the shipping method to a certain shipment of the basket.

Parameters:
basket - the basket based on which the order is created
shipment - the shipment information for the shipment creation
shippingMethod - the shipping method to be set to the shipment
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipment.shipping_method.modifyPUTResponse

PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_method

Method details

modifyPUTResponse (basket : dw.order.Basket, basketResponse : Basket, shippingMethodRequest : ShippingMethod) : dw.system.Status

Parameters:
basket - the target basket
basketResponse - basket response object
shippingMethodRequest - shipping method request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipments.shipping_methods.beforeGET

GET /baskets/{basket_id}/shipments/{shipment_id}/shipping_methods

Method details

beforeGET (basketId : String, shipmentId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
basketId - the target basket id
shipmentId - the shipment id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.shipments.shipping_methods.modifyGETResponse_v2

GET /baskets/{basket_id}/shipments/{shipment_id}/shipping_methods

Method details

modifyGETResponse_v2 (shipment : dw.order.Shipment, shippingMethodResult : ShippingMethodResult) : dw.system.Status

Parameters:
shipment - the shipment the shipping methods result retrieved for.
shippingMethodResult - shipping method result object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

DELETE /baskets/{basket_id}/coupons/{coupon_item_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

DELETE /baskets/{basket_id}/items/{item_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

DELETE /baskets/{basket_id}/notes/{note_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

DELETE /baskets/{basket_id}/payment_instruments/{payment_instrument_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

DELETE /baskets/{basket_id}/price_adjustments/{price_adjustment_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

DELETE /baskets/{basket_id}/shipments/{shipment_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

GET /baskets/{basket_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

PATCH /baskets/{basket_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

PATCH /baskets/{basket_id}/items/{item_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

PATCH /baskets/{basket_id}/payment_instruments/{payment_instrument_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

PATCH /baskets/{basket_id}/shipments/{shipment_id}

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

POST /baskets

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

POST /baskets/{basket_id}/coupons

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

POST /baskets/{basket_id}/gift_certificate_items

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

POST /baskets/{basket_id}/items

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

POST /baskets/{basket_id}/notes

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

POST /baskets/{basket_id}/payment_instruments

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

POST /baskets/{basket_id}/price_adjustments

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

POST /baskets/{basket_id}/shipments

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

POST /orders

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

PUT /baskets/{basket_id}/billing_address

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

PUT /baskets/{basket_id}/customer

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_address

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.basket.validateBasket

PUT /baskets/{basket_id}/shipments/{shipment_id}/shipping_method

Method details

validateBasket (basketResponse : Basket, duringSubmit : boolean) : dw.system.Status

Allows the addition of custom flashes or removal of internal flashes. The presence of a flash indicates that the basket cannot yet be submitted. Parameter duringSubmit indicates the current call is during the basket submit process. Default implementation returns ERROR if duringSubmit and any flash exists.

Example showing addition, listing, and removal of flashes:

Parameters:
basketResponse - the basket response to be validated, before any OCAPI property selection is applied
duringSubmit - should the basket be checked for submit
Returns:
a non-null Status ends the hook execution

Category hooks for the Shopper API.


dw.ocapi.shop.category.beforeGET

GET /categories/{id}

Method details

beforeGET (categoryId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
categoryId - the id of the category
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.category.modifyGETResponse

GET /categories/{id}

Method details

modifyGETResponse (scriptCategory : dw.catalog.Category, doc : Category) : dw.system.Status

The function is called after the request has been processed.

Parameters:
scriptCategory - an instance of dw.catalog.Category
doc - the document
Returns:
a non-null Status ends the hook execution

Customer hooks for the Shopper API.


dw.ocapi.shop.customer.afterPATCH

PATCH /customers/{customer_id}

Method details

afterPATCH (customer : dw.customer.Customer, customerInput : Customer) : dw.system.Status

The function is called after a customer was updated.

Parameters:
customer - the customer to be updated
customerInput - the input customer containing the patch changes
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.afterPOST

POST /customers

Method details

afterPOST (customer : dw.customer.Customer, registration : CustomerRegistration) : dw.system.Status

The function is called after a new customer registration.

Parameters:
customer - the registered customer
registration - the customer registration information
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.auth.afterPOST

POST /customers/{customer_id}/auth

Method details

afterPOST (customer : dw.customer.Customer) : dw.system.Status

The function is called after the customer has been authenticated.

Parameters:
customer - the customer that is authenticated
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.auth.beforePOST

POST /customers/{customer_id}/auth

Method details

beforePOST (customer : dw.customer.Customer) : dw.system.Status

The function is called before the customer has been authenticated.

Parameters:
customer - the customer that is authenticated
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.auth.modifyPOSTResponse

POST /customers/{customer_id}/auth

Method details

modifyPOSTResponse (customer : dw.customer.Customer, customerResponse : Customer) : dw.system.Status

Parameters:
customer - target customer
customerResponse - customer response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.baskets.beforeGET

GET /customers/{customer_id}/baskets

Method details

beforeGET (customerId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - the customer id the baskets result retrieved for.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.baskets.modifyGETResponse_v2

GET /customers/{customer_id}/baskets

Method details

modifyGETResponse_v2 (customer : dw.customer.Customer, customerBasketsResultResponse : BasketsResult) : dw.system.Status

Parameters:
customer - the customer the baskets result retrieved for.
customerBasketsResultResponse - customer basket result response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.beforeGET

GET /customers/{customer_id}

Method details

beforeGET (customerId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - The customer id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.beforePATCH

PATCH /customers/{customer_id}

Method details

beforePATCH (customer : dw.customer.Customer, customerInput : Customer) : dw.system.Status

The function is called before a customer is updated.

Parameters:
customer - the customer to be updated
customerInput - the input customer containing the patch changes
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.beforePOST

POST /customers

Method details

beforePOST (registration : CustomerRegistration) : dw.system.Status

The function is called before a new customer registration.

Parameters:
registration - the customer registration information
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.modifyGETResponse

GET /customers/{customer_id}

Method details

modifyGETResponse (customer : dw.customer.Customer, customerResponse : Customer) : dw.system.Status

Parameters:
customer - target customer
customerResponse - customer response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.modifyPATCHResponse

PATCH /customers/{customer_id}

Method details

modifyPATCHResponse (customer : dw.customer.Customer, customerResponse : Customer) : dw.system.Status

Parameters:
customer - target customer
customerResponse - customer response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.modifyPOSTResponse

POST /customers

Method details

modifyPOSTResponse (customer : dw.customer.Customer, customerResponse : Customer) : dw.system.Status

Parameters:
customer - created customer
customerResponse - customer response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.orders.beforeGET

GET /customers/{customer_id}/orders

Method details

beforeGET (customerId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - the customer id the orders are retrieved for.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.orders.modifyGETResponse_v2

GET /customers/{customer_id}/orders

Method details

modifyGETResponse_v2 (customer : dw.customer.Customer, customerOrderResultResponse : CustomerOrderResult) : dw.system.Status

Parameters:
customer - the customer the orders are retrieved for.
customerOrderResultResponse - customer order result response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.password_reset.afterPOST

POST /customers/{customer_id}/password_reset

Method details

afterPOST (customer : dw.customer.Customer, resetToken : String) : dw.system.Status

Allows resetting a customer password. See the example below sending an email with a password reset link.

Parameters:
customer - the customer for whom to reset the password
resetToken - the token generated by the system to be used for the reset
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.password_reset.beforePOST

POST /customers/{customer_id}/password_reset

Method details

beforePOST (customer : dw.customer.Customer) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customer - the customer for whom to reset the password
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.payment_instrument.afterDELETE

DELETE /customers/{customer_id}/payment_instruments/{payment_instrument_id}

Method details

afterDELETE (customer : dw.customer.Customer, paymentInstrumentId : String) : dw.system.Status

The function is called after removing a payment instrument of a customer.

Parameters:
customer - the customer for whom to delete the payment instrument
paymentInstrumentId - the id of the payment instrument that was deleted
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.payment_instrument.afterPOST

POST /customers/{customer_id}/payment_instruments

Method details

afterPOST (customer : dw.customer.Customer, paymentInstrument : CustomerPaymentInstrumentRequest) : dw.system.Status

The function is called after a payment instrument was added to a customer.

Parameters:
customer - the customer for whom to add the payment instrument
paymentInstrument - the payment instrument that was added
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.payment_instrument.beforeDELETE

DELETE /customers/{customer_id}/payment_instruments/{payment_instrument_id}

Method details

beforeDELETE (customer : dw.customer.Customer, paymentInstrumentId : String) : dw.system.Status

The function is called before removing a payment instrument of a customer.

Parameters:
customer - the customer for whom to delete the payment instrument
paymentInstrumentId - the id of the payment instrument to be deleted
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.payment_instrument.beforeGET

GET /customers/{customer_id}/payment_instruments/{payment_instrument_id}

Method details

beforeGET (customerId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - target customer id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.payment_instrument.beforePOST

POST /customers/{customer_id}/payment_instruments

Method details

beforePOST (customer : dw.customer.Customer, paymentInstrument : CustomerPaymentInstrumentRequest) : dw.system.Status

The function is called before a payment instrument is added to a customer.

Parameters:
customer - the customer for whom to add the payment instrument
paymentInstrument - the payment instrument to be added
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.payment_instrument.modifyGETResponse

GET /customers/{customer_id}/payment_instruments/{payment_instrument_id}

Method details

modifyGETResponse (customer : dw.customer.Customer, customerPaymentInstrument : dw.customer.CustomerPaymentInstrument, customerPaymentInstrumentResponse : CustomerPaymentInstrument) : dw.system.Status

Parameters:
customer - target customer
customerPaymentInstrument - payment instrument
customerPaymentInstrumentResponse - customer payment instrument response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.payment_instrument.modifyPOSTResponse

POST /customers/{customer_id}/payment_instruments

Method details

modifyPOSTResponse (customer : dw.customer.Customer, customerPaymentInstrument : dw.customer.CustomerPaymentInstrument, customerPaymentInstrumentResponse : CustomerPaymentInstrument) : dw.system.Status

Parameters:
Customer - target customer
customerPaymentInstrument - payment instrument
customerPaymentInstrumentResponse - customer payment instrument response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.payment_instruments.beforeGET

GET /customers/{customer_id}/payment_instruments

Method details

beforeGET (customerId : String, paymentMethodId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - the customer id the customer payment instruments result retrieved for.
paymentMethodId - the id of the payment method, if null - all payment instruments are retrieved
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.payment_instruments.modifyGETResponse_v2

GET /customers/{customer_id}/payment_instruments

Method details

modifyGETResponse_v2 (customer : dw.customer.Customer, customerPaymentInstrumentResultResponse : CustomerPaymentInstrumentResult) : dw.system.Status

Parameters:
customer - the customer the customer payment instruments result retrieved for.
customerPaymentInstrumentResultResponse - customer payment instrument result response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.afterDELETE

DELETE /customers/{customer_id}/product_lists/{list_id}

Method details

afterDELETE (customer : dw.customer.Customer, productListId : String) : dw.system.Status

The function is called after a customer product list is deleted.

Parameters:
customer - the customer
productListId - the product list id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.afterPATCH

PATCH /customers/{customer_id}/product_lists/{list_id}

Method details

afterPATCH (customer : dw.customer.Customer, productList : CustomerProductList) : dw.system.Status

The function is called after modifying a customer product list.

Parameters:
customer - the customer
productList - the product list
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.beforeDELETE

DELETE /customers/{customer_id}/product_lists/{list_id}

Method details

beforeDELETE (customer : dw.customer.Customer, productList : dw.customer.ProductList) : dw.system.Status

The function is called before a customer product list is deleted.

Parameters:
customer - the customer
productList - the product list
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.beforeGET

GET /customers/{customer_id}/product_lists/{list_id}

Method details

beforeGET (customerId : String, productListId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - The customer id.
productListId - The product list id.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.beforePATCH

PATCH /customers/{customer_id}/product_lists/{list_id}

Method details

beforePATCH (customer : dw.customer.Customer, productList : CustomerProductList) : dw.system.Status

The function is called before modifying a customer product list.

Parameters:
customer - the customer
productList - the product list
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.item.afterDELETE

DELETE /customers/{customer_id}/product_lists/{list_id}/items/{item_id}

Method details

afterDELETE (customer : dw.customer.Customer, productList : dw.customer.ProductList, itemId : String) : dw.system.Status

The function is called after deleting an item from a customer product list.

Parameters:
customer - the customer
productList - the product list
itemId - the id of the deleted item
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.item.afterPATCH

PATCH /customers/{customer_id}/product_lists/{list_id}/items/{item_id}

Method details

afterPATCH (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : CustomerProductListItem) : dw.system.Status

The function is called after updating an item of a customer product list.

Parameters:
customer - the customer
productList - the product list
item - the updated item
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.item.beforeDELETE

DELETE /customers/{customer_id}/product_lists/{list_id}/items/{item_id}

Method details

beforeDELETE (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : dw.customer.ProductListItem) : dw.system.Status

The function is called before deleting an item from a customer product list.

Parameters:
customer - the customer
productList - the product list
item - the product list item to delete
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.item.beforeGET

GET /customers/{customer_id}/product_lists/{list_id}/items/{item_id}

Method details

beforeGET (customerId : String, productListId : String, productListItemId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - target customer id
productListId - the customers product list id the product list item purchase result retrieved for.
productListItemId - the product list id item the product list item purchase result retrieved for.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.item.beforePATCH

PATCH /customers/{customer_id}/product_lists/{list_id}/items/{item_id}

Method details

beforePATCH (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : CustomerProductListItem) : dw.system.Status

The function is called before updating an item of a customer product list.

Parameters:
customer - the customer
productList - the product list
item - the product list item to update
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.item.modifyGETResponse

GET /customers/{customer_id}/product_lists/{list_id}/items/{item_id}

Method details

modifyGETResponse (customer : dw.customer.Customer, productListItem : dw.customer.ProductListItem, customerProductListItemResponse : CustomerProductListItem) : dw.system.Status

Parameters:
customer - target customer
productListItem - target product list item
customerProductListItemResponse - customer product list item response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.item.modifyPATCHResponse

PATCH /customers/{customer_id}/product_lists/{list_id}/items/{item_id}

Method details

modifyPATCHResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListItemResponse : CustomerProductListItem, customerProductListItemRequest : CustomerProductListItem) : dw.system.Status

Parameters:
customer - target customer
productList - target product list
customerProductListItemRequest - customer product list item request object
customerProductListItemResponse - customer product list item response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.item.modifyPOSTResponse

POST /customers/{customer_id}/product_lists/{list_id}/items

Method details

modifyPOSTResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListItemResponse : CustomerProductListItem, customerProductListItemRequest : CustomerProductListItem) : dw.system.Status

Parameters:
customer - target customer
productList - target product list
customerProductListItemResponse - customer product list item response object
customerProductListItemRequest - customer product list item request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.items.afterPOST

POST /customers/{customer_id}/product_lists/{list_id}/items

Method details

afterPOST (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : CustomerProductListItem) : dw.system.Status

The function is called after adding an item to a customer product list.

Parameters:
customer - the customer
productList - the product list
item - the item added to the customer product list
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.items.beforeGET

GET /customers/{customer_id}/product_lists/{list_id}/items

Method details

beforeGET (customerId : String, productListId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - the customer id the customer product list items result retrieved for.
productListId - the product list id the customer product list items result retrieved for.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.items.beforePOST

POST /customers/{customer_id}/product_lists/{list_id}/items

Method details

beforePOST (customer : dw.customer.Customer, productList : dw.customer.ProductList, item : CustomerProductListItem) : dw.system.Status

The function is called before adding an item to a customer product list.

Parameters:
customer - the customer
productList - the product list
item - the item to add to the customer product list
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.items.modifyGETResponse_v2

GET /customers/{customer_id}/product_lists/{list_id}/items

Method details

modifyGETResponse_v2 (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListItemResultResponse : CustomerProductListItemResult) : dw.system.Status

Parameters:
customer - the customer the customer product list items result retrieved for.
productList - the product list the customer product list items result retrieved for.
customerProductListItemResultResponse - customer product list item result response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.modifyGETResponse

GET /customers/{customer_id}/product_lists/{list_id}

Method details

modifyGETResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListResponse : CustomerProductList) : dw.system.Status

Parameters:
customer - target customer
productList - target product list
customerProductListResponse - customer product list response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.modifyPATCHResponse

PATCH /customers/{customer_id}/product_lists/{list_id}

Method details

modifyPATCHResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListResponse : CustomerProductList) : dw.system.Status

Parameters:
customer - target customer
productList - target product list
customerProductListResponse - customer product list response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_list.modifyPOSTResponse

POST /customers/{customer_id}/product_lists

Method details

modifyPOSTResponse (customer : dw.customer.Customer, productList : dw.customer.ProductList, customerProductListResponse : CustomerProductList) : dw.system.Status

Parameters:
customer - target customer
productList - product list
customerProductListResponse - customer product list response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_lists.afterPOST

POST /customers/{customer_id}/product_lists

Method details

afterPOST (customer : dw.customer.Customer, productList : CustomerProductList) : dw.system.Status

The function is called after creating a new product list for the specified customer.

Parameters:
customer - the customer
productList - the created product list
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_lists.beforeGET

GET /customers/{customer_id}/product_lists

Method details

beforeGET (customerId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - the customer id the customer product lists result retrieved for.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_lists.beforePOST

POST /customers/{customer_id}/product_lists

Method details

beforePOST (customer : dw.customer.Customer, productList : CustomerProductList) : dw.system.Status

The function is called before creating a new product list for the specified customer.

Parameters:
customer - the customer
productList - the product list to create
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.product_lists.modifyGETResponse_v3

GET /customers/{customer_id}/product_lists

Method details

modifyGETResponse_v3 (customer : dw.customer.Customer, customerProductListResultResponse : CustomerProductListResult) : dw.system.Status

Parameters:
customer - the customer the customer product lists result retrieved for.
customerProductListResultResponse - customer product list pageable result response object
Returns:
a non-null Status ends the hook execution

Customer address hooks for the Shopper API.


dw.ocapi.shop.customer.address.afterDELETE

DELETE /customers/{customer_id}/addresses/{address_name}

Method details

afterDELETE (customer : dw.customer.Customer, addressName : String) : dw.system.Status

The function is called after removing an address of a customer.

Parameters:
customer - the customer for whom the address was deleted
addressName - the name of the address that was deleted
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.address.afterPATCH

PATCH /customers/{customer_id}/addresses/{address_name}

Method details

afterPATCH (customer : dw.customer.Customer, addressName : String, customerAddress : CustomerAddress) : dw.system.Status

The function is called after updating an address of a customer.

Parameters:
customer - the customer for whom the address was updated
addressName - the name of the address that was updated
customerAddress - the customer address request data
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.address.beforeDELETE

DELETE /customers/{customer_id}/addresses/{address_name}

Method details

beforeDELETE (customer : dw.customer.Customer, addressName : String) : dw.system.Status

The function is called before removing an address of a customer.

Parameters:
customer - the customer for whom to delete the address
addressName - the name of the address to be deleted
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.address.beforeGET

GET /customers/{customer_id}/addresses/{address_name}

Method details

beforeGET (customerId : String, addressName : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customer - target customer
customerAddress - target customer address
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.address.beforePATCH

PATCH /customers/{customer_id}/addresses/{address_name}

Method details

beforePATCH (customer : dw.customer.Customer, addressName : String, customerAddress : CustomerAddress) : dw.system.Status

The function is called before updating an address of a customer.

Parameters:
customer - the customer for whom to update the address
addressName - the name of the address to be updated
customerAddress - the customer address request data
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.address.modifyGETResponse

GET /customers/{customer_id}/addresses/{address_name}

Method details

modifyGETResponse (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, customerAddressResponse : CustomerAddress) : dw.system.Status

Parameters:
customer - target customer
customerAddress - target customer address
customerAddressResponse - customer address response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.address.modifyPATCHResponse

PATCH /customers/{customer_id}/addresses/{address_name}

Method details

modifyPATCHResponse (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, customerAddressResponse : CustomerAddress, customerAddressRequest : CustomerAddress) : dw.system.Status

Parameters:
customerAddress - target customer address
customerAddressResponse - customer address response object
customerAddressRequest - customer address request object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.address.modifyPOSTResponse

POST /customers/{customer_id}/addresses

Method details

modifyPOSTResponse (customer : dw.customer.Customer, customerAddress : dw.customer.CustomerAddress, customerAddressResponse : CustomerAddress, customerAddressRequest : CustomerAddress) : dw.system.Status

The function is called before returning response.

Parameters:
customer - the customer for whom the address was added.
customerAddress - created customer address
customerAddressResponse - customer address response object.
customerAddressRequest - the customer address request object.
Returns:
a non-null Status ends the hook execution

Customer addresses hooks for the Shopper API.


dw.ocapi.shop.customer.addresses.afterPOST

POST /customers/{customer_id}/addresses

Method details

afterPOST (customer : dw.customer.Customer, addressName : String, customerAddress : CustomerAddress) : dw.system.Status

The function is called after adding an address to a customer.

Parameters:
customer - the customer for whom the address was added
addressName - the name of the address that was added
customerAddress - the customer address request data
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.addresses.beforeGET

GET /customers/{customer_id}/addresses

Method details

beforeGET (customerId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
customerId - the customer id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.addresses.beforePOST

POST /customers/{customer_id}/addresses

Method details

beforePOST (customer : dw.customer.Customer, addressName : String, customerAddress : CustomerAddress) : dw.system.Status

The function is called before adding an address to a customer.

Parameters:
customer - the customer for whom to add the address
addressName - the name of the address to be added
customerAddress - the customer address request data
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.customer.addresses.modifyGETResponse

GET /customers/{customer_id}/addresses

Method details

modifyGETResponse (customerAddressResultResponse : CustomerAddressResult) : dw.system.Status

Parameters:
customerAddressResultResponse - customer addresses result response
Returns:
a non-null Status ends the hook execution

Gift certificate hooks for version 23.1.

dw.ocapi.shop.gift_certificate.beforePOST

POST /gift_certificate

Method details

beforePOST (giftCertificateRequest : GiftCertificateRequest) : dw.system.Status

The function is called before the request will be processed.

Parameters:
giftCertificateRequest - The request containing the gift certificate code.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.gift_certificate.modifyPOSTResponse

POST /gift_certificate

Method details

modifyPOSTResponse (giftCertificate : dw.order.GiftCertificate, giftCertificateResponse : GiftCertificate) : dw.system.Status

Parameters:
giftCertificate - the target gift certificate
giftCertificateResponse - gift certificate response object
Returns:
a non-null Status ends the hook execution

Order hooks for the Shopper API.


dw.ocapi.shop.order.afterPOST

POST /orders

Method details

afterPOST (order : dw.order.Order) : dw.system.Status

The function is called after an order was created from the basket.

Parameters:
order - the order that was created for the basket
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.beforeGET

GET /orders/{order_no}

Method details

beforeGET (orderNo : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
orderNo - the order number
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.beforePOST

POST /orders

Method details

beforePOST (basket : dw.order.Basket) : dw.system.Status

The function is called before an order is created for the basket.

Parameters:
basket - the basket based on which the order is created
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.modifyGETResponse

GET /orders/{order_no}

Method details

modifyGETResponse (order : dw.order.Order, orderResponse : Order) : dw.system.Status

Parameters:
order - target order
orderResponse - order response object
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.modifyPOSTResponse

POST /orders

Method details

modifyPOSTResponse (order : dw.order.Order, orderResponse : Order) : dw.system.Status

Parameters:
order - target order
orderResponse - order response object
Returns:
a non-null Status ends the hook execution

dw.scapi.orders.afterPOST

POST /orders

Method details

afterPOST (order : dw.order.Order) : dw.system.Status

The function is called after an order was created.

Parameters:
order - the created order
Returns:
a non-null Status ends the hook execution

dw.scapi.orders.beforePOST

POST /orders

Method details

beforePOST (request : OrderCreateRequestWO) : dw.system.Status

The function is called before an order is created.

Parameters:
request - the order create request
Returns:
a non-null Status ends the hook execution

dw.scapi.shop.orders.lookup.afterPOST

POST /orders/{order_no}/lookup

Method details

afterPOST (order : dw.order.Order) : dw.system.Status

The function is called after looking up an order.

Parameters:
order - the looked up order
Returns:
a non-null Status ends the hook execution

dw.scapi.shop.orders.lookup.beforePOST

POST /orders/{order_no}/lookup

Method details

beforePOST (request : OrderLookupRequestWO) : dw.system.Status

The function is called before looking up an order.

Parameters:
request - the order lookup request
Returns:
a non-null Status ends the hook execution

dw.scapi.shop.orders.lookup.modifyPOSTResponse

POST /orders/{order_no}/lookup

Method details

modifyPOSTResponse (orderLookupResponse : OrderWO) : dw.system.Status

The function is called after the post lookup order.

Parameters:
orderLookupResponse - order response object
Returns:
a non-null Status ends the hook execution

Order payment hooks for the Shopper API.


dw.order.payment.authorize

PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

authorize (order : dw.order.Order, paymentDetails : dw.order.OrderPaymentInstrument) : dw.system.Status

Custom payment authorization - modify the order as needed.

  • Prerequisite: An order has been created using the data api or via the storefront.
  • Return Status.OK: Corresponding payment transaction is marked as authorized (usually a custom property is used for this).
  • Return Status.ERROR: Order is held, authorization needs to be repeated.

Parameters:
order - the order
paymentDetails - specified payment details
Returns:
  • Status.OK successful authorization.
  • Status.ERROR authorization failed.

dw.order.payment.authorize

POST /orders/{order_no}/payment_instruments

Method details

authorize (order : dw.order.Order, paymentDetails : dw.order.OrderPaymentInstrument) : dw.system.Status

Custom payment authorization - modify the order as needed.

  • Prerequisite: An order has been created using the data api or via the storefront.
  • Return Status.OK: Corresponding payment transaction is marked as authorized (usually a custom property is used for this).
  • Return Status.ERROR: Order is held, authorization needs to be repeated.

Parameters:
order - the order
paymentDetails - specified payment details
Returns:
  • Status.OK successful authorization.
  • Status.ERROR authorization failed.

dw.order.payment.authorizeCreditCard

PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

authorizeCreditCard (order : dw.order.Order, paymentDetails : dw.order.OrderPaymentInstrument, cvn : String) : dw.system.Status

Custom payment authorization of a credit card - modify the order as needed.

  • Prerequisite: An order has been created using the data api or via the storefront.
  • Return Status.OK: Corresponding payment transaction is marked as authorized (usually a custom property is used for this).
  • Return Status.ERROR: Order is held, authorization needs to be repeated.

Parameters:
order - the order
paymentDetails - specified payment details
cvn - the credit card verification number
Returns:
  • Status.OK successful authorization.
  • Status.ERROR authorization failed.

dw.order.payment.authorizeCreditCard

POST /orders/{order_no}/payment_instruments

Method details

authorizeCreditCard (order : dw.order.Order, paymentDetails : dw.order.OrderPaymentInstrument, cvn : String) : dw.system.Status

Custom payment authorization of a credit card - modify the order as needed.

  • Prerequisite: An order has been created using the data api or via the storefront.
  • Return Status.OK: Corresponding payment transaction is marked as authorized (usually a custom property is used for this).
  • Return Status.ERROR: Order is held, authorization needs to be repeated.

Parameters:
order - the order
paymentDetails - specified payment details
cvn - the credit card verification number
Returns:
  • Status.OK successful authorization.
  • Status.ERROR authorization failed.

dw.ocapi.shop.order.validateOrder

DELETE /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

validateOrder (order : Order) : dw.system.Status

Validate an order after the order has been updated. The hook is called outside a database transaction, so modifications to the order are not possible. Allows the addition of custom flashes to convey information to the client. Example showing addition of flashes:

Parameters:
order - the modified order
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.validateOrder

PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

validateOrder (order : Order) : dw.system.Status

Validate an order after the order has been updated. The hook is called outside a database transaction, so modifications to the order are not possible. Allows the addition of custom flashes to convey information to the client. Example showing addition of flashes:

Parameters:
order - the modified order
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.validateOrder

POST /orders/{order_no}/payment_instruments

Method details

validateOrder (order : Order) : dw.system.Status

Validate an order after the order has been updated. The hook is called outside a database transaction, so modifications to the order are not possible. Allows the addition of custom flashes to convey information to the client. Example showing addition of flashes:

Parameters:
order - the modified order
Returns:
a non-null Status ends the hook execution

Order payment instruments hooks for the Shopper API.


dw.ocapi.shop.order.payment_instrument.afterDELETE

DELETE /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

afterDELETE (order : dw.order.Order, paymentInstrument : dw.order.OrderPaymentInstrument) : dw.system.Status

The function is called after removing a payment instrument of an order.

Parameters:
order - the modified order
paymentInstrument - the removed payment instrument
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.payment_instrument.afterPATCH

PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

afterPATCH (order : dw.order.Order, paymentInstrument : dw.order.OrderPaymentInstrument, newPaymentInstrument : OrderPaymentInstrumentRequest, successfullyAuthorized : boolean) : dw.system.Status

The function is called after updating a payment instrument of an order.

Parameters:
order - the modified order
paymentInstrument - the updated payment instrument
newPaymentInstrument - the new payment instrument data
successfullyAuthorized - was the payment instrument successfully authorized.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.payment_instrument.afterPOST

POST /orders/{order_no}/payment_instruments

Method details

afterPOST (order : dw.order.Order, paymentInstrument : OrderPaymentInstrumentRequest, successfullyAuthorized : boolean) : dw.system.Status

The function is called after a payment instrument was added to the order.

Parameters:
order - the modified order
paymentInstrument - the payment instrument that was added to the order
successfullyAuthorized - was the payment instrument successfully authorized.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.payment_instrument.beforeDELETE

DELETE /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

beforeDELETE (order : dw.order.Order, paymentInstrument : dw.order.OrderPaymentInstrument) : dw.system.Status

The function is called before removing a payment instrument of an order.

Parameters:
order - the modified order
paymentInstrument - the payment instrument to be removed
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.payment_instrument.beforePATCH

PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

beforePATCH (order : dw.order.Order, paymentInstrument : dw.order.OrderPaymentInstrument, newPaymentInstrument : OrderPaymentInstrumentRequest) : dw.system.Status

The function is called before updating a payment instrument of an order.

Parameters:
order - the modified order
paymentInstrument - the payment instrument to be updated
newPaymentInstrument - the new payment instrument data
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.payment_instrument.beforePOST

POST /orders/{order_no}/payment_instruments

Method details

beforePOST (order : dw.order.Order, paymentInstrument : OrderPaymentInstrumentRequest) : dw.system.Status

The function is called before a payment instrument is added to the order.

Parameters:
order - the modified order
paymentInstrument - the payment instrument to be added to the order
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.payment_instrument.modifyDELETEResponse

DELETE /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

modifyDELETEResponse (order : dw.order.Order, orderResponse : Order, paymentInstrumentId : String) : dw.system.Status

Parameters:
order - target order
orderResponse - order response object
paymentInstrumentId - payment instrument id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.payment_instrument.modifyPATCHResponse

PATCH /orders/{order_no}/payment_instruments/{payment_instrument_id}

Method details

modifyPATCHResponse (order : dw.order.Order, orderResponse : Order, paymentInstrumentId : String) : dw.system.Status

Parameters:
order - target order
orderResponse - order response object
paymentInstrumentId - payment instrument id
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.payment_instrument.modifyPOSTResponse

POST /orders/{order_no}/payment_instruments

Method details

modifyPOSTResponse (order : dw.order.Order, orderResponse : Order) : dw.system.Status

Parameters:
order - target order
orderResponse - order response object
Returns:
a non-null Status ends the hook execution

Order payment methods hooks for the Shopper API.


dw.ocapi.shop.order.payment_methods.beforeGET

GET /orders/{order_no}/payment_methods

Method details

beforeGET (orderNumber : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
orderNumber - the order number
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.order.payment_methods.modifyGETResponse_v2

GET /orders/{order_no}/payment_methods

Method details

modifyGETResponse_v2 (order : dw.order.Order, paymentMethodResultResponse : PaymentMethodResult) : dw.system.Status

Parameters:
order - the order the payment method result retrieved for.
paymentMethodResultResponse - payment method result response object
Returns:
a non-null Status ends the hook execution

Product hooks for the Shopper API.


dw.ocapi.shop.product.beforeGET

GET /products/{id}

Method details

beforeGET (productId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
productId - the incoming product id from the URL.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.product.modifyGETResponse

GET /products/{id}

Method details

modifyGETResponse (scriptProduct : dw.catalog.Product, doc : Product) : dw.system.Status

The function is called after the request has been processed.

Parameters:
doc - the document
scriptProduct - an instance of dw.catalog.Product
Returns:
a non-null Status ends the hook execution

Product search hooks for the Shopper API.


dw.ocapi.shop.product_search.beforeGET

GET /product_search

Method details

beforeGET () : dw.system.Status

The function is called before the request will be processed.

Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.product_search.modifyGETResponse

GET /product_search

Method details

modifyGETResponse (doc : ProductSearchResult) : dw.system.Status

The function is called after the request has been processed.

Parameters:
doc - the document
Returns:
a non-null Status ends the hook execution

Promotion hooks for the Shopper API.


dw.ocapi.shop.promotion.beforeGET

GET /promotions/{id}

Method details

beforeGET (id : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
id - The id of the requested promotion.
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.promotion.modifyGETResponse

GET /promotions/{id}

Method details

modifyGETResponse (scriptPromotion : dw.campaign.Promotion, doc : Promotion) : dw.system.Status

The function is called after the request has been processed.

Parameters:
scriptPromotion - an instance of dw.campaign.Promotion
doc - the document
Returns:
a non-null Status ends the hook execution

Promotions hooks for the Shopper API.


dw.ocapi.shop.promotions.beforeGET

GET /promotions

Method details

beforeGET (campaignId : String, startDate : String, endDate : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
campaignId - Find the promotions assigned to this campaign (mandatory)
startDate - The start date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
endDate - The end date of the promotion in ISO8601 date time format: yyyy-MM-dd'T'HH:mmZ
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.promotions.modifyGETResponse

GET /promotions

Method details

modifyGETResponse (doc : PromotionResult) : dw.system.Status

The function is called after the request has been processed.

Parameters:
doc - the document
Returns:
a non-null Status ends the hook execution

Search suggestions hooks for Shop API.


dw.ocapi.shop.search_suggestion.beforeGET

GET /search_suggestion

Method details

beforeGET () : dw.system.Status

The function is called before the request will be processed.

Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.search_suggestion.modifyGETResponse

GET /search_suggestion

Method details

modifyGETResponse (doc : SuggestionResult) : dw.system.Status

The function is called after the request has been processed.

Parameters:
doc - the document
Returns:
a non-null Status ends the hook execution

SEO URL Mapping hooks for the Shopper API.


dw.shop.seo.url_mapping.beforeGET

GET /url-mapping

Method details

beforeGET (urlSegment : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
urlSegment - The URL for which the mapping needs to be retrieved.
Returns:
a non-null Status ends the hook execution

dw.shop.seo.url_mapping.modifyGETResponse

GET /url-mapping

Method details

modifyGETResponse (urlMappingResponse : UrlMappingResponseWO_v1) : dw.system.Status

The function is called after the request has been processed.

Parameters:
urlMappingResponse - Returns URL mapping information for a URL that a shopper clicked or typed in
Returns:
a non-null Status ends the hook execution

Shopper Context Mapping hooks for the Shopper API.


dw.shop.shopper_context.beforePUT

PUT /shopper-context

Method details

beforePUT (usid: string , siteId: string , shopperContextWO: ShopperContextWO_v1 ) : dw.system.Status

The function is called before the request will be processed.

Parameters:
usid - SLAS user ID.
siteId - site ID for the shopper context.
shopperContextWO - shopper context to be saved.
Returns:
a non-null Status ends the hook execution

dw.shop.shopper_context.beforePATCH

PATCH /shopper-context

Method details

beforePATCH (usid: string , siteId: string , shopperContextWO: ShopperContextWO_v1 ) : dw.system.Status

The function is called before the shopper context is updated.

Parameters:
usid - SLAS user ID.
siteId - site ID for the shopper context.
shopperContextWO - shopper context to be saved.
Returns:
a non-null Status ends the hook execution

dw.shop.shopper_context.modifyPATCHResponse

PATCH /shopper-context

Method details

modifyPATCHResponse dw.system.Status

The function is called after the new shopper context was updated.

Returns:
a non-null Status ends the hook execution

Store hooks for Shop API.


dw.ocapi.shop.store.beforeGET

GET /stores/{id}

Method details

beforeGET (id : String, siteId : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
id - The id of the requested store.
siteId - The ID of the site to get the store from
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.store.modifyGETResponse

GET /stores/{id}

Method details

modifyGETResponse (scriptStore : dw.catalog.Store, doc : Store) : dw.system.Status

The function is called after the request has been processed.

Parameters:
scriptStore - an instance of dw.catalog.Store
doc - the document
Returns:
a non-null Status ends the hook execution

Stores hooks for Shop API.


dw.ocapi.shop.stores.beforeGET

GET /stores

Method details

beforeGET (latitude : Double, longitude : Double, countryCode : String, postalCode : String) : dw.system.Status

The function is called before the request will be processed.

Parameters:
latitude - The geo coordinate latitude to search for stores (value range -90.00 .. 90.00).
longitude - The geo coordinate longitude to search for stores (value range -180.00 .. 180.00).
countryCode - The two letter ISO country code e.g. "US".
postalCode - The postal code e.g. "01801".
Returns:
a non-null Status ends the hook execution

dw.ocapi.shop.stores.modifyGETResponse

GET /stores

Method details

modifyGETResponse (doc : StoreResult) : dw.system.Status

The function is called after the request has been processed.

Parameters:
doc - the document
Returns:
a non-null Status ends the hook execution