Controller that creates an order from the current basket. It's a pure processing controller and does no page rendering. The controller is used by checkout and is called upon the triggered place order action. It contains the actual logic to authorize the payment and create the order. The controller communicates the result of the order creation process and uses a status object PlaceOrderError to set proper error states. The calling controller is must handle the results of the order creation and evaluate any errors returned by it.
Members
(static) Submit
- Source:
- See:
(static) SubmitPaymentJSON
- Source:
- See:
Methods
(inner) handlePayments(order) → {Object}T
Responsible for payment handling. This function uses PaymentProcessorModel methods to handle payment processing specific to each payment instrument. It returns an error if any of the authorizations failed or a payment instrument is of an unknown payment method. If a payment method has no payment processor assigned, the payment is accepted as authorized.
Parameters:
Name | Type | Description |
---|---|---|
order |
dw.order.Order |
the order to handle payments for. |
Returns:
JSON object containing information about missing payments, errors, or an empty object if the function is successful.
- Type
- Object
(inner) start() → {Object}T
The entry point for order creation. This function is not exported, as this controller must only be called by another controller.
Returns:
JSON object that is empty, contains error information, or PlaceOrderError status information.
- Type
- Object
(inner) submitPaymentJSON()
Asynchronous Callbacks for OCAPI. These functions result in a JSON response. Sets the payment instrument information in the form from values in the httpParameterMap. Checks that the payment instrument selected is valid and authorizes the payment. Renders error message information if the payment is not authorized.