/
Handle partial cancellation flow - Ajio

Handle partial cancellation flow - Ajio

  1. Filter out AJIO order based on orderSiteID. If orderSiteID contains ‘AJIO’, then continue the flow else break.

  2. For an order, fetch the order_items for which we have received packed request only.

  3. Updated query to fetch order_items for a shipment

    SELECT shipments.id, orders.customerOrderNumber AS customerOrderNumber, order_items.orderItemID AS orderItemId, order_items.lineItemSequenceNumber AS lineItemSequenceNumber, order_items.itemID AS itemId, order_items.customerOrderItemID AS customerOrderItemID, channels.externalChannelID AS externalChannelID FROM orders LEFT JOIN order_items ON order_items.order_id = orders.id LEFT JOIN shipments ON shipments.id = order_items.shipment_id LEFT JOIN channels ON channels.id = orders.channel_id WHERE orders.customerOrderNumber ='BHAJIO00153' AND channels.connectionId = 944 AND order_items.status != 'CANCELLED' AND shipments.externalShipmentID = 'BHAJIO00153-1938-4263'

4. Fetch the order_items from the get shipping package details API of UC.

5. If the count of order_items from db and order_items from the shipment does not match, return the error stating mismatch in the order_items count.

 

Extended flow:

  1. If the mismatch occurs in the count of the order_items fetched from the DB and received from the response of API do the following:

    1. Replace the shipmentId for the mismatched order_items with 0.

    2. Call the cancel order API for the mismatched order_items only.

Related content