Flipkart 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"
}
]
}