Sequence Diagram
Architecture
Step 1. Listen to PubSub for the CreateOrder event and get QueueData from it.
QueueData:
{ "queueData": { "channelData": { "externalChannelId": "CH5811", "accountSlug": "montecarlo", "connectionId": 78, "location": { "F21BD":"Warehouse", "58291912872": "Warehouse" }, "wmsAccessToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlJVVXdSREZCUVRSRFFqQkdORFUxTVVZeE16ZEdPRFJHTnpORk5EaEJSVEU0TVVORk5qVTJOdyJ9.eyJodHRwczovL2FwcERhdGEiOnsiYXBwQ2xpZW50SWQiOiI3YmM0ZTExYTdlMzFmYWRjMTk5ZDI5Y2ViZTIyYzY3MiJ9LCJodHRwczovL2FjY291bnRTbHVnIjoibW9udGVjYXJsbyIsImh0dHBzOi8vdXNlckRldGFpbHMiOnsiaWQiOjExMzEsInVzZXJUeXBlIjoiZGVmYXVsdCIsImVtYWlsIjoiYXBwdXNlcjExNEBlc2hvcGJveC5jb20ifSwiaHR0cHM6Ly9hY2NvdW50cyI6WyJtb250ZWNhcmxvIl0sImh0dHBzOi8vd2FyZWhvdXNlV29ya3NwYWNlcyI6W10sImh0dHBzOi8vd2FyZWhvdXNlcyI6W10sImh0dHBzOi8vcGFydG5lcnMiOltdLCJpc3MiOiJodHRwczovL2VzaG9wYm94LXBheW1lbnQtcmVjby5hdXRoMC5jb20vIiwic3ViIjoiYXV0aDB8NjA3NTQxMmE2NjUwOGYwMDY4YmIzZTQwIiwiYXVkIjoiaHR0cHM6Ly9lc2hvcGJveC1wb3J0YWwtZGV2LmFwcHNwb3QuY29tIiwiaWF0IjoxNjU3MDEzNjM3LCJleHAiOjE2NTk2MDU2MzcsImF6cCI6Inc4dllYa2ZMSWZmOFl2Mmo0TzNUOUplYWoxUzNxOHJlIiwic2NvcGUiOiJyZWFkOnByb2R1Y3RzIHJlYWQ6aW52ZW50b3J5IHJlYWQ6cHJvZHVjdF9saXN0aW5ncyIsImd0eSI6InBhc3N3b3JkIn0.n3b_xeF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wZSI6InJlYWQ6b3JkZXJzIG9mZmxpbmVfYWNjZXNzIiwiZ3R5IjoicGFzc3dvcmQifQ.WIdaENzdkYY90VRv-9AEGwreD66tvGaOBug-9G5erhDvboihXpRevDFe1gZTfJdA-HYWOFadw8bqjoM8ZtUv0pJdOI2QA-rKRhfAAaZOdfZc9Tn3DhybZHT4Pmltthz4Cgz-T516F0CTj0VhcR-T-FGg6-qb1xtPB83lflLAa-Lrj7T3FRqA9yp2r9MLCEkBCzqlrKUpCvdeA5DFaCAb-J8gvPsf9rs9pu6lf2Y_1P1fNETZUk2wZ6tGAt0gQnga6zCkoYZ_Su9FseuRx6rq-1IHeSvvbWUcNkvkZN2X91eAqjSNzK7WtCs0ZATpR9m08bFuFO4XascGfptJnfxb5Q" }, "order": { "orderType": "01", "orderNo": "227119-141-911289", "orderDate": "2021-03-13 10:00:57.0", "addressInfo": [ { "addressType": "DA", "emailID": "NA", "firstName": "Sicin", "lastName": "Pious", "phoneNo": "9751500171", "address1": "corsaspec, Kaliveetil mall, amaravila", "landmark": "null--", "country": "IN", "city": "Mumbai", "state": "27 ", "pincode": "400083" }, { "addressType": "BA", "emailID": "cisinpious@gmail.com", "firstName": "Sicin", "lastName": "Pious", "phoneNo": "9751500171", "address1": "DUMMY_STREET_NAMEDUMMY_STREET_NO", "country": "IN", "city": "Mumbai", "state": "27 ", "pincode": "400083" } ], "paymentInfo": [ { "paymentCost": 3758.0, "paymentMode": "Prepaid", "paymentStatus": "S", "paymentInfo": "112055759-1615609894863", "paymentDate": "2021-03-13 10:01:35.0" } ], "orderLine": [ { "transactionId": "1111100111988889", "shipByDate": "2021-03-13T11:30:00Z", "omsStatusCode": "001", "sellerID": "124346", "articleNumber": "00340213023", "imageUrl": "https://imgpreprod2.tataunistore.com/images/i6/252Wx374H/MP000000007287684_252Wx374H_202111111645481.jpeg", "taxType": "IGST", "taxValue": "18.00", "price": 3299.0, "mrp": 1000.0, "isCOD": "N", "apportionedPrice": 3299.0, "apportionedCODPrice": 0.0, "apportionedShippingCharge": 0.0, "isaGift": "N", "giftMessage": "null", "giftPrice": 0.0, "deliveryMode": "HD", "isPrecious": "N", "isFragile": "N", "transportMode": "SUR", "fulfillmentType": "TSHIP", "p1SlaveId": "F21BD", "p1LogisticsID": "BD", "prepaidLimit1": "999999.0", "p2LogisticsID": "BD", "prepaidLimit2": "0.0", "returnLogisticsID": "BD", "alternateContactName": "N", "alternatePhoneNo": "N", "gst": { "slavegstin": "09AAAFJ3235A1ZY", "destinationStateCode": "27", "hsnCode": "33030090", "hsnTax": [ { "taxType": "IGST", "taxRate": "18", "taxValue": "503.24" } ], "sacCodeSchedulingCharges": "996819", "schedulingChargesTAXES": [ { "taxType": "IGST", "taxRate": "18", "taxValue": "0.00" } ], "sacCodeShipCharges": "996819", "shippingChargesTAXES": [ { "taxType": "IGST", "taxRate": "18", "taxValue": "0.00" } ], "giftingCharges": "0.00", "giftingChargesTAXES": [] }, "promotionInfo": [], "coupon": [], "isLuxury": "N", "isLocal": "N", "customerGSTIN": "", "packId": "1816444279F21BDAA" } ] } } }
Step 2. Get WMS AccessToken from channel data in queue data, and prepare WMS Create Order request body by mapping the following keys.
WMS Create Order Keys | TataCliq Create Order Keys |
---|---|
externalChannelID | channelData.externalChannelID |
customerOrderNumber | order.orderNo |
shipMethod | “STD“ |
orderDate | order.orderDate |
isCOD | order.orderLine[0].isCOD (N->0, Y->1) |
paymentType | order.paymentInfo[0].paymentMode |
shipChargeAmount | order.orderLine[].apportionedShippingCharge for each |
subtotal | sum of all items[].lineItemTotal |
orderTotal | subtotal+shipChargeAmount |
balanceDue | if COD then orderTotal else if Prepaid then 0 |
thirdPartyShipping | true |
vendorOrderNumber | order.orderNo |
externalWarehouseID | channelData.location[order.orderLine[0].p1SlaveId] |
taxAmount | “0.0“ |
shippingAddress.customerName | order.addressInfo[where[addressType==”DA”]].firstName + order.addressInfo[where[addressType==”DA”]].lastName |
shippingAddress.addressLine1 | order.addressInfo[where[addressType==”DA”]].address1 |
shippingAddress.addressLine2 | order.addressInfo[where[addressType==”DA”]].address2 |
shippingAddress.city | order.addressInfo[where[addressType==”DA”]].city |
shippingAddress.postalCode | order.addressInfo[where[addressType==”DA”]].pincode |
shippingAddress.countryCode | order.addressInfo[where[addressType==”DA”]].country |
shippingAddress.countryName | "INDIA" |
shippingAddress.contactPhone | order.addressInfo[where[addressType==”DA”]].phoneNo |
shippingAddress.email | order.addressInfo[where[addressType==”DA”]].emailID |
shippingAddress.state | order.addressInfo[where[addressType==”DA”]].state |
billingAddress.customerName | order.addressInfo[where[addressType==”BA”]].firstName + order.addressInfo[where[addressType==”BA”]].lastName |
billingAddress.addressLine1 | order.addressInfo[where[addressType==”BA”]].address1 |
billingAddress.addressLine2 | order.addressInfo[where[addressType==”BA”]].address2 |
billingAddress.city | order.addressInfo[where[addressType==”BA”]].city |
billingAddress.postalCode | order.addressInfo[where[addressType==”BA”]].pincode |
billingAddress.countryCode | order.addressInfo[where[addressType==”BA”]].country |
billingAddress.countryName | "INDIA" |
billingAddress.contactPhone | order.addressInfo[where[addressType==”BA”]].phoneNo |
billingAddress.email | order.addressInfo[where[addressType==”BA”]].emailID |
billingAddress.state | order.addressInfo[where[addressType==”BA”]].state |
expectedShipDate | order.orderLine[0].shipByDate |
items[].lineItemSequenceNumber | order.orderLine[].transactionId |
items[].status | “CREATED“ |
items[].quantity | “1“ |
items[].itemID | order. orderLine[].articleNumber |
items[].lineItemTotal | order.orderLine[].apportionedPrice |
items[].customerPrice | order.orderLine[].price |
items[].customerOrderItemID | order.orderLine[].packId |
items[].discount | order.orderLine[].(coupon[].couponValue+ promotionInfo[].promotionValue) |
items[].isGift | order.orderLine[].isaGift (N->0, Y->1) |
items[].giftMessage | order.orderLine[].giftMessage |
items[].giftWrapCharges | order.orderLine[].giftPrice |
items[].taxRate | order.orderLine[].taxValue |
items[].taxAmount | “0.0” |
Step 3. Call WMS CreateOrder API with AccessToken and request body.
WMS CreateOrder API
https://wms.eshopbox.com/api/order
Request Body
{ "externalChannelID": "{{channelData.externalChannelID}}", "customerOrderNumber": "{{order.orderNo}}", "shipMethod": "STD", "orderDate": "{{order.OrderDate}}", "isCOD": "{{order.OrderLine[0].isCOD}}", "paymentType": "{{order.paymentInfo[0].paymentMode}}", "shipChargeAmount": {{order.orderLine[].apportionedShippingCharge for each}}, "subtotal": {{sum of all items[].lineItemTotal}}, "orderTotal": {{subtotal + shipChargeAmount}}, "balanceDue": {{if COD then orderTotal else if Prepaid then 0}}, "thirdPartyShipping": true, "vendorOrderNumber": "{{order.orderNo}}", "externalWarehouseID": "{{channelData.location[order.orderLine[0].p1SlaveId]}}", "taxAmount": "0.0", "shippingAddress": { "customerName": "{{order.addressInfo.firstName + order.addressInfo.lastName}}", "addressLine1": "{{order.addressInfo.address1}}", "addressLine2": "{{order.addressInfo.address2}}", "city": "{{order.addressInfo.city}}", "postalCode": "{{order.addressInfo.pincode}}", "countryCode": "{{order.addressInfo.country}}", "countryName": "India", "contactPhone": {{order.addressInfo.phoneNo}}, "email": "{{order.addressInfo.emailID}}", "state": "{{order.addressInfo.state}}" }, "billingAddress": { "customerName": "{{order.addressInfo.firstName + order.addressInfo.lastName}}", "addressLine1": "{{order.addressInfo.address1}}", "addressLine2": "{{order.addressInfo.address2}}", "city": "{{order.addressInfo.city}}", "postalCode": "{{order.addressInfo.pincode}}", "countryCode": "{{order.addressInfo.country}}", "countryName": "India", "contactPhone": {{order.addressInfo.phoneNo}}, "email": "{{order.addressInfo.emailID}}", "state": "{{order.addressInfo.state}}" }, "expectedShipDate": "{{order.orderLine[0].shipByDate}}", "items": [ { "lineItemSequenceNumber": "{{order.orderLine[].transactionId}}", "status": "CREATED", "quantity": "1", "itemID": "{{order. orderLine[].articleNumber}}", "lineItemTotal": "{{order.orderLine[].apportionedPrice}}", "customerPrice": "{{order.orderLine[].price}}", "customerOrderItemID": "{{order.orderLine[].packId}}", "discount": "{{order.orderLine[].(coupon[].couponValue +promotionInfo[].promotionValue)}}", "isGift": "{{order.orderLine[].isaGift (N->0, Y->1)}}", "giftMessage": "{{order.orderLine[].giftMessage}}", "giftWrapCharges": "{{order.orderLine[].giftPrice}}", "taxRate": "{{order.orderLine[].taxValue}}", "taxAmount": "0.0" } ] }
Response Body from WMS
{ "WMSResponse": { "promiseDeliveryDate": null, "vendorOrderNumber": "227119-141-911289", "orderSiteID": null, "expectedShipDate": "2021-03-13 17:00:00", "created_at": "2022-07-05 15:45:04", "customerOrderNumber": "227119-141-911289", "dispatchAfterDate": null, "paymentType": "Prepaid", "isCOD": "0", "integrationType": "0", "updated_at": "2022-07-05 15:45:04", "thirdPartyShipping": true, "id": 42668899, "channelLabel": null, "onHold": false, "balanceDue": 0, "externalChannelID": "CH5811", "expectedDeliveryDate": null, "orderTotal": 3299, "subtotal": 3299, "shipMethod": "STD", "shippingAddress": { "city": "Mumbai", "countryCode": "IN", "postalCode": "400083", "addressLine1": "corsaspec, Kaliveetil mall, amaravila", "addressLine2": null, "state": "27", "countryName": "INDIA", "contactPhone": "9751500171", "customerName": "Sicin Pious", "email": "NA" }, "billingAddress": { "city": "Mumbai", "countryCode": "IN", "postalCode": "400083", "addressLine1": "DUMMY_STREET_NAMEDUMMY_STREET_NO", "addressLine2": null, "state": "27", "countryName": "INDIA", "contactPhone": "9751500171", "customerName": "Sicin Pious", "email": "cisinpious@gmail.com" }, "taxAmount": 0, "orderDate": "2021-03-13 10:00:57", "items": [ { "quantity": 1, "giftMessage": "null", "cancellationReason": "", "orderItemID": "227119-141-911289-23920766", "cancellationTime": "0000-00-00 00:00:00", "discount": 0, "giftLabelContent": "", "lineItemTotal": 3299, "customerPrice": 3299, "original_order_item_id": null, "productName": "tata cliq product", "itemID": "00340213023", "taxRate": 18, "lineItemSequenceNumber": "1111100111988889", "sku": "BBSHOCL35755_4", "taxAmount": 0 } ], "shipChargeAmount": 0 } }