/
Vinculum Order Transformation Service

Vinculum Order Transformation Service

Objective: To listen to data from create-order and cancel-order PubSub topics and prepare the Eshopbox Create Order and Cancel Order Curl Request with the data given in the received event.

Sample Event Received would be like as follows:

{ "queueData": { "channelData": { "integrationType": "8", "storeSlug": "", "externalChannelId": "CH1200", "accountSlug": "eshop", "connectionId": "361", "location": { "804cde7b-bd2f-4a3e-923c-386715089fa1": "MJPAT_109", "8fc83148-5b97-49cf-b724-7c46d50946aa": "ESBBLR_111", "d1391379-8283-4335-a43c-0a2eb2fe2d21": "ESBMUM_112" }, "isActive": "active", "amzprime_workspaceToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UaERRamxDUlRJelJVUTRRVU0wUVRJNU1FSkVOVGszUVVFeU5qVXdSa1JDTmpBeU16WTROQSJ9.eyJodHRwczovL2FwcERhdGEiOnsiYXBwQ2xpZW50SWQiOiI3NDg4OWI3NDA5NGU2MTFlYmE3MjI4ODgwNmIzYzNjZCJ9LCJodHRwczovL2FjY291bnRTbHVnIjoiZXNob3AiLCJodHRwczovL3VzZXJEZXRhaWxzIjp7ImlkIjoxMDIxLCJ1c2VyVHlwZSI6ImRlZmF1bHQiLCJlbWFpbCI6ImFwcHVzZXIyOUBlc2hvcGJveC5jb20ifSwiaHR0cHM6Ly9hY2NvdW50cyI6WyJlc2hvcCJdLCJodHRwczovL3dhcmVob3VzZVdvcmtzcGFjZXMiOltdLCJodHRwczovL3dhcmVob3VzZXMiOltdLCJodHRwczovL3BhcnRuZXJzIjpbXSwiaXNzIjoiaHR0cHM6Ly9lc2hvcGJveC5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NjA2MmMxNjZiMTQ5YzgwMDY5ZGY1MjY2IiwiYXVkIjoiaHR0cHM6Ly93bXMubXllc2hvcGJveC5jb20iLCJpYXQiOjE2MzIwNDQ4MzEsImV4cCI6MTYzNDYzNjgzMSwiYXpwIjoiUXpWTzdmSGsySFl4Mlk1YjNXRG9pRHVHZTR2Q3dqSFAiLCJzY29wZSI6InJlYWQ6cHJvZHVjdHMgcmVhZDppbnZlbnRvcnkgcmVhZDpwcm9kdWN0X2xpc3RpbmdzIHdyaXRlOnByb2R1Y3RfbGlzdGluZ3MgcmVhZDpvcmRlcnMgd3JpdGU6b3JkZXJzIHJlYWQ6cmV0dXJucyB3cml0ZTpyZXR1cm5zIHJlYWQ6cGF5YWJsZXMgd3JpdGU6cGF5b3V0cyB3cml0ZTp0cmFuc2FjdGlvbl9ydWxlcyByZWFkOmN1c3RvbV9maWVsZHMgd3JpdGU6Y3VzdG9tX2ZpZWxkcyByZWFkOmxvY2F0aW9ucyB3cml0ZTpsb2NhdGlvbnMgcmVhZDpwb3J0YWwgd3JpdGU6cG9ydGFsIHJlYWQ6d29ya3NwYWNlIHJlYWQ6c2FsZXNfY2hhbm5lbCByZWFkOmZ1bGZpbGxtZW50X2NlbnRlciIsImd0eSI6InBhc3N3b3JkIn0.CqjOddltmRN_aZqNZAdKMCk7X5xJsG4j71pBAvFtbKg5uW8p-uuWLJyQ87dZgjM_9xq0mi3BxTHO2IYbNDX6xiD9F8H4Y9uCVUW7gmSOdfLcFzeNgLggiUo8hHi_pJK1HgZRspxA76ld0w97xNQAYbZpyl3cc-wdgIyrUO-kpoYetcZ2PW5fHYqQMLwh75OpnsGtsAekKcaOVcqVvSF1WfDNYDtV4H9lfKe0IzNFDQ8WQ18DSjvwvWWDSxQxSG9BTVa8d3NPKnEyTAhH9yeZTe6FCBk9T_8fwzbTaehZ_wvUFfYooQLMUCTUalQxjjOLiCiIZ4GDwF8ogOCMbLF0bA" }, "orderDetail": { "extOrderNo": "TSW17", "orderNo": "TSW17", "orderLocation": "TSW", "status": "Packed", "remarks": "", "grandtotal": "6598.000", "createdDate": "30/03/2022 19:02:58", "orderLineCount": "3", "itemcount": "2.000", "shippingaddress": "Sector 76 Noida", "mobileno": "9972462835", "is_giftwrap": "no", "giftwrap_msg": "", "giftwrap_charges": "0.000", "udf1": "", "udf2": "", "udf3": "", "udf4": "", "udf5": "", "udf6": "", "udf7": "", "udf8": "", "udf9": "", "udf10": "", "pickupLocation": "", "extDeliveryNo": "", "extManifestNo": "", "extInvNo": "", "shipState": "Delhi", "shipCountry": "India", "shipCity": "", "shipPinCode": "201307", "shipLatitude": "", "shipLongitude": "", "shipdetail": { "qty": "1", "transporter": "By Hand Delivery", "transporterstatusremark": "", "transporterstatus": "", "extTransCode": "", "obExtTransporterName": "", "shipdate": "", "updated_date": "31/03/2022 16:14:27", "delivereddate": "", "deliveryNumber": "TSW000159094", "fulfillmentLocation": "022", "tracking_number": "7548746857", "status": "Packed", "expdeldate_min": "", "expdeldate_max": "", "collectable_amount": "0", "allocation_date": "30/03/2022 19:02:59", "pick_date": "31/03/2022 09:55:08", "pack_date": "31/03/2022 16:14:27", "shipment_value": "3999.00", "picklistNo": "", "manifestNo": "", "handoverStatus": "", "invoiceNo": "KLKF-TSW-002", "proofOfDelivery": "", "dimensions": [ { "length": null, "breadth": null, "height": null, "weight": null }, { "length": "10.000", "breadth": "10.000", "height": "10.000", "weight": "0.500" } ], "item": [ { "lineno": "2", "extLineNo": "", "sku": "BLUE_TSHIRT", "status": "Packed", "order_qty": "1", "deliveryQty": "1", "wipQty": "1", "pickedQty": "1", "shippedQty": "0", "closedQty": "0", "closed_date": "", "returnedQty": "0", "deliveredQty": "0", "imageUrl": "", "itemName": "BLUE_TSHIRT", "price": "3999.00000", "binCode": "GOOD", "serialNo1": [ "" ], "serialNo2": [ "" ], "serialNo3": [ "" ], "lotno": "TSW000000006", "lottable01": "", "lottable02": "", "lottable03": "", "lottable04": "", "lottable05": "", "lottable06": "", "udf1": "", "udf2": "", "udf3": "", "udf4": "", "udf5": "", "discAmount": "0.00" } ] } } } }

Step 1. Now do the mapping as given below:

Mapping for the WMS order API:

Note: Data that is being pulled from orders[] can be inserted into shipDetail data which is returned from GET Shipment Detail API in the Default Service itself. In the following table, we are fetching showing orderDetails for illustration purposes.

No.

Keys in create order API

Keys in the channel data map or values set

No.

Keys in create order API

Keys in the channel data map or values set

1.

externalChannelID

externalChannelId

2.

customerOrderNumber

shipdetail[].deliveryNumber

3.

vendorOrderNumber

orders[].orderNo

4.

suggestedTrackingNumber

shipdetail[].tracking_number

5.

shipMethod

"STD"

6.

orderDate

orderDetail.createdDate

7.

isCOD

if orderDetail.paymentMethod == "COD" then "1" else "0"

8.

paymentType

orderDetail.paymentMethod

9.

taxAmount

orderList[].tax_amount

10.

shipChargeAmount

orderList[].shippingCharges

11.

expecedShipDate

shipDetail[].shipByDate

12.

subtotal

sum of lineItemTotal

13.

orderTotal

subTotal + shipChargeAmount

12.

balanceDue

if( isCOD == "1") then orderTotal

else 0

13.

shippingAddress

 

14.

shippingAddress.customerName

orderList[].customerName

15.

shippingAddress.addressLine1

orderList[].shipAddress1

16.

shippingAddress.addressLine2 (optional)

orderList[].shipAddress2

17.

shippingAddress.city

orderList[].shipCity

18.

shippingAddress.state

orderList[].shipState

19.

shippingAddress.postalCode

orderList[].shipPincode

20.

shippingAddress.countryCode

IN

21.

shippingAddress.countryName

orderList[].shipCountry

22.

shippingAddress.contactPhone

orderList[].shipPhone1

23.

shippingAddress.email

orderList[]shipEmail1

24.

billingAddress

 

25.

billingAddress.customerName

orderList[].billName

26.

billingAddress.addressLine1

orderList[].billAddress1

27.

billingAddress.addressLine2 (optional)

orderList[].billAddress2

28.

billingAddress.city

orderList[].billCity

29.

billingAddress.state

orderList[].billState

30.

billingAddress.postalCode

orderList[].billPincode

31.

billingAddress.countryCode

IN

32.

billingAddress.countryName

orderList[].billCountry

33.

billingAddress.contactPhone

orderList[].billPhone1

34.

billingAddress.email

orderList[].billEmail1

35.

items

shipDetailOrders[].items

36.

items.lineItemSequenceNumber

shipDetailOrders[].items[].lineno

37.

items.itemID

shipDetailOrders[].items[].sku

38.

items.customerOrderItemID

shipDetailOrders[].items[].lotno

39.

items.productName

shipDetailOrders[].items[].itemName

40.

items.customerPrice

shipDetailOrders[].items[].price inclusive tax (OrderNo: TSW6)

41.

items.discount

shipDetailOrders[].items[].discAmount

42.

items.productImageUrl

shipDetailOrders[].items[].imageUrl

43.

items.productUrl

NA

44.

items.quantity

shipDetailOrders[].items[].order_qty

45.

items.externalWarehouseID

location.{{facility}}

46.

thirdPartyShipping (optional)

"true"(Invoice & label will be fetched from Vinculum)

47.

orderSiteId

shipDetailOrders[].fulfillmentLocation

48.

suggestedCourierCode

shipDetailOrders[].transporter

 

Eshopbox Create Order API:

https://wms.eshopbox.com/api/order

Headers:

Key

Value

Key

Value

Authorization

Bearer {{channelConfigurationData.amzprime_workspaceToken}}

Content-type

application/json

The prepared WMS Request Body will look like as given below:

{ "vendorOrderNumber": "{{orders[].orderNo}}", "balanceDue": 0, "boxAdditionalRecommendation":{ "invoice_no":"{{shipDetailOrders[].invoiceNo}}", "AWB_No":"{{shipDetailOrders[].tracking_number}}" } "externalChannelID": "{{channelConfigurationData.externalChannelID}}", "expectedShipDate": "{{shipDetail[].shipDate", "customerOrderNumber": "{{shipDetail[].deliveryNo}}", "orderTotal": 2000.00, "paymentType": "{{orderList[].paymentMethod}}", "isCOD": "{{orderList[].paymentMethod}}", "subtotal": 2000.00, "shipMethod": "STD", "shippingAddress": { "city": "Herbertpur", "countryCode": "IN", "postalCode": "248142", "addressLine1": "Ice Factory", "addressLine2": "Ward Number 6", "countryName": "INDIA", "state": "Uttarakhand", "contactPhone": "919149261774", "customerName": "john", "email": "john@gmail.com" }, "thirdPartyShipping": true, "billingAddress": { "city": "Herbertpur", "countryCode": "IN", "postalCode": "248142", "addressLine1": "Ice Factory", "addressLine2": "Ward Number 6", "countryName": "INDIA", "state": "Uttarakhand", "contactPhone": "919149261774", "customerName": "John", "email": "john@gmail.com" }, "taxAmount": 0, "orderDate": "2022-03-01T14:46:49+05:30", "items": [ { "itemID": "43784617394370", "quantity": 1.0, "lineItemSequenceNumber": "1111", "discount": 0.0, "lineItemTotal": 1000.0, "customerPrice": 1000.0, "productName": "TestProduct1", "status": "CREATED" }, { "itemID": "43784615854274", "quantity": 1.0, "lineItemSequenceNumber": "2222", "discount": 0.0, "lineItemTotal": 1000.0, "customerPrice": 1000.0, "productName": "TestProduct2", "status": "CREATED" } ], "shipChargeAmount": 0.0 }

Note: Similarly, we can prepare the WMS Cancel Order API Request

Eshopbox Create Order API:

https://wms.eshopbox.com/api/cancel-order

Headers:

Key

Value

Key

Value

Authorization

Bearer {{channelConfigurationData.amzprime_workspaceToken}}

Content-type

application/json

Mapping with the WMS cancel API:

SQL Query to Fetch customerOrderNumber:

SELECT orders.customerOrderNumber from orders LEFT JOIN order_items on order_items.order_id = orders.id WHERE orders.channel_id= "" AND orders.vendorOrderNumber = "" AND order_items.itemID = "" AND order_items.lineItemSequenceNumber = ""

No.

WMS Cancel Order API Key

Vinculum Order API Keys

No.

WMS Cancel Order API Key

Vinculum Order API Keys

  1.  

externalChannelID

{{channelConfigurationData.externalChannelID}}

2.

customerOrderNumber

Fetch customerOrderNumber from DB using SQL Query

3.

reason

orderList[].cancelRemark

4.

cancellationTime

orderList.updatedDate

5.

items.lineItemSequenceNumber

orderList[].items[].lineno

6.

items.itemID

orderList[].items[].sku

7.

items.quantity

Explore for this key as there are various keys present such as orderList[].items[].uomqty or orderList[].items[].orderQty or orderList[].items[].commitedQty or orderList[].items[].cancelledQty or orderList[].items[].shippedQty or orderList[].items[].returnQty or orderList[].items[].openQty

8.

items.remark

orderList[].cancelRemark

9.

items.productName

orderList[].items[].skuName

The prepared WMS Request Body will look like as given below:

{ "externalChannelID": "{{channelConfigurationData.externalChannelID}}", "customerOrderNumber": "{{customerOrderNumber}}", "reason": "{{orderList.cancelRemark}}", "cancellationTime": "{{orderList.updatedDate}}", "items": [ { "lineItemSequenceNumber": "{{orderList[].items[].lineno}}", "itemID": "{{orderList[].items[].sku}}", "productName": "orderList[].items[].skuName", "remark": "{{orderList.cancelRemark}}", "quantity": "{{orderList[].items[].cancelledQty}}" } ] }

Related content