/
Unicommerce Cancel Order Handling

Unicommerce Cancel Order Handling

STEPS:

Step1. As the request is received from the order processing flow, prepare the getShippingPackage URL and check if the error message: “"UNABLE_TO_FETCH_SHIPPING_PROVIDER_INFORMATION.Request Rejected: Order UXW0Tk3bz has been cancelled.\" is received on flex.
Request Body received from order processing:

{ "vendorOrderNumber": "406-7331355-0418740", "customerOrderNumber": "AGGN24343", "connectionId": 804, "externalWmsChannelId": 1666, "externalShipmentID": "AGGN24343-1487-67", "thirdPartyShipping": true }

Step2: The getShippingPackage API is called after extracting the input fields(connectionId, customerOrderNumber, etc) from the above response.

POST 'https://{{tenantName}}/services/rest/v1/oms/shippingPackage/getShippingPackageDetails'

Sample Curl:

curl --location 'https://{{tenantName}}/services/rest/v1/oms/shippingPackage/getShippingPackageDetails' \ --header 'Authorization: Bearer d1dea62c-91fe-4b06-ab56-f0f0b8ba3996' \ --header 'facility: AGGN' \ --header 'Content-Type: application/json' \ --data '{ "shippingPackageCode": "AGGN24343" }

Sample Request Body:

{ "shippingPackageCode": "AGGN24343" }

Response Body:

{ "successful": true, "message": null, "errors": [], "warnings": null, "shippingPackageDetailDTO": { "code": "AGGN24343", "channelShipmentCode": null, "saleOrderCode": "UV8yczBzs", "statusCode": "PACKED", "shippingManifestCode": null, "actualWeight": 900.000, "boxWidth": 292, "boxHeight": 25, "boxLength": 384, "collectableAmount": null, "collectedAmount": null, "shippingProvider": null, "trackingNumber": null, "ewbNo": null, "ewbDate": null, "ewbValidTill": null, "saleOrderDetails": { "code": "UV8yczBzs", "displayOrderCode": "406-7331355-0418740", "channel": "COCOBLU_GGN", "source": "CLOUDTAIL", "displayOrderDateTime": 1679634781000, "status": "PROCESSING", "created": 1679635883000, "updated": 1679635921000, "fulfillmentTat": 1679733000000, "notificationEmail": "", "notificationMobile": "9599134215", "customerGSTIN": null, "cod": false, "priority": 0, "currencyCode": "INR", "customerCode": null, "billingAddress": { "id": "6345509", "name": "Cocoblu Retail Limited", "addressLine1": "First Floor, H. No. 9, Village Hauz Khas", "addressLine2": "", "city": "Delhi", "district": null, "state": "HR", "country": "IN", "pincode": "110016", "phone": "9999999999", "email": null, "type": null }, "addresses": [ { "id": "6345509", "name": "Cocoblu Retail Limited", "addressLine1": "First Floor, H. No. 9, Village Hauz Khas", "addressLine2": "", "city": "Delhi", "district": null, "state": "HR", "country": "IN", "pincode": "110016", "phone": "9999999999", "email": null, "type": null }, { "id": "6345508", "name": "Lakshay", "addressLine1": "F-85, Venus Apartment, Sector 9 Rohini", "addressLine2": "New Delhi", "city": "NEW DELHI", "district": null, "state": "DL", "country": "IN", "pincode": "110085", "phone": "9599134215", "email": null, "type": null } ], "customFieldValues": null }, "saleOrderItems": [ { "id": 12327256, "shippingPackageCode": "AGGN24343", "shippingPackageStatus": "PACKED", "facilityCode": "AGGN", "facilityName": "Eshopbox Gurgaon AGGN", "alternateFacilityCode": null, "reversePickupCode": null, "shippingAddressId": 6345508, "packetNumber": 0, "combinationIdentifier": null, "combinationDescription": null, "type": "NORMAL", "item": null, "shippingMethodCode": "STD", "itemName": "RMSV10919-N786F039", "itemSku": "39GEW3H1KD9", "sellerSkuCode": "B0B5Z161MB", "channelProductId": "B0B5Z161MB", "imageUrl": null, "statusCode": "FULFILLABLE", "code": "1-1", "shelfCode": null, "totalPrice": 1199.60, "sellingPrice": 1199.60, "shippingCharges": 0.00, "shippingMethodCharges": 0.00, "cashOnDeliveryCharges": 0.00, "prepaidAmount": 0.00, "voucherCode": null, "voucherValue": 0.00, "storeCredit": 0.00, "discount": 0.00, "giftWrap": null, "giftWrapCharges": 0.00, "taxPercentage": null, "giftMessage": null, "cancellable": true, "editAddress": false, "reversePickable": false, "packetConfigurable": false, "created": 1679635883000, "updated": 1679773353000, "onHold": false, "saleOrderItemAlternateId": null, "cancellationReason": null, "cancelledBySeller": null, "pageUrl": null, "color": "Dark Green", "brand": "Raymond", "size": "39", "replacementSaleOrderCode": null, "bundleSkuCode": null, "customFieldValues": null, "itemDetailFieldDTOList": [], "hsnCode": "", "totalIntegratedGst": 0, "integratedGstPercentage": 0, "totalUnionTerritoryGst": 0, "unionTerritoryGstPercentage": 0, "totalStateGst": 0, "stateGstPercentage": 0, "totalCentralGst": 0, "centralGstPercentage": 0, "maxRetailPrice": 2999.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": "1", "effectiveTolerance": null } ] } }

Step3. If the error message is received from the above API, prepare the cancelOrder API.
API Request and Response Field Mapping:

Unicommerce Keys

Mapped Keys

Mandatory

Unicommerce Keys

Mapped Keys

Mandatory

saleOrderCode

shippingPackageDetailDTO.saleOrderCode

Y

saleOrderItemCodes

shippingPackageDetailDTO.saleOrderItems.Code

N

cancelPartially

Boolean Type (true if cancellation is partial)

N

cancelOnChannel

Boolean Type (true if cancellation is on channel)

N

cancellationReason

Reason for cancellation

N

Step4. The cancelOrder API is called.

POST 'https://{{tenantName}}/services/rest/v1/oms/saleOrder/cancel

Request Body:

{ "saleOrderCode": "string", "saleOrderItemCodes": [ "string" ], "cancelPartially": true, "cancelOnChannel": true, "cancellationReason": "string" }

Response Body:

{ "successful": true, "message": "string", "errors": [ { "code": 0, "fieldName": "string", "description": "string", "message": "string", "errorParams": { "additionalProp1": {}, "additionalProp2": {}, "additionalProp3": {} } } ], "warnings": [ { "code": 0, "message": "string", "description": "string" } ] }

Related content