BasketMergeHooks
CalculateHooks
CheckoutHooks
OrderHooks
PaymentHooks
ReturnHooks
ShippingOrderHooks
DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
This interface represents all script hooks that can be registered to customize the order center payment functionality. It contains the extension points (hook names), and the functions that are called by each extension point. A function must be defined inside a JavaScript source and must be exported. The script with the exported hook function must be located inside a site cartridge. Inside the site cartridge a ‘package.json’ file with a ‘hooks’ entry must exist.
“hooks”: ”./hooks.json”
The hooks entry links to a json file, relative to the ‘package.json’ file. This file lists all registered hooks inside the hooks property:
1"hooks": [
2 {"name": "dw.order.payment.authorize", "script": "./authorize.js"},
3 {"name": "dw.order.payment.validateAuthorization", "script": "./validateAuthorization.js"},
4]A hook entry has a ‘name’ and a ‘script’ property.
| Constant | Description |
|---|---|
| extensionPointAuthorize: String = “dw.order.payment.authorize” | The extension point name dw.order.payment.authorize. |
| extensionPointAuthorizeCreditCard: String = “dw.order.payment.authorizeCreditCard” | The extension point name dw.order.payment.authorizeCreditCard. |
| extensionPointCapture: String = “dw.order.payment.capture” | The extension point name dw.order.payment.capture. |
| extensionPointReauthorize: String = “dw.order.payment.reauthorize” | The extension point name dw.order.payment.reauthorize. |
| extensionPointRefund: String = “dw.order.payment.refund” | The extension point name dw.order.payment.refund. |
| extensionPointReleaseAuthorization: String = “dw.order.payment.releaseAuthorization” | The extension point name dw.order.payment.releaseAuthorization. |
| extensionPointValidateAuthorization: String = “dw.order.payment.validateAuthorization” | The extension point name dw.order.payment.validateAuthorization. |
This class does not have a constructor, so you cannot create it directly.
| Method | Description |
|---|---|
| authorize(Order, OrderPaymentInstrument) | The function is called by extension point extensionPointAuthorize. |
| authorizeCreditCard(Order, OrderPaymentInstrument, String) | The function is called by extension point extensionPointAuthorizeCreditCard. |
| capture(Invoice) | The function is called by extension point extensionPointCapture. |
| reauthorize(Order) | The function is called by extension point extensionPointReauthorize. |
| refund(Invoice) | The function is called by extension point extensionPointRefund. |
| releaseAuthorization(Order) | The function is called by extension point extensionPointReleaseAuthorization. |
| validateAuthorization(Order) | The function is called by extension point extensionPointValidateAuthorization. |
assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values
The extension point name dw.order.payment.authorize.
This hook is optional.
The extension point name dw.order.payment.authorizeCreditCard.
This hook is optional.
The extension point name dw.order.payment.capture.
The extension point name dw.order.payment.reauthorize.
The extension point name dw.order.payment.refund.
The extension point name dw.order.payment.releaseAuthorization.
The extension point name dw.order.payment.validateAuthorization.
The function is called by extension point extensionPointAuthorize. Custom payment authorization - modify the order as needed.
Parameters:
The function is called by extension point extensionPointAuthorizeCreditCard. Custom payment authorization of a credit card - modify the order as needed.
Parameters:
The function is called by extension point extensionPointCapture. Custom payment capture - modify the order as needed.
[ either ] As a result of shipping (or part-shipping) a shipping -order the warehouse updates the status of the shipping-order resulting in the creation of an unpaid debit invoice (the creation of the invoice is usually handled in ShippingOrderHooks.changeStatus(ShippingOrder, ShippingOrderWO)).
[ or ] A unpaid debit invoice has been created using the data api.
Parameters:
The function is called by extension point extensionPointReauthorize. Custom payment authorization - modify the order as needed.
[ either ] Based on a selected Order, a ShippingOrder(which represents the whole or part of the order which can be shipped) is to be created ready for export to the warehouse system.
[ or ] A ShippingOrderis to be directly created using the data api.
a. validateAuthorization(Order)is used to check the orders authorization is still valid
b. reauthorize(Order)is called if step a. returns Error
Parameters:
The function is called by extension point extensionPointRefund. Custom payment refund - modify the order as needed.
[ either ] Goods returned by the customer result in the creation of one or more return documents, resulting in the creation of an unpaid customer credit invoice (the creation of the invoice is usually handled in ReturnHooks.changeStatus(Return, ReturnWO)).
[ or ] An unpaid customer credit invoice is created using the data api (perhaps as a result of the creation of a customer appeasement).
Parameters:
The function is called by extension point extensionPointReleaseAuthorization. Custom payment release authorization - modify the order as needed.
Parameters:
The function is called by extension point extensionPointValidateAuthorization. Custom payment authorization - modify the order as needed.
See reauthorize(Order) for more details.
Parameters: