Marketplaces / Tesco (on Marketplacer) / Tesco Technical Scope / Tesco Order Management / Tesco Ship Orders

Tesco Ship Orders

Version Date Created / Updated Notes
v1.0 Hristiyan Georgiev Initial version

In order to ship orders on Tesco we first need to get & store all the available courires on Tesco because when pushing a shipment, we need to provide a courier ID. We are not able to ship an order with a courier that is not part of the Tesco shipping provide list.

Other than that, the shipment process is straightforward - we provide the shipping carrier info, tracking info, dispatch time and shipped items info.

Get Couriers

Using this call, we will need to store the shipping carriers provided from Tesco . We want to display the Name but send the ID whenever communicating with Marketplcer.

We also want to introduce Courier mapping, and we will use a dependant table of Courier called Tesco Couriers Mapping for this use. In this table we need to have a dropdown field with all the carriers. The field will be called Tesco Courier where we will show the names of all the available couriers in Tesco.

If Tesco adds or removes couriers, we want to respectively add/remove them from the table. We don’t want to truncate the table with each run.

GraphQL Query :

query ShipmentCarriersQuery($pageSize: Int, $endCursor: String) {
    shipmentCarriers(first: $pageSize, after: $endCursor) {
        pageInfo{
            hasNextPage
            endCursor            
        }
        totalCount
        nodes {
            id
            name
        }
    }
}

Query Variables :

{
    "pageSize": 100,
    "endCursor": null
}

Variables Mapping :

Variable Value Note
pageSize 100 This will be our page size for this query
endCursor Should be null when doing the first query, and then if in the response we have hasNextPage = true, we need to use the string returned in the endCursor field.

Example response :

{
    "data": {
        "shipmentCarriers": {
            "pageInfo": {
                "hasNextPage": false,
                "endCursor": "Mjg"
            },
            "totalCount": 28,
            "nodes": [
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTY3",
                    "name": "ADSOne"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTY4",
                    "name": "Allied Express"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTY5",
                    "name": "Aramex"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTcw",
                    "name": "Australia Post"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTcx",
                    "name": "Border Express"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTcy",
                    "name": "Couriers Please"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTcz",
                    "name": "DHL"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTc0",
                    "name": "Direct Freight Express"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTc1",
                    "name": "Eparcel"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTc2",
                    "name": "Fastway"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTc3",
                    "name": "FedEx"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTc4",
                    "name": "FourPXStandard"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTc5",
                    "name": "iCumulus"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTgw",
                    "name": "Hunter Express"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTgx",
                    "name": "Northline"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTgy",
                    "name": "Sendle"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTgz",
                    "name": "Star Track"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTg0",
                    "name": "TNT"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTg1",
                    "name": "Toll"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTg2",
                    "name": "UPS"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTg3",
                    "name": "LyneConnect"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTg4",
                    "name": "LynePlus"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTg5",
                    "name": "Shippit"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTkw",
                    "name": "Les Post Express"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTkx",
                    "name": "NZ Post"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTky",
                    "name": "Becs shipping co"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTkz",
                    "name": "Testing"
                },
                {
                    "id": "U2hpcG1lbnRDYXJyaWVyLTk0",
                    "name": "Tetsing"
                }
            ]
        }
    }
}

Ship Orders

We want to use the new shipment model through the Order Shipment table. All triggers & validations are per the abstraction -

Order management general requirements

We want to introduce a default courier field which will be in the Account Tesco. The field will be an enum dropdown menu where the user can select the desired default courier. The field should not be required. Even if there is a selected default courier, we should first check if we have mapping from the courier on order with a record in table Courier and pick this with priority. We should only pick the default courier if there is no mapping for the selected courier. We should not be able to send a shipping update and we should store an error in Order Errors with Type > Shipping if we don’t have mapped courier and if we don’t have default courier set.

**The mapping will work based on:

  • If Order Shipment > Carrier matches Courier > Name we send the selected courier Tesco Courier Mappings > Tesco Courier
  • If there is no match or no value in the mapping table we need to go into a third case which is to use our default courier set in the Account Tesco table.
  • If we don’t have a default courier and courier mapping and the user tries to send a courier which is not part of the Tesco list, we want to store an error in Order Error table with Type = Shipment which states that the selected courier is not part of Tesco’s courier list.

GraphQL Query :

mutation ShipmentCreate($input: ShipmentCreateMutationInput!) {
    shipmentCreate(input: $input) {
        errors {
            field
            messages
        }
        shipment {
            id          
            trackingLink            
        }
    }
}

Query Variables :

{
    "input": {
        "invoiceId": "SW52b2ljZS0xMzkzOA==",
        "postageCarrierId": "U2hpcG1lbnRDYXJyaWVyLTY5",
        "dispatchedAt": "2024-10-01",
        "trackingNumber": "1a2b3c4d5f6g7h",
        "shippedItems": [ 
        {
            "quantity": 2,
            "lineItemId": "TGluZUl0ZW0tNDM1MA=="
        },
    { "quantity": 2,
           "lineItemId": "TGluZUl0ZW0tNDM1MQ=="}
    ]
    }
}

Variables Mapping :

Tesco Field Integration Required Hemi Field Notes
input
invoiceId Yes Orders > Marketplace Order ID
postageCarrierId Yes Order Shipment > Carrier

OR Tesco Courier Mappings > Tesco Courier OR Account Tesco > Default Courier | Depends on the conditions mentioned above. Remember we need to send the id of the courier always. | | | dispatchedAt | | Yes | NOW() | We should send the date in a format YYYY-MM-DD | | | trackingNumber | | Yes | Order Shipment > Tracking Number | | | | shippedItems | | | | | | | | quantity | Yes | Order Shipment Row > Quantity | | | | | lineItemId | Yes | Product in Order > Item Order Line ID | Should be mapped from Order Shipment Row > Order Item Id |

Example success response :

{
    "data": {
        "shipmentCreate": {
            "errors": null,
            "shipment": {
                "id": "U2hpcG1lbnQtMTA0Mg==",                
                "trackingLink": "https://www.aramex.com.au/tools/track?l=1a2b3c4d5f6g7h"                
            }
        }
    }
}

Example error response :

{
    "data": {
        "shipmentCreate": {
            "errors": [
                {
                    "field": "",
                    "messages": [
                        "Shipped items quantity exceeds the maximum number of undispatched items. and Dispatched at is before shipped items were ordered"
                    ]
                }
            ],
            "shipment": null
        }
    }
}

Response Mapping :

Integration Field Hemi Mapping Notes
data
shipmentCreate
errors
field Order Error > Type = Shipping We need to concatenate field and messages and store them together
messages Order Error > Type = Shipping We need to concatenate field and messages and store them together
shipment
id Order Shipment > External Id
trackingLink Order Shipment > Tracking URL

After successfully shipping we want to mark the order as shipped or partially shipped depending on if we have shipped all items or not.

Is this article helpful?
0 0 0