Noon Get 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 | 01/09/2023 | Hristiyan | First publish |
v1.1 | 18/09/2023 | Hristiyan | Added logic on what to do once we process the files |
v1.2 | 19/10/2023 | Hristiyan | Added additional logic on the source_document |
v1.3 | 03/11/2023 | Hristiyan | Mapping changes as file we receive was updated |
v1.4 | 08/03/2024 | Hristiyan | Mapping changed for item_nr |
v1.5 | 11/03/2024 | Hristiyan | Additional logic for the get orders |
v1.6 | 05/07/2024 | Milen | Included mapping for receiver_emirate + file naming changes |
v1.7 | 16/09/2024 | Milen | Added a hardcoded value for email |
v1.8 | 07/11/2024 | Milen | Added mapping for ‘marketplace’ column |
v1.9 | 07/01/2025 | Hristiyan | Mapping changes |
We need to process a .csv file which will be dropped in a specific folder on an sFTP. For this we want to use the FTP Credentials
table where we input the details and for the get orders we want to control this via an FTP path labelled ‘Get Orders’
<v1.3><1.6>The file naming format is : customer_invoice_report_XXXXX_yyyymmdd-COUNTRYCODE.csv Where the COUNTRYCODE (either ae or sa) depends on the splitted file country.</1.3></v1.6>
customer_invoice_report_82174_20231104.csv
Noon only supports sinxgle quantity line item based entries. Therefore even if a multi-quantity order was placed, Noon will put each item as a separate item number with the same invoice number but a unique item number. Thus we need to group by source_document
(we need to only map the number before the "-" sign) , sku
and item price (which is calculated from two fields, explanation is in the mapping below) from the .csv file when importing and import all associated products to the given invoice number. If we have the same partner_sku
but different item price, we want to import the products on separate rows.
<v1.5> Additionally, since it looks like Noon mark shipments on product level, i.e an example order with 4 products could get shipped separately and after every shipment they provide us with a new order file containing the same order, but this time with another product (just the one that is shipped on the day) and this leads to not saving the additional products if they were not shipped the same day. Thus we need to add an additional logic :
On top of checking for existing marketplace order ID, we need to start checking if the item_nr from the files already exists in Order Item Line > Marketplace Order Item ID field as well. Both checks need to be made for every row from the file:
- If
source_document
ID does not exist asOrders
>Marketplace Order ID
in Hemi (i.e the order has not been previously imported in Hemi) We save the order withsource_document
as a Marketplace Order ID as per our current logic -
If
source_document
ID exists asOrders
>Marketplace Order ID
in Hemi we need to add an additional checks which include theitem_nr
:- If
item_nr
ID exists asOrder Item Line
>Marketplace Order Item ID
= 'Yes' then We skip the row - If
item_nr
ID does not exist asOrder Item Line
>Marketplace Order Item ID
then we create a new order usingitem_nr
asOrders
>Marketplace Order ID
and we need to separate new order for everyitem_nr
that does not exist in hemi under thesource_document
.
We need to have in mind is how we read files and to avoid mixing the two points above.</v1.5>
- If
<v1.3>Mapping : Please note N/A means we exclude it and not map to anything <v1.9> Please note that since we are now creating the file, there are some headers which are removed from the mapping below and some that are with changed names, all changed are tagged, the removed ones are just removed from the table below. </v1.9>
Noon csv header name | Hemi Field | Comment |
---|---|---|
id_partner |
N/A | |
marketplace |
<v1.8> Orders >Marketplace Fulfillment Channel </v1.8> |
|
invoice_nr |
Order Payment >Transaction ID |
|
item_nr |
Order Item Line > Marketplace Order Item ID </v1.4> |
|
partner_sales_nr |
N/A | |
<v1.9> order_nr </v1.9> |
Orders > Marketplace Order ID |
AND
Orders
> Shipping Track Number
| For Marketplace Order ID
:
The source_document
will be in format : NAEF30075650467-S2 we need to only store the number before the “-” sign.
<v1.2> It is possible that we might also receive a source_document
in format NAEF30075650467 (without the “-” sign) so we should be able to handle both cases </v1.2>
For Shipping Track Number
: We import the value as it is. We need to store this in this field as the client will be getting it via API. |
| sku
| Product in Order
> Item Order Line ID
| In order to have unique Item Order Line ID
we want to calculate it as sku
+ item price
and store it as sku¦item_price |
| partner_sku
| Product in Order
> SKU
| |
| receiver_emirate
| <v1.6> Orders
> Shipping City
AND Orders
> Billing City
| According to the value in the file we need to save the full name values using the internal mapping as follows:
DXB - Dubai
AUH - Abu Dhabi
SHJ - Sharjah
FJR - Fujairah
AJM - Ajman
RAK - Ras Al Khaimah
UAQ - Umm Al Quwain
If empty, we are to hardocde both shipping and billing fields to ‘Noon City’
If we receive any other emirate (not from the list above) we want to store ‘Noon City’
</v1.6> |
| country_code
| Orders
> Shipping Country Code
| It will be sent with lowercase letters, we need to to import it with uppercase. |
| <v1.9> currency_code
</v1.9> | Orders
> Order Currency
| |
| <v1.9> seller_price
</v1.9> | Product In Order
> Item Price
| |
| <v1.9> ordered_date
</v1.9> | Orders
> Shipping Shipped Time
| The date is coming in a DD/MM/YYYY format. We need to convert the date into unix timestamp format and add the current time, so we will import the ordered_date
+the current HHmmss at the time of import. |
With every imported order, we also want to create Order Payment
row with Type
= Payment and Status
= Completed and Total Amount
based on the order total amount which should be calculated from the ordered items.
Since we are importing orders based on an invoice document, therefore we are missing a lot of information regarding the order. This information is not necessarily needed as the orders will be already fulfilled by Noon so we do not need to have correct customer/shipping information etc., however we need to have some of the fields filled in Hemi due to client requirements.
In order to achieve this, we will need to hardcode the following fields so they are filled with every order import :
Hemi Field | Hardcoded Value | Comment |
---|---|---|
Orders > Order Payment Method |
Noon | |
Orders > Shipping Buyer Name |
Noon Customer | |
Orders > Shipping Carrier |
Noon | |
Orders > Shipping Service |
FBN | |
Orders > Shipping Street 1 |
Noon Address | |
Orders > Shipping Phone |
99999999999 | |
Orders > Order Total Amount |
This needs to be calculated based on the ordered items based on their price and quantity. | |
Orders > Buyer mail |
<v1.7> noonuser@noon.com </v1.7> | |
Orders > Ship by Date |
<v1.7>NOW() + 2 days</v1.7> |
</v1.3>
Since the ordes in the invoice report will be already shipped orders, we want to always import the orders in Hemi with Orders
> Order Status
= Shipped .We also need to enrich the order as per our Orders Abstraction - Order management general requirements . We should also create a record in Order Shipment
with status Complete. We should not have Incomplete or Ready for Shipping orders at this stage of our integration with Noon. Also there will be no updates on orders so if we receive the same order in two separate invoices , we should do nothing and skip it the second time we receive it.
<v1.1> After successfully processing the csv file, we want to move it into a Processed folder if we managed to process all orders in the file. If one or all orders in the file have failed to be imported successfully, we want to import whatever we can, but move the whole file into an Error folder. </v1.1>