Order Fulfillment Sequence Diagram
Steps
Step 1. FlipkartFulfillmentListener will receive data from EshopBoxFulfillmentService in which data needs to be processed only if eventSubType is “created“
Shipment Created Event Data as given below.
{
"resource": "shipment",
"eventType": "PUT",
"eventSubType": "created",
"accountSlug": "kapaskraft",
"actor": "SYSTEM",
"version": "v1",
"request_data": [],
"response_data": {
"customerOrderNumber": "KK100244",
"vendorOrderNumber": "11920832654052201",
"externalShipmentID": "KK100244-388-41",
"externalWarehouseID": "Kapas Kraft Apparels Limited 1006",
"externalChannelID": "TATA CLIQ VELOCY KAPAS KRAFT",
"integrationType": "4",
"defaultWarehouseCode": "2022",
"orderDate": "2020-07-28 08:10:53",
"portal_id": 12,
"paymentType": "ONLINE",
"order_id": 1971482,
"channel_id": 388,
"warehouse_id": 77,
"account_id": 167,
"region": "",
"invoiceNumber": "INV-20/2110138",
"boxType": "UNKNOWN",
"isPriorityShipment": "0",
"isGift": "0",
"invoice_url": "",
"invoiceDate": "2020-07-29 00:00:00",
"label_url": "https://pyck-res-bucket.s3.amazonaws.com:443/DELHIVERY/2020-07-29/2098310542415.pdf",
"labels": "",
"shippingInfo": [],
"boxAdditionalRecommendation": [],
"dimension_length": "1",
"dimension_width": "1",
"dimension_height": "1",
"weight": "431",
"trackingID": "2098310542415",
"packageID": "",
"barcode": "",
"courierName": "Delhivery",
"created_at": "2020-07-28 13:44:23",
"updated_at": "2020-07-29 10:42:33",
"status": "dispatched",
"remarks": "",
"customerName": "John Doe",
"customerContactNumber": "9998889998",
"email": "johndoe@gmail.com",
"channelSlug": "kapasKraft",
"status_updated_at": "2020-07-29 11:26:50",
"status_log": {
"dispatched": "2020-07-29 11:26:50",
"packed": "2020-07-29 10:42:38",
"created": "2020-07-28 13:44:23"
},
"orderExternalCreatedAt": "2020-07-28 13:44:18",
"shippingAddress": {
"customerName": "John Doe",
"addressLine1": "Kapas Kraft Apparels Limited",
"addressLine2": "Banglore",
"city": "bengluru",
"state": "Karnataka",
"postalCode": "560005",
"countryCode": "IN",
"countryName": "India",
"contactPhone": "9998889998",
"email": "johndoe@gmail.com"
},
"id": 1958732,
"isCOD": "0",
"track_payload": [],
"packed_date": "2020-07-29 10:42:38",
"items": [
{
"lineItemSequenceNumber": 57,
"orderItemID": "BLCK103443-3781063",
"itemID": "5df8c063737b791c70e35974",
"sku": "BBAPLBB140117_40",
"asin": "",
"productName": "Men Black T-Shirt",
"quantity": 1,
"customerPrice": 499,
"lineItemTotal": 499,
"invoiceTotal": 499,
"discount": 0,
"taxRate": 0,
"taxAmount": 0,
"giftMessage": "",
"giftLabelContent": "",
"lineItemOrderStatus": "",
"orderItemIDs": [
"KK100244-5926961"
],
"productImageUrl": "https://s3-eu-west-1.amazonaws.com/imagebucketeshopbox/Uzip/219045371-1-40/1.JPG",
"productAdditionalInfo": {
"size": "M",
"color": "NA"
},
"expectedDeliveryDate": "2020-07-30",
"shippingCharges": 0,
"productUrl": "https://kapaskraft.auperator.co/product/edit-product/BBAPLMC144105_44"
},
{
"lineItemSequenceNumber": 58,
"orderItemID": "BLCK103443-3781067",
"itemID": "5ebe805b34623261ac57dab8",
"sku": "BBAPLBB140117_40",
"asin": "",
"productName": "Men Black T-Shirt",
"quantity": 1,
"customerPrice": 499,
"lineItemTotal": 499,
"invoiceTotal": 499,
"discount": 0,
"taxRate": 0,
"taxAmount": 0,
"giftMessage": "",
"giftLabelContent": "",
"lineItemOrderStatus": "",
"orderItemIDs": [
"KK100244-5926962"
],
"productImageUrl": "https://s3-eu-west-1.amazonaws.com/imagebucketeshopbox/Uzip/219045371-1-40/1.JPG",
"productAdditionalInfo": {
"size": "XL",
"color": "NA"
},
"expectedDeliveryDate": "2020-07-30",
"shippingCharges": 0,
"productUrl": "https://kapaskraft.auperator.co/product/edit-product/BBAPLMC144105_44"
}
]
},
"previous_data": [],
"resource_type": "shipment.update",
"account_slug": "kapaskraft",
"custom": []
}
Step 2. Now use externalChannelId given in the data sent by EshopboxFulfillmentService to fetch connectionId that will be used to retrieve accessToken
Database: eshopbox_client_portal_dev
Tables Used: tax_code_slabs and product_variation
Now fetch taxRate using sku given in shipmentCreated Event against each Item
(SELECT tax_code_slabs.taxRate FROM tax_code_slabs LEFT JOIN product_variation
ON product_variation.tax_code_id = tax_code_slabs.tax_code_id
WHERE product_variation.product_number = :sku).setParameter("sku", sku);
Database: integration_engine_staging
Tables Used: ie_appinstall_connection
Use below SQL Query to fetch accessToken using retrieved connectionId either from Cache Memory or from Database (only if not available in Cache Memory)
(SELECT ie_appinstall_connection.accessToken FROM
ie_appinstall_connection WHERE connectionId= :connectionId).setParameter("connectionId",connectionId);
Once the accessToken is generated, store it in Cache Memory in the specified format given below
{
"connectionAccessToken_{{connectionId}}":"{{ACCESS TOKEN}}"
}
Step 3. Now transform the data received from EshopBoxFulfillmentService into the format which is accepted by Flipkart as given below
{
"shipments": [
{
"subShipments": [
{
"dimensions": {
"breadth": 0,
"length": 0,
"weight": 0,
"height": 0
},
"subShipmentId": "string"
}
],
"taxItems": [
{
"taxRate": 0,
"orderItemId": "string",
"quantity": 0
}
],
"invoices": [
{
"orderId": "string",
"invoiceNumber": "string",
"invoiceDate": "2020-11-10"
}
],
"serialNumbers": [
{
"serialNumbers": [
[
"string"
]
],
"orderItemId": "string"
}
],
"locationId": "string",
"shipmentId": "string"
}
]
}
EshopboxFulfillmentService Keys | FlipkartFulfillmentService Keys |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Step 4. Now push the transformed data which is in the format required by FlipkartFulfillmentService along with accessToken which will be used for authentication purpose
POST API URL
https://api.flipkart.net/sellers/v3/shipments/labels
Request Body
{
"shipments": [
{
"subShipments": [
{
"dimensions": {
"breadth": {{response_data.dimension_width}},
"length": {{response_data.dimension_length}},
"weight": {{response_data.weight}},
"height": {{response_data.dimension_height}}
},
"subShipmentId": "SS-1"//keep it static until resolved //not given in Shipment Created Event
}
],
"taxItems": [
{
"taxRate": {{response_data.items[].taxRate}},
"orderItemId": "{{response_data.items[].orderItemID}}",
"quantity": {{response_data.items[].quantity}}
}
],
"invoices": [
{
"orderId": "{{response_data.customerOrderNumber}}",
"invoiceDate": "{{response_data.invoiceDate}}"
}
],
"locationId": "{{fetch from Database using externalChannelID}}"
"shipmentId": "{{response_data.externalShipmentID}}"
}
]
}
Response Body
200 OK
{
"shipments": [
{
"status": "string",
"errorCode": "string",
"errorMessage": "string",
"shipmentId": "string"
}
]
}
Step 5. If the Packaging in Progress in returned following error
Response:
{
"shipments": [
{
"shipmentId": "f4d3fbd7-f908-4b83-8396-a4071bf4392f",
"errorMessage": "Shipping package size(LBHW) cannot be less than the packaging dimensions mentioned in My Listings tab at the time of order placement",
"errorCode": "INVALID_PACKAGE_DIMENSION",
"status": "failure"
}
]
}
Then retrieve the Dimensions from the GET SHIPMENT API response called at the above, and retry the Packaging in Progress request, if the Status is moved to Packed
now then we can generate ship label, else the flow will exit.
Make an HTTP GET request on Flipkart Get Shipment Details API to fetch the order details.
API:
https://api.flipkart.net/sellers/v3/shipments?shipmentIds={{customerOrderNumber}}
Response:
{
"shipments": [
{
"shipmentId": "42e9c904-23ae-4919-bcb4-5942b044dc67",
"dispatchByDate": "2022-02-23T16:00:00.000+05:30",
"dispatchAfterDate": "2022-02-22T16:49:33.000+05:30",
"updatedAt": "2022-02-22T16:45:39.000+05:30",
"locationId": "LOCcc057efaa01f4a35a5c78d65977ac863",
"hold": false,
"mps": false,
"packagingPolicy": "DEFAULT",
"subShipments": [
{
"subShipmentId": "SS-1",
"packages": [
{
"packageId": "PKGTSHG9ERHYVH5RUYQFRSICZ",
"packageSku": "221054275-1-38",
"dimensions": {
"length": 35.7,
"breadth": 24.9,
"height": 1.9,
"weight": 0.25
}
}
]
}
],
"orderItems": [
{
"orderItemId": "22423837707815300",
"orderId": "OD224238377078153000",
"cancellationGroupId": "grp22423837707815300",
"orderDate": "2022-02-22T16:44:33.740+05:30",
"paymentType": "COD",
"status": "PACKED",
"quantity": 1,
"fsn": "TSHG9ERHYVH5RUYQ",
"sku": "221054275-1-38",
"listingId": "LSTTSHG9ERHYVH5RUYQFRSICZ",
"hsn": "61099090",
"title": "MONTE CARLO Striped Men Polo Neck Dark Blue T-Shirt M 221054275-1",
"packageIds": [
"PKGTSHG9ERHYVH5RUYQFRSICZ"
],
"priceComponents": {
"sellingPrice": 1180.00,
"totalPrice": 1180.00,
"shippingCharge": 0.00,
"customerPrice": 1180.00,
"flipkartDiscount": 0.00
},
"serviceProfile": "Seller_Fulfilment",
"is_replacement": false
}
],
"forms": [],
"shipmentType": "NORMAL"
}
]
}