Order orchestration: custom APIs

Certain custom APIs help in processing of rule-based orders. These custom APIs are exposed through SDF services.

processOrderValidation API

This custom API reads the order identifying attributes from the input document and fetches the order details based on the template, getOrderDetailsForValidation using the getOrderDetails API. The output of the API is passed to a service, PrepareMappingForValidation, that performs mapping. The order details are used to create the input request as required by the business rules, which is performed by a custom implementation of the service, PrepareMappingForValidation, that understands the rules engine.

A sample service implementation with an XSL component is provided that must be replaced with custom implementation. The mapping document is sent to the service, InvokeValidationRules, that internally calls the prepareRequest API to invoke HHTP REST API of the rules engine. The response from the REST API is processed for validation results. An internal method, processValidationResponse() parses through the validation result and takes appropriate action.

invokeValidationRules API

This custom API invokes prepareRequest and invokeBusinessRule services to call the business rules engine for validation REST API.

Here is sample output from the invokeValidationRules API:
<ValidationResult IsValid="" ErrorCode="" ErrorType="" ErrorDescription="" >
  <ValidationItems>
    <ValidationItem IsValid="" ErrorCode="" ErrorType="" ErrorDescription="">
      <ValidationParameter EntityID="" EntityType=""/>
    </ValidationItem>
  </ValidationItems>
</ValidationResult>

processOrderDecomp API

This custom API uses the input to invoke getOrderDetails and getItemList APIs for a given order. The outputs is then combined into one message.

invokeDecompRules API

This custom API uses the input to invoke the business rules for order decomposition. The API takes the input from the customer implemented map service.

Here is sample output from the invokeDecompRules API:
<DecompOrderList OrderHeaderKey="RootOrderKey" OrderNo="Required" EnterpriseCode="Required">
  <Order CustomerPONo="{root OrderNo}" ShipToKey="" ShipToID="" BillToKey="" BillToID="" SellerOrganizationCode="" OrderNo="Required" OrderType="ResourceOrder|ServiceOrder|ProductOrder" OrderDate="" EnterpriseCode="{root}" DraftOrderFlag="N">
    <OrderLines>
      <OrderLine PrimeLineNo="" SubLineNo="" OrderedQty="">
        <Item UnitOfMeasure="" ProductClass="" ItemID=""/>
        <CustomAttributes/>
      </OrderLine>
    </OrderLines>
    <ParentOrder OrderNo="Required"/>
    <CustomAttributes/>
  </Order>
</DecompOrderList>

invokeBuildPlanRules API

This custom API invokes internal methods of prepareRequest and invokeBusinessRule services to call the business rules engine for build plan REST API. The output defines the dependencies between the decomposed orders.

Here is sample output from the invokeBuildPlanRules API:
<BuildPlan OrderHeaderKey="" OrderNo="" EnterpriseCode="" DocumentType="">
  <Dependencies>
    <Order OrderHeaderKey="" OrderNo="" EnterpriseCode="" DocumentType="">
      <DependentUpon OrderHeaderKey="" OrderNo="" EnterpriseCode="" DocumentType=""/>
    </Order>
  </Dependencies>
</BuildPlan>

UpdateOrderDependency API

This custom API is invoked by OnStatusChange event of ORDER_COMPLETE transaction for a decomposed order. It updates all transactional relationship records for IsDependencyResolved flag for orders that are dependent on the current order. A message is posted to the PostMsgToEvaluateDependencyQ service for each such updated order.

EvaluateOrderDependency API

This custom API is invoked by EvaluateDependencyIntgServer service. The input to this custom API is either the original customer order or a decomposed order. Evaluate if the input order has any more pending dependencies to be resolved. If all dependencies are resolved, change order status. If input order is customer order, change order status to Completed. If input order is a decomposed order, then change order status changed to Ready For Fulfillment.