The checkout flow for order approvals requires a custom widget that determines whether or not an order requires approval. This widget manages what the shopper sees for billing and payment options, depending on whether or not an order requires approval. For example, if the order requires approval, the shopper will not be able to pay for the order using a credit card. This widget does not have any UI associated with it, only the logic for determining if the order requires approval.

For general information on creating and uploading a custom widget, refer to the Developing Widgets guide. The code snippets below show you the custom code that must exist in the widget.

The following example shows the JavaScript for the Check for Approval Required widget:

/**
 * @fileoverview Check for Approval Require Widget.
 *
 * @author
 */
define(
  //-------------------------------------------------------------------
  // DEPENDENCIES
  //-------------------------------------------------------------------
  ['knockout', 'pubsub', 'notifier', 'CCi18n', 'ccConstants', 'navigation',
   'ccRestClient'],
  //-------------------------------------------------------------------
  // MODULE DEFINITION
  //-------------------------------------------------------------------
  function(ko, pubsub, notifier, CCi18n, CCConstants, navigation, ccRestClient) {
    "use strict";
  return {

    onLoad: function(widget){
      var pageId=widget.pageContext().pageType.id;
    },
     validate : function() {
         var orderId=this.user().orderId();
         var data = {
             "orderId":orderId
         };
         this.order().checkOrderForApproval(data);
       return true;
   }
  }
});

The following example shows the content of the HTML template for the Check for Approval Required widget. Note that, because there is no UI associated with this widget, it contains only a placeholder <div> element:

<div style="display:none"></div>

Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices