Flipkart Create Order Flow
Steps:
1.Create an OrderCronJob to prepare Data for active steps of orders and push into queue.
Tables included :- app_steps, app_installation_step_config,app_install_connection,channels,.
extract connection id with connection data(ie_app_automation_steps_config,ie_appinstall_connection)
Query:
SELECT ie_app_automation_steps_config.connectionId,ie_app_automation_steps_config.latestSyncTimeStamp,ie_appinstall_connection.accessToken
FROM ie_app_automation_steps_config
LEFT JOIN ie_appinstall_connection
ON ie_app_automation_steps_config.connectionId=ie_appinstall_connection.id
WHERE ie_app_automation_steps_config.appAutomationStepId='2' AND ie_app_automation_steps_config.isActive='1' AND ie_app_automation_steps_config.latestSyncTimeStamp IS NOT NULL AND ie_appinstall_connection.accessToken IS NOT NULL;
extract unique connection id and map external channnel id against each connection id
tables: external_wms_channels,warehouses)
loop over the Result set of above Query and pass connection Id to a method if the connectionId exist in cache fetch data in the given format
{
"externalChannelId" : "CLARKS",
"connectionId": "48",
"location":
{
"4253453464575":"warehouse",
"67859":"BDGUR103"
}
}
else execute query and set in cache and return in same format.
channeldata_(connectionId);
Query:
SELECT channels.externalChannelId ,channels.connectionId,external_wms_channels.locationId,
warehouses.externalWarehouseId FROM channels
LEFT JOIN external_wms_channels
ON channels.id= external_wms_channels.channel_id
LEFT JOIN warehouses
ON warehouses.id = external_wms_channels.warehouse_id
WHERE channels.connectionId =48;
group records according to sales channel and then then map location id , external warehouse id
Associate above results into an object and pass into taskQueue in given format.
{ "externalChannelId" : "CLARKS", "connectionId": "48", "location": { "4253453464575":"warehouse", "67859":"BDGUR103" }, "accessToken":"wertghjkhgfdsasdfghjkiuytr", "latestSyncTimeStamp":"2020-11-03 17:05:32" }
2. a. Create a Listener API to listen data in taskQueue and prepare Post request Data for flipkart API.
b. Internally call Flipkart API for every entry update No time filter is being used Only the basis of “Approved” status we fetch the orders
For Fetch “APPROVED” order we call this API
curl --location 'https://api.flipkart.net/sellers/v3/shipments/filter' \
--header 'Authorization: Bearer 9fb16e3b-6fcf-41ee-8fa0-07d71dca04f9' \
--header 'Content-Type: application/json' \
--data '{
"filter": {
"states": [
"APPROVED"
],
"type": "preDispatch",
"orderDate": null,
"cancellationDate": null,
"cancellationType": null,
"locationId": "LOC003c5e0c0d7043a290c98eadb8865ed5"
}
}'
To Fetch “CANCELLED” order we fetch this API – Here we use time filter too
curl --location 'https://api.flipkart.net/sellers/v3/shipments/filter' \
--header 'Authorization: Bearer 80561651-09c8-4014-a3a2-bac9ff46038f' \
--header 'Content-Type: application/json' \
--data '{
"filter": {
"states": [
"CANCELLED"
],
"type": "cancelled",
"cancellationDate": {
"from": "2023-06-21T06:00:03Z",
"to": "2023-06-21T06:15:03Z"
},
"cancellationType": "buyerCancellation"
}
}'
Note :
In default layer we called 3 simultenous Cancelled order flow API
1. buyerCancellation
2. SellerCancellation
3. marketPlaceCancellation
3. Push order detail data of flipkart for transformation and call wms flipkart order API.
If order detail has (hasnext: true) ,push the nextpage Url to call the flipkat order API with
previous request body and nextPage Url in params
Push order detail data of flipkart to transformation and vise versa
4. a. Create Listener API’s to listen these queues and create order data from them if order detail
has (hasnext: true) ,push the nextpage Url to call the flipkat order API with previous request
body and nextPage Url in params vise versa.
5. call wms order API with following request Body.
Mapping:
WMS Create Order Keys | Flipkart Create Order Keys |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| “xyz@gmail.com“ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|