Noon File Splitter
Version | Date | Created / Updated | Notes |
---|---|---|---|
v1.0 | 01/07/2025 | Hristiyan | First publish |
Noon will start sending us orders & returns into a single file, which we need to split into two separate files so we can process them.
We want to do this via creating a cron which will only do this - pick a combined file and split it into two separate csv files. There are some changes in the fields’ names and they have been scoped in both the Get orders and Get cancellations scopes.
We want to use the FTP Credentials
table where we input the details and for the orders splitter we want to control this via an FTP path labelled ‘Split Files. We don’t know the exact format of the file, so we want to pick any file which has .xlsx OR .csv extention in the ftp path folder.
After we have splitted the file into two csv files, we want to move them into the respective folders :
- For Orders - We want to use the FTP path labelled ‘Get Orders’ to identify where we need to drop the orders file so it can get picked by the get orders cron. The file naming convention should be - customer_invoice_report_82174_yyyymmdd.csv
- For Cancellations/Returns - We want to use the FTP path labelled ‘Get Cancellations’ to identify where we need to drop the cancellations/returns file so it cat get picked by the get cancellations cron. The file naming convention is vat_creditnote_82174_yyyymmdd.csv
Example file :
noon_finance_consolidateditemlevelfeesreport.xlsx
We can identify if the record is a cancellation/return via the returned_date . If the returned_date row is empty, then this means we have an order. If we have a date, then this means it is a cancellation/return. So we can split based on that.
As we can see there are 51 headers in the file, but we don’t need all of them. For the newly created files, we only want to include the following headers, in the following order :
Order File :
Header | Notes |
---|---|
id_partner |
|
marketplace |
|
invoice_nr |
|
item_nr |
|
partner_sales_nr |
|
order_nr |
|
sku |
|
partner_sku |
|
receiver_emirate |
This header does not exist in the original file, but we need to include it just as a header in our splitted files, and it will be empty. |
country_code |
The country code in the original file is with uppercase letters, when splitting we need to make them lowercase in the splitted files. |
currency_code |
|
seller_price |
|
ordered_date |
Cancellations File :
Header | Notes |
---|---|
partner_sku |
|
sku |
|
item_nr |
|
id_partner |
|
marketplace |
|
order_nr |
|
creditnote_nr |
|
returned_date |
|
country_code |
The country code in the original file is with uppercase letters, when splitting we need to make them lowercase in the split files. |
seller_price |
Once we have split the files we want to move the original file into a Processed folder. If there were any errors, ideally we want to display what is the error in the terminal when run with DEVMODETRUE and we want to move the file into an Error folder. If we have managed to create only one file (orders or cancellations) we still want to move the original file into the Error folder.