Order Shipping Update
3Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)
Version | Date | Created / Updated | Notes |
---|---|---|---|
v1.0 | 28.09.2022 | Bogomil Pavlov | First publish |
v1.1 | 15.11.2022 | Bogomil Pavlov | More details added how to incorporate the custom import to Automatic shipping imports |
v1.2 | 19.04.2023 | Bogomil Pavlov | Additional logic for different carriers tag (v1.2) is added where the changes are applied. |
v1.3 | 27.04.2023 | Bogomil Pavlov | Introduce a table for carrier and tracking number which will be used to explode the tracking number and the carrier from the tracking url. Tagged with (v1.3) |
The documentation and example are attached as files.
Shipping Update
We will be importing xml files from the FTP so we will need to be able to set the FTP credentials directly from Hemi.
Once we are connected to the FTP we can start importing the shipping updates.
**(v1.2)**Sample xml structure for yodel carrier:
<?xml version="1.0" encoding="UTF-8" ?>
<MESSAGES>
<COMMANDSTATUS ID="SHIPPED" DESCRIPTION="Goods shipped">
<ORDER O_ID="30000004" TRACKING_URL="https://tracking.yodel.co.uk/wrd/run/wt_xtest_pw.cb_cgi?cb_dialogue=specificStatus3&parcelNumber=JJD0002249164153989”">
<ORDER_LINE OL_ID="30000004/1" STATUS_FROM="EXTD" STATUS_TO="SHPD" DESCRIPTION="Item shipped to customer" SKU="L1608" QUANTITY="1" />
</ORDER>
</COMMANDSTATUS>
</MESSAGES>
**(v1.2)**Sample xml structure for askaxl carrier:
<?xml version="1.0" encoding="UTF-8" ?>
<MESSAGES>
<COMMANDSTATUS ID="SHIPPED" DESCRIPTION="Goods shipped">
<ORDER O_ID="30000004" TRACKING_URL="https://askaxl.co.uk/tracking?upi=8PRLA1770972C087&Postcode=<<<POSTCODE>>>|8PRLA1770972D087">
<ORDER_LINE OL_ID="30000004/1" STATUS_FROM="EXTD" STATUS_TO="SHPD" DESCRIPTION="Item shipped to customer" SKU="L1608" QUANTITY="1" />
</ORDER>
</COMMANDSTATUS>
</MESSAGES>
**(v1.2)**Sample xml structure for dpd carrier:
<?xml version="1.0" encoding="UTF-8" ?>
<MESSAGES>
<COMMANDSTATUS ID="SHIPPED" DESCRIPTION="Goods shipped">
<ORDER O_ID="30000009" TRACKING_URL="http://www.dpd.co.uk/service/tracking?parcel=5778388682|5778388683">
<ORDER_LINE OL_ID="30000009/1" STATUS_FROM="EXTD" STATUS_TO="SHPD" DESCRIPTION="Item shipped to customer" SKU="L1608" QUANTITY="1" />
</ORDER>
</COMMANDSTATUS>
</MESSAGES>
(v1.2)Sample xml structure for evri carrier:
<?xml version="1.0" encoding="UTF-8" ?>
<MESSAGES>
<COMMANDSTATUS ID="SHIPPED" DESCRIPTION="Goods shipped">
<ORDER O_ID="30000009" TRACKING_URL="https://www.evri.com/track#/parcel/H03IKA0000001420|H03IKA0000001395">
<ORDER_LINE OL_ID="30000009/1" STATUS_FROM="EXTD" STATUS_TO="SHPD" DESCRIPTION="Item shipped to customer" SKU="L1608" QUANTITY="1" />
</ORDER>
</COMMANDSTATUS>
</MESSAGES>
Mapping:
XML field | Attribute | Hemi Field | Comment | |
---|---|---|---|---|
MESSAGES |
||||
COMMANDSTATUS |
N/A | |||
ID | N/A | |||
DESCRIPTION | N/A | |||
ORDER |
||||
O_ID | Orders > ID | We need to map the O_ID="31679786" to our Hemi Orders > ID |
||
TRACKING_URL | Order > Shipping Tracking Number | (v1.2) We need to extract the tracking number from the tracking url however we will have 4 different types of format. |
”https://tracking.yodel.co.uk/wrd/run/wt_xtest_pw.cb_cgi?cb_dialogue=specificStatus3&parcelNumber=JJD0002249164153989
”
”https://askaxl.co.uk/tracking?upi=8PRLA1770972C087&Postcode=<<<POSTCODE>>>|8PRLA1770972D087
”
”http://www.dpd.co.uk/service/tracking?parcel=5778388682|5778388683
”
”https://www.evri.com/track#/parcel/H03IKA0000001420|H03IKA0000001395
”
(v1.3)
In order to make this flexible and scalable we want to introduce additional table with two fields “Carrier” and “Tracking url”
There the user will define for which carrier what Tracking url we shall expect and where is the tracking number e.g.
Evri --- https://www.evri.com/track#/parcel/{shippingTrackNumber}|H03IKA000000139
We want to have a key {shippingTrackNumber} which will show where is the tracking number in the tracking url which we need to store in Hemi.
The mapping between the file and the internal table will happen via the tracking url and then we can just use the carrier set in the new table and explode the tracking number.
Also we might have some ids or content which changes dynamically within the URL so we want to be able to specify such content as {dynamicContent}.
For example https://tracking.yodel.co.uk/wrd/run/wt_xtest_pw.cb_cgi?cb_dialogue=specificStatus{dynamicContent}&parcelNumber= {shippingTrackNumber}
or https://tracking.yodel.co.uk/{dynamicContent}={shippingTrackNumber}
Please note if for some reason the tracking url does not map we skip the file and return a waring in the terminal |
| | | | Order > Shipping Carrier | (v1.2) Based on the URL we have to define which is the carrier. The good thing is that we have only 4 options Yodel, Askaxl, DPD, Evri so we have to check each option against the tracking and if there is a match to use the relevant carrier. |
| | ORDER_LINE
| | | |
| | | OL_ID | | |
| | | STATUS_FROM | N/A | |
| | | STATUS_TO | N/A | |
| | | DESCRIPTION | N/A | |
| | | SKU | | |
| | | QUANTITY | | |
Please note this way we can have multiple Order Updates for a single order if they partially shipped an order however with the first update we will ship the whole order. If the order is already shipped we will just update the tracking information and the carrier and we do not want to raise the Orders > Update Shipping Flag = pending. The criteria which we use in order to check if the order is shipped:
- if the update shipping Pending flag = Yes → again, we have already received shipping update
- if tool status = shipped → it is clear that the order is shipped
- if there is a record in shipment table below the order.
In order to incorporate the custom import to our standard Automatic Import functionality we will have to use the following fields:
Hemi Field | In Use | Purpose |
---|---|---|
Select type | Yes | The type of the import must be “Shipping Import” |
Raise flag Shipping Update | Yes | Indicates if we would like to raise the Orders > Update Shipping Flag = Yes |
Remove OrderID Prefix | No | N/A |
Select file for import | No | We must import a file in order to proceed but it will be ignored |
Layout | No | We must create mapping but it will be ignored |
Has Header Row | No | N/A |
Import Name | Yes | The name of the automatic import |
Storage Type | Yes | By default FTP is selected and this is the only valid option |
FTP Type | Yes | Type of the FTP |
FTP Host | Yes | The host |
Username | Yes | The username |
Password | Yes | The password |
Port | Yes | The port |
Import Format | No | N/A because the format will be xml |
File Name | Yes | The actual path and the file name from where we will be picking the file for import. |
For example: ”Test/GLTC/Shipping123456.xml” or we can use * in order to have a LIKE option for example: ”Test/GLTC/Shipping*.xml” | | Operation After CronJob End | Yes | Both options are available “Rename/Move” and “Delete”. If “Rename/Move” is selected we will have “New Path / Name” to specify | | New Path / Name | Yes | The path were the file will be moved and renamed. For example: ”Test/GLTC/Processed/FILENAME.processed” FILENAME - returns the original file name and we add .processed as second file extension |
Please note once we have created and set the automatic import we will need to set a cronjob which will activate the automation. In the cronjob we specify which automatic import to automate and how often. Which means we will also store each import in Import Export Log table with the relevant status and details. Import Export Log status: Pending - The import is in pending status and waiting for the the other import to finish in order to start In Progress - The import is reading the files and updating the data Failed - Error occurred during the import which is stored in Import Export Log > Errors Finished Successfully - All data is imported successfully Success Warning - Not all of the data is imported. (The SKU is not in Hemi or the order id is missing from Hemi)