Fruugo Confirm Orders
Summary 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 | 15/01/2024 | Hristiyan | First publish |
After downloading the orders they will be on a Pending status until we accept them as per the abstraction Order management general requirements . As a standard in Hemi, we want to accept all orders that we get so we want to keep doing this for Fruugo as well.
Just like every call, this one is also using a Webhook so we must provide Fruugo with an webhook endpoint.
The webhook endpoint is : TBA
API Docs : https://developer.fruugo.com/#tag/orders-v3/operation/confirmOrders API Call : POST https://order-api.fruugo.com/v3/orders/confirm
Example request payload :
{
"orders": [
{
"type": "confirm",
"orderId": "string",
"itemQuantities": [
{
"productId": "string",
"skuId": "string",
"quantity": 1
}
],
"messageToCustomer": "string",
"messageToFruugo": "string",
"estimatedShippingDate": "2019-08-24T14:15:22Z"
}
]
}
Request Mapping:
Fruugo Field | Integration Requried | Hemi Field | Comments | ||
---|---|---|---|---|---|
orders |
|||||
type |
No | N/A | Hardcoded as “confirm” | ||
orderId |
Yes | Orders > Marketplace Order ID |
|||
itemQuantities |
|||||
productId |
No | N/A | |||
skuId |
No | N/A | |||
quantity |
No | N/A | |||
messageToCustomer |
No | N/A | |||
messageToFruugo |
No | N/A | |||
estimatedShippingDate |
No | N/A |
We want to be accepting every single order that we have downloaded. So our trigger should be all Pending orders in Hemi.
Example responses :
202 Request has been accepted for processing, and update will be performed asynchronously.
This is the successful request. We should then expect a response from Fruugo via the web-hook endpoint that we have provided.
400 Bad Request
Example response :
[
{
"type": "field",
"field": "productId",
"message": "must not be null"
},
{
"type": "field",
"field": "skuIds",
"message": "size must be between 1 and 200"
}
]
This bad request should not happen but incase it happens we should store all errors in Order Errors
with type Order Acknowledge
.
429 Request has been rejected due to exceeding rate limit. Retry after delay specified in "Retry-After" response header.
Incase we receive this we should just retry the request after the specified “Retry-After” in the header.
Callback payload samples
This will be when Fruugo will provide us with the actual order(s) information and details. This will be via a POST call done by them to our web-hook endpoint URI.
Example response :
{
"value": {
"type": "ConfirmResponseList",
"merchantId": 444,
"correlationId": "c3145570-0731-45db-9c9a-33f97d588400",
"payload": "{ 'transactionType': 'confirm' 'responses': [{ 'success': false 'errorMessage': 'BD_ILLEGAL_FULFILMENT_STATUS_TRANSITION - confirmPurchaseOrder failed, order status is NOT_REPLACED' 'orderId': '9164260001000444' 'shipmentId': null 'itemStatuses': [{ 'productId': 'STOCK005' 'skuId': 'STOCK-IS-1000-WITHV20' 'quantity': 1 'status': 'NOT_REPLACED' }] }] }"
}
}
We want to be looking for the success
status in the response :
- If we have
success
: true , we mark the order as confirmed and change the status as per the Order management general requirements - If we have
success
: false, we want to store theerrorMessage
inOrder Errors
with typeOrder Acknowledge
for the relevantorderId
.