/
Request Mapping with Unicommerce for Esb shipping create order

What is the purpose of this article ?

This is a sub document of the the main doc Shipping App
https://auperator.atlassian.net/wiki/spaces/ordershippingengine/pages/4466278404

The purpose of this article is to convert the request body from unicommerce to the desired create order request.

Flow Diagram

What are the steps to achieve this task ?

  1. An API will be exposed which unicommerce where unicommerce will send POST request for label generation. The post request body has been menytioned in step 3.

    1. Api details

      1Endpoint: /waybill 2Request Type: POST 3Scheme: HTTPS 4Header (content-type) application/json 5Header (Authorization): token (got from SP Authentication)
  2. Check if source = unicommerce

  3. Map the unicommerce keys with our desired create order request.

    1{ 2 "serviceType": "String",------------------------> shippngMode (Eshopbox Standard/ Eshopbox express) 3 "Shipment": { 4 "code": "String",-----------------------------> M-----shipmentID 5 "SaleOrderCode": "String",--------------------> M 6 "orderCode": "String",------------------------> M-----customerOrderId 7 "channelCode": "String",------------------------------channelId 8 "channelName": "String", 9 "source": "unicommerce",------------------------------orders.origin 10 "customField" : [], 11 "invoiceCode": "String",------------------------------invoice.number 12 "orderDate": "16-Sep-2021 00:00:00",----------> M-----orderDate 13 "fullFilllmentTat": "18-Sep-2021 00:00:00", 14 "weight": "53.4000",--------------------------> M------shipmentDimensions.weight 15 "length": "30",-------------------------------> M------shipmentDimensions.length 16 "height": "10",-------------------------------> M------shipmentDimensions.height 17 "breadth": "15",------------------------------> M------shipmentDimensions.breadth 18 "numberOfBoxes": "1",-------------------------> M - 19 "items": [ - 20 { - 21 "name": "String",-------------------------> M------items.productTitle 22 "description": "String",------------------> M - 23 "quantity": 2,----------------------------> M------items.quantity 24 "skuCode": "string",----------------------> M------items.itemID 25 "itemPrice": 600.00,----------------------> M------items.itemTotal 26 "imageURL": "string",------------------------------items.productImageUrl) (to be added in our request) 27 "hsnCode": "string",-------------------------------items.hsn 28 "tags": "string", 29 "brand": "string", 30 "color": "string", 31 "category": "string", 32 "size": "string", 33 "item_details": "string", 34 "ean": ""------------------------------------------items.ean 35 }, 36 { 37 "name": "String", 38 "description": "String", 39 "quantity": 1, 40 "skuCode": "string", 41 "itemPrice": 600.00, 42 "imageURL": "string", 43 "hsnCode": "string", 44 "tags": "string", 45 "brand": "string", 46 "color": "string", 47 "category": "string", 48 "size": "string", 49 "item_details": "string", 50 "ean": "" 51 } 52 ] 53 }, 54 "deliveryAddressId": "String", 55 "deliveryAddressDetails": { 56 "name": "String",------------------> M-----shippingAddress.customerName 57 "email": "String",-----------------> M-----shippingAddress.email 58 "phone": "8888888888",-------------> M-----shippingAddress.contactPhone 59 "address1": "String",--------------> M-----shippingAddress.addressLine1 60 "address2": "String",----------------------shippingAddress.addressLine2 61 "pincode": "122016",---------------> M-----shippingAdress.pincode 62 "city": "Gurgaon",-----------------> M-----shippingAdress.city 63 "state": "Haryana",----------------> M-----shippingAdress.state 64 "country": "India",----------------> M-----shippingAdress.country 65 "stateCode": "HR",-----------------> M 66 "countryCode": "IN",---------------> M 67 "gstin": "string",-------------------------shippingAdress.gstin 68 "alternatePhone": "9090909090", 69 "district": "" 70 }, 71 "pickupAddressId": "String",---------------> pickupLocation.locationCode 72 "pickupAddressDetails": { 73 "name": "String",------------------> M-----pickupLocation.locationName 74 "email": "String",-----------------> M 75 "phone": "9999999999",-------------> M-----pickupLocation.contactNumber 76 "address1": "String",--------------> M-----pickupLocation.addressLine1 77 "address2": "String",----------------------pickupLocation.addressLine1 78 "pincode": "400092",---------------> M-----pickupLocation.pincode 79 "city": "Mumbai",------------------> M-----pickupLocation.city 80 "state": "Maharashtra",------------> M-----pickupLocation.state 81 "country": "India",----------------> M 82 "stateCode": "MH",-----------------> M 83 "countryCode": "IN",---------------> M 84 "gstin": "string"--------------------------pickupLocation.gstin 85 86 }, 87 "returnAddressId": "String", 88 "returnAddressDetails": { 89 "name": "String",------------------> M 90 "email": "String", 91 "phone": "9999999999",-------------> M 92 "address1": "String",--------------> M 93 "address2": "String", 94 "pincode": "400092",---------------> M 95 "city": "Mumbai",------------------> M 96 "state": "Maharashtra",------------> M 97 "country": "India",----------------> M 98 "stateCode": "HR",-----------------> M 99 "countryCode": "IN",---------------> M 100 "gstin": "string"------------------> M 101 }, 102 "currencyCode": "INR",---------------> M 103 "paymentMode": "PREPAID",------------> M----isCOD 104 "totalAmount": "200.00",-------------> M----invoiceTotal 105 "collectableAmount": "0",------------> M----balanceDue 106 "courierName": "String", 107 "customField": [ 108 { 109 "name": "String", 110 "value": "String" 111 }, 112 { 113 "name": "String", 114 "value": "String" 115 } 116 ] 117}
  4. Esb shipping order core flow will work which will generate label and make entries in DB.

  5. Return the label details in response of the API. Response remains same as the response of our core flow

    1success Response :- 2{ 3 "courierName": "Self", 4 "waybill": "874320208625", 5 "label_url": "https://storage.googleapis.com/eshopbox_wms_uploads_staging/myntraLabel/202405061317301511071119.pdf", 6 "shipmentId": "wdcTest_54-5865-9684", 7 "routingCode": "ASB-ZBX", 8 "labelStream": "", 9 "shippingMode": "Express" 10} 11Failure Response we are returning :- 12{ 13 "errors": [ 14 { 15 "code": "400", 16 "message": "Label couldn't be generated due to pincode not serviceable" 17 } 18 ] 19} 20 21This is the expected failure response for Unicommerce. Need to discuss 22 23{ 24 "status":"FAILED", 25 "reason":"String", 26 "message":"String" 27}



1. IN pickupAddressDetailscontact person, location name to be kept mandatory?