Executing Inventory API calls with postman

Following are the postman collection for the Inventory Shopper and OrderCheckout API

Case 1: Add to Cart inventory check

When you click Add to Cart button, the backend executes the ts-app commands to check the inventory availability for the selected SKU. If the on-hand inventory is available, it updates the ESTAVAILTIME column in the ORDERITEMS table with the current timestamp. If the on-hand inventory is unavailable, it checks whether the item can be backordered. If so, it retrieves the earliest date from the expected inventory and updates the ESTAVAILTIME column accordingly.

API Call
  • URL: {{hostport/inventory/api/v1/available-inventories/check?store=Ruby}}
  • Method: POST
Command affected
com.ibm.commerce.fulfillment.commands.CheckInventoryAvailabilityCmdImpl

Case 2: Allocate and DeAllocateInventory on clicking Checkout button

When you click Checkout button, the backend executes the AllocateInventoryCmdImpl class in the ts-app. This class performs key operations, including allocate, AllocateFromBackorder, deallocate, and deallocate backorder. It also updates order items to Future Orders if the requestedShipDate is not empty in the ORDERITEMS table.

Sub-Case 1: DeAllocate allocated OnHand Inventory
To deallocate order items with an inventory status of allocated, the existing command needs to be updated to call our Inventory PBC API for the deallocate operation.
API Call
  • URL: {{host:port/inventory/api/v1/available-inventories/deallocate?store=value&processAllOrNone= { Unknown macro: {value}}}}
  • Method: POST
Command affected
com.hcl.commerce.fulfillment.commands.DeallocateExistingInventoryCmdImpl
Sub-Case 2: DeAllocate Backorder inventory
To deallocate order items with an inventory status of BO, the existing command must be updated to call our Inventory PBC API for the deallocate operation.
API Call
  • URL: {{host:port/inventory/api/v1/expected-inventories/deallocate?store=value&processAllOrNone= { Unknown macro: {value}}}}
  • Method: POST
Command affected
com.hcl.commerce.fulfillment.commands.DeallocateExpectedInventoryCmdImpl
Sub-Case 3: Allocate from On-Hand inventory
The existing command needs to be updated to call our Inventory PBC API for the allocate operation, which allocates order items that have on-hand inventory available.
API Call
  • URL: {{host:port/inventory/api/v1/available-inventories/allocate?store=value&processAllOrNone= { Unknown macro: {value}}}}
  • Method: POST
Command affected
com.hcl.commerce.fulfillment.commands.AllocateExistingInventoryCmdImpl
Sub-Case 4: Allocate from Expected inventory
The existing command needs to be updated to call our Inventory PBC API for the allocation operation, which allocates order items that do not have sufficient on-hand inventory available from backorder.
API Call
  • URL: {{host:port/inventory/api/v1/expected-inventories/allocate?store=value&processAllOrNone= { Unknown macro: {value}}}}
  • Method: POST
Command affected
com.hcl.commerce.fulfillment.commands.AllocateExpectedInventoryCmdImpl

Case 3: Hard reserve inventory by ReleaseFulfillmentCenter scheduler job when placed order is processed

When a placed order is processed, the ReleaseFulfillmentCenter scheduler job is executed to perform a hard reserve of inventory. This job ensures that the inventory for the ordered items is secured, preventing it from being allocated to other orders and confirming that it is set aside expressly for the customer.

API Call
  • URL: {{host{}}}:{{port{}}}/inventory/api/v1/available-inventories/reserve?store=Ruby&processAllOrNone= { Unknown macro: \{value}}
  • Method: POST
Command affected
com.ibm.commerce.inventory.commands.DoInventoryActionCmdImpl
Method Update
The method should be updated to include the Inventory API call shipItems().

Case 4: Process Backorder inventory by ProcessBackorder scheduler job when placed order

As we have reviewed the Commerce Order Inventory code, we do not need to call any explicit ProcessBackorder API in Commerce to process the backorder inventory. Below is an overview of how Commerce processes backorders:

  1. The Commerce Order System runs the ProcessBackordersCmdImpl scheduler job at specific intervals to handle backorders. It first fetches order items with an inventory status of BO (backorder) based on the time placed.
  2. After selecting the order items, it calls the AllocateInventoryCmd command, which performs the following three actions:
    1. This command calls DeallocateExpectedInventoryCmdImpl to reverse the backorder inventory for the backordered items. (You can refer to this as a reverse backorder.)
    2. Then, it calls the AllocateExistingInventoryCmdImpl command, passing singleFulfillmentCenter = Y to the stored procedure to allocate the entire required quantity from a single Inventory Location (IL) for those backordered items.
    3. If the required on-hand inventory is unavailable from point 2.b, the ordered item is marked as eligible for allocation from backordered items. It then calls the AllocateExpectedInventoryCmdImpl command to allocate the quantity from backorders, reverting the order item status to BO.
      Note: In Step 2.b, if you request a quantity of 10 and only five are available on hand, no allocation from on-hand inventory will be performed, as ssingleFulfillmentCenter = Y is specified. In Step 2.C, when you allocate inventory from backorders, five will be assigned from expected inventory, while five from on-hand inventory will be recorded in the QTYALLOCBACKORDER column.