Not found cases
Step 1: Listen to the rejected event from WMS.
{
"resource": "shipment",
"eventType": "PUT",
"eventSubType": "rejected",
"accountSlug": "pidilite",
"accountId": null,
"actor": "SYSTEM",
"version": "v1",
"request_data": [],
"response_data": {
"customerOrderNumber": "8ff9f88e-a488-485c-9e0f-c160c33afb32",
"orderSiteID": "",
"vendorOrderNumber": "OD326981345883952100",
"externalShipmentID": "OD326981345883952100-1055-420",
"externalWarehouseID": "Gurgaon_FC",
"externalChannelID": "CH1055",
"externalWmsChannelName": "FLIPKART_PIDILITE_AGGN_2235",
"external_wms_channel_id": 2235,
"channelLabel": "Flipkart",
"integrationType": "6",
"vendorPartyID": null,
"partner_as2_id": null,
"defaultWarehouseCode": "Gurgaon_FC",
"facilityLabel": "Gurgaon (AGGN)",
"facilityType": "auperator",
"orderDate": "2023-01-06 04:05:43",
"portal_id": 1,
"paymentType": "COD",
"expectedShipDate": "2023-01-06 16:01:00",
"dispatchAfterDate": "2023-01-06 04:11:44",
"externalManifestNumber": null,
"channelManifestNumber": null,
"order_id": 46612855,
"channel_id": 1055,
"warehouse_id": 650,
"channel_account_id": 0,
"account_id": 439,
"connectionId": 144,
"locationId": "LOC21b921dfd2ff42fb9267182724e37f1e",
"region": "National",
"isMetro": "0",
"isSpecialplace": "0",
"shippingConnectionId": null,
"picklistCode": null,
"invoiceNumber": "",
"boxType": "UNKNOWN",
"isPriorityShipment": "0",
"isGift": "0",
"invoice_url": "",
"invoiceDate": null,
"label_url": "",
"labels": "",
"shippingInfo": [],
"boxAdditionalRecommendation": [],
"dimension_length": "10.2",
"dimension_width": "9",
"dimension_height": "5",
"weight": "200",
"trackingID": "",
"trackingDomain": "",
"packageID": "",
"barcode": "",
"taxAmount": 0,
"shipChargeAmount": 0,
"courierName": "",
"cp_id": 0,
"created_at": "2023-01-06 19:50:35",
"updated_at": "2023-01-06 19:51:16",
"status": "rejected",
"remarks": "fulfillment_cancel",
"warehousePincode": "122503",
"thirdPartyShipping": true,
"customerName": "SURESH",
"customerContactNumber": "9999999999",
"email": "xyz@gmail.com",
"channelSlug": null,
"status_updated_at": "2023-01-06 19:52:03",
"status_log": {
"created": "2023-01-06 19:50:35",
"accepted": "2023-01-06 19:51:03",
"rejected": "2023-01-06 19:52:03"
},
"status_log_first_occurrence": {
"rejected": "2023-01-06 19:52:03",
"accepted": "2023-01-06 19:51:03",
"created": "2023-01-06 19:50:35"
},
"status_log_count": {
"created": 1,
"accepted": 1,
"rejected": 1
},
"status_log_id": "108342981",
"orderExternalCreatedAt": "2023-01-06 04:10:07",
"shippingAddress": {
"customerName": "SURESH",
"addressLine1": "SHIVCHHATRAPATI NAGAR CHIKHLI ROAD BULDANA (MH)",
"addressLine2": "",
"city": "Buldana",
"state": "Maharashtra",
"postalCode": "443001",
"countryCode": "IN",
"countryName": "India",
"contactPhone": "9999999999",
"email": "xyz@gmail.com"
},
"warehouseAddress": {
"addressLine1": "MJ Logistics Private Limited, Seabird Marine Services Pvt Ltd",
"addressLine2": "Village Babra Bakirpur, Pataudi Road Near Adani Logistic Park, ICD Patli, Gurgaon, Haryana(122503)",
"city": "Gurgaon",
"state": "Haryana",
"postalCode": "122503",
"gstin": "06AAFCB0498R2Z2"
},
"id": 14691779,
"isCOD": "1",
"track_payload": [],
"items": [
{
"order_item_id": 28313098,
"lineItemSequenceNumber": "326981345883952100",
"orderItemID": "326981345883952100-28313098",
"itemID": "DROFSGQTMV253QBZ",
"sku": "15WUX3GY7FN",
"asin": "",
"productName": "Pidilite D KLOG DRAIN CLEANER 5 pcs set Powder Drain Opener 200 g",
"quantity": 1,
"orderItemCreatedAt": "2023-01-06 04:10:07",
"customerPrice": 100,
"lineItemTotal": 100,
"invoiceTotal": 100,
"cashOnDeliveryCharges": 0,
"discount": 0,
"taxRate": 0,
"taxAmount": 0,
"inventoryItemCode": "",
"giftMessage": "",
"isGift": "0",
"giftLabelContent": "",
"lineItemOrderStatus": "not_found",
"orderItemIDs": [
"326981345883952100-28313098"
],
"productImageUrl": null,
"productAdditionalInfo": {
"breadth": 5,
"length": 9,
"weight": 0.20000000000000001,
"height": 10.199999999999999
},
"expectedDeliveryDate": null,
"shippingCharges": 0,
"productUrl": null,
"originalOrderItemId": null,
"isVirtualKit": "1",
"component": [
{
"inventoryItemCode": null,
"productAdditionalInfo": "",
"whOrderItemID": null,
"esin": "07ORV3GQM64"
}
],
"onhold": "0",
"cancellationAdditionalReason": "",
"cancellationReason": "",
"customerOrderItemID": "",
"recallBlockedInventoryUsed": "",
"externalWarehouseID": "Gurgaon_FC",
"inventoryStatus": "Fulfillable",
"status": "FULFILLABLE"
}
]
},
"previous_data": [],
"resource_type": "shipment.update",
"account_slug": "pidilite",
"custom": []
}
Check if eventSubType
= 'rejected' and status_log
object contains ‘accepted’ and ‘rejected’ statuses. If the status_log contains accepted and rejected status then only proceed further else do nothing.
If the status_log object contains both accepted and rejected statuses, it means the order was marked not found.
Step 2: Fetch the customer order number from the event and Call the get shipping package details API to get the saleOrderCode.
Unicommerce getShippingPackageDetails API URL:
https://{{tenant}}.unicommerce.com/services/rest/v1/oms/shippingPackage/getShippingPackageDetails
Sample request body:
{
"shippingPackageCode": "BHZMUM14211"
}
Sample headers:
Authorization : Bearer 745cd087-cc62-4418-8b72-67e73f45f1a7
facility : {{facilityId}} eg: Warehouse
Sample response body:
{
"successful": true,
"message": null,
"errors": [],
"warnings": null,
"shippingPackageDetailDTO": {
"code": "BHZMUM14211",
"channelShipmentCode": null,
"saleOrderCode": "16668482763151334273",
"statusCode": "PACKED",
"shippingManifestCode": null,
"actualWeight": 0.000,
"boxWidth": 300,
"boxHeight": 30,
"boxLength": 360,
"collectableAmount": 0.00,
"collectedAmount": null,
"shippingProvider": null,
"trackingNumber": null,
"ewbNo": null,
"ewbDate": null,
"ewbValidTill": null,
"saleOrderDetails": {
"code": "16668482763151334273",
"displayOrderCode": "16668482763151334273",
"channel": "FYND_BEINGHUMAN_ZMUM",
"source": "FYND",
"displayOrderDateTime": 1666848276000,
"status": "CANCELLED",
"created": 1666848377000,
"updated": 1668501583000,
"fulfillmentTat": 1667021174000,
"notificationEmail": "test@test.test",
"notificationMobile": "8233217440",
"customerGSTIN": null,
"cod": true,
"priority": 0,
"currencyCode": "INR",
"customerCode": null,
"billingAddress": {
"id": "5467731",
"name": "Gourav Sharma",
"addressLine1": "36,sainik colony near asg hospital, 36,Sainik colony",
"addressLine2": null,
"city": "Nagaur",
"district": null,
"state": "RJ",
"country": "IN",
"pincode": "341001",
"phone": "8233217440",
"email": null,
"type": null
},
"addresses": [
{
"id": "5467731",
"name": "Gourav Sharma",
"addressLine1": "36,sainik colony near asg hospital, 36,Sainik colony",
"addressLine2": null,
"city": "Nagaur",
"district": null,
"state": "RJ",
"country": "IN",
"pincode": "341001",
"phone": "8233217440",
"email": null,
"type": null
},
{
"id": "5467730",
"name": "Gourav Sharma",
"addressLine1": "36,sainik colony near asg hospital, 36,Sainik colony",
"addressLine2": null,
"city": "Nagaur",
"district": null,
"state": "RJ",
"country": "IN",
"pincode": "341001",
"phone": "8233217440",
"email": null,
"type": null
}
],
"customFieldValues": null
},
"saleOrderItems": [
{
"id": 8941040,
"shippingPackageCode": "BHZMUM14211",
"shippingPackageStatus": "PACKED",
"facilityCode": "Eshopbox_ZMUM",
"facilityName": "Eshopbox_Mumbai",
"alternateFacilityCode": null,
"reversePickupCode": null,
"shippingAddressId": 5467730,
"packetNumber": 0,
"combinationIdentifier": null,
"combinationDescription": null,
"type": "NORMAL",
"item": null,
"shippingMethodCode": "STD",
"itemName": "BHDI22004-DARK TONE-81 CM/30",
"itemSku": "30CL63GZ2RL",
"sellerSkuCode": "8905271136446",
"channelProductId": "BHDI22004-DARK TONE|30",
"imageUrl": null,
"statusCode": "CANCELLED",
"code": "20200068-1",
"shelfCode": null,
"totalPrice": 50.00,
"sellingPrice": 50.00,
"shippingCharges": 0.00,
"shippingMethodCharges": 0.00,
"cashOnDeliveryCharges": 0.00,
"prepaidAmount": 50.00,
"voucherCode": null,
"voucherValue": 0.00,
"storeCredit": 0.00,
"discount": 0.00,
"giftWrap": true,
"giftWrapCharges": 0.00,
"taxPercentage": null,
"giftMessage": "",
"cancellable": false,
"editAddress": false,
"reversePickable": false,
"packetConfigurable": false,
"created": 1666848377000,
"updated": 1667306571000,
"onHold": false,
"saleOrderItemAlternateId": null,
"cancellationReason": "Price",
"cancelledBySeller": null,
"pageUrl": null,
"color": null,
"brand": "Being Human",
"size": "81 CM/30",
"replacementSaleOrderCode": null,
"bundleSkuCode": null,
"customFieldValues": null,
"itemDetailFieldDTOList": [],
"hsnCode": "62034200",
"totalIntegratedGst": 0,
"integratedGstPercentage": 0,
"totalUnionTerritoryGst": 0,
"unionTerritoryGstPercentage": 0,
"totalStateGst": 0,
"stateGstPercentage": 0,
"totalCentralGst": 0,
"centralGstPercentage": 0,
"maxRetailPrice": 3799.00,
"sellingPriceWithoutTaxesAndDiscount": 0,
"batchDTO": null,
"shippingChargeTaxPercentage": 0,
"tcs": 0,
"ucBatchCode": null,
"channelMrp": null,
"channelExpiryDate": null,
"channelVendorBatchNumber": null,
"channelMfd": null,
"countryOfOrigin": null,
"expectedDeliveryDate": null,
"itemDetailFields": {},
"channelSaleOrderItemCode": "20200068",
"effectiveTolerance": null
}
]
}
}
Step 3: Extract the saleOrderCode and saleOrderItemCodes from the get shippingPackageDetails API.
Step 4: Call the cancel API to cancel the order on UC.
https://documentation.unicommerce.com/docs/saleorder-cancel.html
Url: /services/rest/v1/oms/saleOrder/cancel
Headers: bearer b30f3aea-7978-49bb-9ea7-33eddfc80afa
Request body:
{
"saleOrderCode": "string",
"saleOrderItemCodes": [
"string"
],
"cancelPartially": true,
"cancelOnChannel": true,
"cancellationReason": "string"
}
Key mapping:
Request Body of cancel order | Response of get shipping package details API |
|
---|---|---|
|
| Mandatory |
|
| Non-mandatory |
| true/false | Non-mandatory |
| true/false | Non-mandatory |
|
|
|
Sample response:
Step 5: Adjust the inventory on Unicommerce for the SKUs in the order.
Call the get blocked inventory API to get the blocked and available inventory count on UC.
URL:
https://{tenant_name}.unicommerce.com/ /services/rest/v1/inventory/inventorySnapshot/get
Headers:
'Authorization: bearer c7f8a47d-00ae-4f58-83c2-9899b4c105de'
'facility: CMUM'
'Content-Type: application/json'
Sample request body:
{
"itemTypeSKUs":["S221FEJERXL","S246FECAPO"]
}
Sample response body:
{
"successful": true,
"message": null,
"errors": [],
"warnings": [],
"inventorySnapshots": [
{
"itemTypeSKU": "S221FEJERXL",
"inventory": 28,
"openSale": 0,
"openPurchase": 0,
"putawayPending": 0,
"inventoryBlocked": 2,
"pendingStockTransfer": 0,
"vendorInventory": 0,
"virtualInventory": 0,
"pendingInventoryAssessment": 0
},
{
"itemTypeSKU": "S246FECAPO",
"inventory": 449,
"openSale": 0,
"openPurchase": 0,
"putawayPending": 0,
"inventoryBlocked": 2,
"pendingStockTransfer": 0,
"vendorInventory": 0,
"virtualInventory": 0,
"pendingInventoryAssessment": 0
}
]
}
Loop through the item skus received in response and get the available and blocked inventory for each sku.
Available inventory |
|
Blocked inventory |
|
Calculate the quantity to update on UC as follows.
Quantity to update on UC = Available Qty on UC + Blocked Qty on UC - putaway pending quantity.
Step 6: Call the inventory adjustment API of UC to adjust the inventory on UC.
Sample API:
https://{tenant_name}.unicommerce.com/services/rest/v1/inventory/adjust/bulk
Key mapping:
Keys | Values |
---|---|
|
|
|
|
| " |
| “REPLACE” |
| locationId |
|
|
| “ |
Sample request Body:
{
"inventoryAdjustments": [
{
"itemSKU": "test_inventory_check",
"quantity": 130,
"facilityCode": "Test",
"shelfCode": "default",
"inventoryType": "GOOD_INVENTORY",
"transferToShelfCode": "Yes",
"adjustmentType": "REPLACE",
}
]
}
Sample response:
{
"successful": true,
"message": null,
"errors": null,
"warnings": null,
"inventoryAdjustmentResponses": [
{
"facilityInventoryAdjustment": {
"itemSKU": "test_inventory_check",
"quantity": 130,
"shelfCode": "default",
"inventoryType": "GOOD_INVENTORY",
"transferToShelfCode": "Yes",
"sla": null,
"batchCode": null,
"adjustmentType": "REPLACE",
"remarks": null,
"forceAllocate": true,
"facilityCode": "Test"
},
"successful": true,
"errors": []
}
]
}