Immediate status to reflect in UI
What is the purpose of this article?
The purpose of this article is to fix the below issue occurring on the workspace
When an order item is cancelled from a workspace, its status does not change to cancelled immediately - to be developed in order-return service
When the label is uploaded for any shipment from a workspace, its details do not reflect in UI immediately. - change to be made in existing API in order-return service
When RTO is initiated for any order item from a workspace, its status does not change to rto_requested immediately.
When the return is cancelled from a workspace or any order item, it redirects to POE. In this case, the order items status does not change to latest forward status (or pickup cancelled in some cases) immediately.
This document will thoroughly discuss the logic and technical implementation to fix this issue.
Current Implementation
Cancel order
Cancel-order API and details
project - prod: eshopbox-2018, stgaing: eshopbox-wms-staging service - eshopbox-wms-api Endpoint - cancelOrderController.php Api Type and path - POST /api/cancel-order
Request Body from Frontend
POST Api curl --location 'https://eshopbox-wms-api-dot-eshopbox-wms-staging.el.r.appspot.com/api/cancel-order' \ --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlJVVXdSREZCUVRSRFFqQkdORFUxTVVZeE16ZEdPRFJHTnpORk5EaEJSVEU0TVVORk5qVTJOdyJ9.eyJodHRwczovL2FwcERhdGEiOnt9LCJodHRwczovL3VzZXJEZXRhaWxzIjp7ImlkIjoxNzIwLCJ1c2VyVHlwZSI6ImRlZmF1bHQiLCJlbWFpbCI6InNhdXJhdi5rdW1hckBlc2hvcGJveC5jb20ifSwiaHR0cHM6Ly9hY2NvdW50cyI6WyJibGFja2JlcnJ5cyIsIm1vbnRlY2FybG8iLCJ0ZXN0X3Rlc3RfYWplZXQiLCJ0YWIiLCJzYXVyYXYiLCJ0ZXN0c3RhZ2luZyIsInRlc3RfdGVzdF9hamVldG9yZGVydGVhbSIsInRhYm9yZGVydGVhbWZjbmV3Il0sImh0dHBzOi8vd2FyZWhvdXNlV29ya3NwYWNlcyI6WyJ0ZXN0c3RhZ2luZyIsInRlc3RfdGVzdF9hamVldG9yZGVydGVhbSIsInRhYm9yZGVydGVhbWZjbmV3Il0sImh0dHBzOi8vd2FyZWhvdXNlcyI6W10sImh0dHBzOi8vcGFydG5lcnMiOltdLCJpc3MiOiJodHRwczovL2VzaG9wYm94LXBheW1lbnQtcmVjby5hdXRoMC5jb20vIiwic3ViIjoiZW1haWx8NjEyZTE0NWVkNjQ5NmZjZjY2OTVmMTcxIiwiYXVkIjpbImh0dHBzOi8vZXNob3Bib3gtcG9ydGFsLWRldi5hcHBzcG90LmNvbSIsImh0dHBzOi8vZXNob3Bib3gtcGF5bWVudC1yZWNvLmF1dGgwLmNvbS91c2VyaW5mbyJdLCJpYXQiOjE2ODQ0MzMyNDcsImV4cCI6MTY4NDUxOTY0NSwiYXpwIjoiVFNIMlRYeDdXdmZ4NmhwcElGZnpsNWNiMU1HcXY5VnAiLCJzY29wZSI6Im9wZW5pZCBwcm9maWxlIGVtYWlsIn0.jMpUeLQKlOlzaj0Jn6AMOCOcq5YH40CRHIXAIXb_VUd_Icdb3QWbloFFtxmYb6Jre-6R2yDGvgEAqhoHrlSorlaBqTixb1L_iq_XRSASF2iv8OMW-xlUrf3N8dubPVLxAkBWOImfV0C8OY91dcPASWx7uMauTOfyudSDAszbKb_uTrtHxpjAfEfv773gAo-Cw2p2x-LsdayrMPQhOAW9yIW9y1I2vcC7ogv9pq6WNMYHkPtcSjHIHGJpjQLMdoBchwUjZXHvVeXPfSJG142CT5jujWFl5oVQXCR_IcMcEIG0L8vDzl4IoUVUmdpn1RQGl1qI2xDpbPyWPrqkxMs73g' \ --header 'ProxyHost: tab' \ --header 'Content-Type: application/json' \ --data '{ "externalChannelID": "CH5865", "customerOrderNumber": "DFA2583", "reason": "Flagged as Fraudulent order", "remarks": "fulfillment_cancel", "notifyCustomer": "", "items": [ { "orderItemID": "DFA2583-23949805", "itemID": "TestUnderInvestigationImportBase2", "quantity": 1, "remark": "" } ] }'
Current Response from cancel-order API to frontend :-
{ "status": "SUCCESS", "result": { "externalChannelID": "CH5865", "customerOrderNumber": "DFA2583", "vendorOrderNumber": "DFA2583", "reason": "Flagged as Fraudulent order", "cancellationTime": null, "is_cod": "0", "items": [ { "lineItemSequenceNumber": 1, "itemID": "TestUnderInvestigationImportBase2", "quantity": 1, "productName": "Multi color jersey tee", "remark": "Flagged as Fraudulent order", "lineItemTotal": 950 } ] } }
New Response Body required by Frontend from order-cancel API - Note - As discussed with @Anup Kumar (Unlicensed) , only the below 'M' (mandatory) keys will be sent as response to Frontend
Technical document to achieve this task - Cancelled status to reflect immediately in workspace
{ "account": "tab", "customerOrderNumber": "DFA2583", "vendorOrderNumber": "DFA2583", "orderItemID": "DFA2583-23949805",----------------------------M "orderItemId_PK": 23949805, "orderStatus": "Cancelled",-----------------------------------M "orderItemStatus": "CANCELLED", "onHold": "0", "thirdPartyShipping": "0", "customerDetails": { "shippingCustomerName": "Prasanthi", "shippingContactPhone": "7022880555", "shippingEmail": "prasanthireddy532@gmail.com", "shippingCity": "bengaluru", "shippingState": "KARNATAKA", "shippingPostalCode": "560067", "billingCustomerName": "Prasanthi", "billingEmail": "prasanthireddy532@gmail.com", "billingContactPhone": "7022880555", "billingCity": "bengaluru", "billingState": "KARNATAKA", "billingPostalCode": "560067" }, "orderDetails": {---------------------------------------------M "portalName": "Custom", "channelId": 5865, "saleChannel": "CH5865", "subChannel": "CH5865", "orderId": 44196901, "integrationType": "4", "isCod": "0", "orderDate": 1684406597000 }, "orderItemDetails": { "productFound": "Yes", "channelListingId": "TestUnderInvestigationImportBase2", "productName": "Slim fit blue shirt", "orderItemSku": "E232M3FNPXR", "ean": "TestUnderInvestigationImportBase2", "hsn": "61091000", "itemImageLink": "https://cdn.filestackcontent.com/7bO422rRUasGw23G24ig", "combo": "No", "esin": "E232M3FNPXR", "sku": "TestUnderInvestigationImportBase2", "mrp": 2000 }, "shipmentDetails": { "shipmentId": 11186984, "facilityCode": "Tab_Demo234", "invoiceTotal": 950, "shipmentNumber": "DFA2583-5865-1645", "trackingId": "", "courierName": "Eshopbox", "weight": 13, "warehouseName": "Demo234(Demo234)", "warehouseId": 846, "invoiceNumber": "", "onholdReasons": [] }, "shipmentTrackingDetails": { "status": "cancelled", "delayedDeliveryTag": "On time", "createdTimestamp": 1684426402000, "remarks": "fulfillment_cancel", "slaResolution": "No", "cancelledTimestamp": 1684433520000, "outForDeliveryAttempts": 0, "failedDeliveryAttempts": 0, "ndrActionAttempts": 0 }, "cancellationDetails": {-------------------------------------M "type": "Seller", "reason": "Flagged as Fraudulent order" }, "orderNewTimestamp": 1684426402000, "orderCancelledTimestamp": 1684433520000,--------------------M "rtsTag": "On time", "expectedShipDate": 1684492200000, "orderReceivedOn": 1684426399000, "updatedAt": 1684433520000, "returnFlag": "0", "riskScore": "Low", "riskScoreReasons": [], "override": true, "currentOrderStatus": "Cancelled",---------------------------M "objectID": "5865|DFA2583|DFA2583-23949805" }
Upload label
Upload label API and details
project - esb-client-order-return service - order-return Endpoint - InvoiceUploadEndPoint Api Type and path - POST /_ah/api/esb/v1/invoices
Request Body from Frontend for upload label Api
POST Api curl --location 'https://order-return-dot-eshopbox-client-portal-prod.appspot.com/_ah/api/esb/v1/invoices' \ --header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UaERRamxDUlRJelJVUTRRVU0wUVRJNU1FSkVOVGszUVVFeU5qVXdSa1JDTmpBeU16WTROQSJ9.eyJodHRwczovL2FwcERhdGEiOnt9LCJodHRwczovL3VzZXJEZXRhaWxzIjp7ImlkIjoxNjA3LCJ1c2VyVHlwZSI6ImRlZmF1bHQiLCJlbWFpbCI6InNhdXJhdi5rdW1hckBlc2hvcGJveC5jb20ifSwiaHR0cHM6Ly9hY2NvdW50cyI6WyJjbGFya3MiLCJlc2hvcCIsImJsYWNrYmVycnlzIiwibW9udGVjYXJsbyIsImR1a2UiLCJyYXltb25kIiwiYmhwYyIsImdyYXNpbSIsInRjbnMiLCJjb3ZlcnN0b3J5Iiwic3B5a2FyIiwib3ppdmEiLCJnYXVyYXYiLCJ6ZXJvcmlzcXVlIiwiZXZlcmJsdWUiLCJ2aXRhbWlucGxhb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pfD5KUUAtl4gtZUm94cJs19GFuY26TpAuBnYwHo_fdD60z53OVEDlSsgN_ojS41ZqZ0CvnDgqn3EtBYkGK4JbfIBF6kXRseoGQwNyPyLjURm52m8TwH0nKDAZxdpJWule1ueYLoYbD8XipKLdTP3oqWKVGVkrWy4vTF9ur86sdlS3NWqdzNxHVwKKj6o0izx1jBFPt2Z70RQ2Y93JYLQ_n1FQ4fM-CRDsFd_Oo1bZTDl5TBWlfoXjvw' \ --header 'proxyHost: quickstarttestvarun' \ --header 'Content-Type: application/json' \ --header 'Cookie: JSESSIONID=BlyhtK51MWQCWzKDUY86fg' \ --data '{ "trackingID": "Test435ABC1", "invoiceNumber": "Test", "courierName": "TestCourier", "externalShipmentID": "ORD50023-2355-6693", "labelUrl": "https://cdn.filestackcontent.com/slJ2U7TTrKJIT0o07mZh" }'
Current Response from upload label Api to frontend :-
{ "trackingID": "Test435ABC", "invoiceNumber": "Test", "courierName": "TestCourier", "externalShipmentID": "ORD50023-2355-6693", "labelUrl": "https://cdn.filestackcontent.com/slJ2U7TTrKJIT0o07mZh", "accountSlug": "quickstarttestvarun", "actor": "saurav.kumar@eshopbox.com", "invoiceDate"----------------------------------------Needed (not required) }
Technical document to make changes in Upload label APIUpload label details to reflect immediately on UI
Initiate return
Initiate return API and Details
project - poe-backend-service service - default Endpoint - ReturnOrderItemEndPoint Api Type and path - POST /_ah/api/esb/v2/order-item/returnOrder
Request Body from Frontend for Initiate return Api
{ "customerOrderNumber": "5346167226663", "isCOD": 0, "isExchange": 0, "refundMode": "originalPaymentMode", "refundBankAccountDetails": "", "exchangeItem": null, "item": { "actor": "Rekha D", "lineItemSequenceNumber": 13892564680999, "orderItemID": "5346167226663-23924447", "itemID": "46878743986471", "quantity": "1", "productName": "FailRts", "returnReason": "Item no longer wanted", "returnSubReason": "", "exchangeSize": "", "additionalInfo": { "customerUploadImageUrl": "", "comment": "" } }, "pickupAddress": { "city": "Gurugram", "countryCode": "IN", "postalCode": "122503", "addressLine1": "Plot 5, Sector 44 Post Nathupur, Gurgaon/Gurugram, Haryana India", "addressLine2": "5", "state": "Haryana", "countryName": "INDIA", "contactPhone": "918178431583", "customerName": "Rekha D", "email": "nomailprovided@gmail.com" } }
Current Response from Initiate return Api to frontend - no response to frontend
New Implementation: Technical document to handle real time sync issue after return is initiated: Approach to be taken to sync order item status after the return is created
Cancel pickup
Initiate return API and Details
project - poe-backend-service service - default Endpoint - OrderCancelEndPoint Api Type and path - POST /_ah/api/v2/order-items/return/cancel
Request Body from Frontend for Cancel pickup Api
{ "actor": "Sachin Gupta", "remarks": "I am starting to like the order", "customerOrderNumber": "5289967747361", "orderItemID": "5289967747361-30065517" }
Current Response from Cancel pickup Api to frontend - no response to frontend
New Implementation: Technical document to handle real time sync issue when return is cancelled : Approach to be taken to sync order item status after the return is cancelled