Greenstand / treetracker-admin-api

Legacy API microservice for the admin panel
GNU Affero General Public License v3.0
31 stars 81 forks source link

The CSV upload does not support semicolon as separator #631

Open Tarek-Bohdima opened 2 years ago

Tarek-Bohdima commented 2 years ago

Payments Batch Upload Failed! "payment_confirmation_id" is not allowed to be empty;"payment_method" is not allowed to be empty;"paid_at" must be in ISO 8601 date format

dadiorchen commented 2 years ago

@Tarek-Bohdima this is expected behavior, when you upload payment, you must populate it correctly, please check the test case document for details

Tarek-Bohdima commented 2 years ago

I uploaded the same CSV i downloaded after i filled the fields required and i got this error: Payments Batch Upload Failed! "worker_id" is required;"amount" is required;"captures_count" is required;"currency" is required;"payment_confirmation_id" is required;"payment_method" is required;"earnings_id;worker_id;phone;currency;amount;captures_count;payment_confirmation_id;payment_method;paid_at" is not allowed;"field2" is not allowed;"field3" is not allowed;"value" must contain at least one of [id, earnings_id]

2022-03-28_to_2022-03-28 (1) 2.csv

dadiorchen commented 2 years ago

Hi, @Tarek how did you process the cvs file? it's intresting, the format of the CVS from you is completely changed, this is mine:

"earnings_id","worker_id","phone","currency","amount","captures_count","payment_confirmation_id","payment_method","paid_at" "3257d56f-c4a9-484f-9658-0776efe5337c","90eef52b-ad55-4953-ace9-6a324ae6cec2","123-123-1235","SLL","120000","220","","","" "18f869d9-ee0f-4dba-a762-42a96d3282bd","9d582e43-7a7a-44b4-8d40-848b6b490bf0","","SLL","120000","105","","","" "68232687-d1dc-4e0d-a754-905fee7d665a","9d582e43-7a7a-44b4-8d40-848b6b490bf0","","SLL","120000","90","","","" "ed4a16f5-8c3e-4d05-93e0-2eac0ee60e86","35a23de8-f1ab-4409-be79-3c6a158d5bde","123-123-1234","SLL","120000","99","","","" "0468269d-c6ee-4b94-bdbe-fbeeddc8030e","35a23de8-f1ab-4409-be79-3c6a158d5bde","123-123-1234","SLL","120000","90","","","" "80550d5f-9458-40a0-b216-c6877c4c6291","35a23de8-f1ab-4409-be79-3c6a158d5bde","123-123-1234","SLL","0","99","","",""

and this is yours:

earnings_id;worker_id;phone;currency;amount;captures_count;payment_confirmation_id;payment_method;paid_at 3257d56f-c4a9-484f-9658-0776efe5337c;90eef52b-ad55-4953-ace9-6a324ae6cec2;123-123-1235;SLL;120000;220;anyid0119;cash;Monday, Mar 28, 2018 18f869d9-ee0f-4dba-a762-42a96d3282bd;9d582e43-7a7a-44b4-8d40-848b6b490bf0;;SLL;120000;105;anyid0120;cash;Monday, Mar 28, 2019 68232687-d1dc-4e0d-a754-905fee7d665a;9d582e43-7a7a-44b4-8d40-848b6b490bf0;;SLL;120000;90;anyid0121;cash;Monday, Mar 28, 2020 ed4a16f5-8c3e-4d05-93e0-2eac0ee60e86;35a23de8-f1ab-4409-be79-3c6a158d5bde;123-123-1234;SLL;120000;99;anyid0122;cash;Monday, Mar 28, 2021 a92118de-3f57-4447-a9f7-9e0e99e25db4;35a23de8-f1ab-4409-be79-3c6a158d5bde;123-123-1234;SLL;120000;200;anyid0123;cash;Monday, Mar 28, 2022 0468269d-c6ee-4b94-bdbe-fbeeddc8030e;35a23de8-f1ab-4409-be79-3c6a158d5bde;123-123-1234;SLL;120000;90;anyid0124;cash;Monday, Mar 28, 2023 80550d5f-9458-40a0-b216-c6877c4c6291;35a23de8-f1ab-4409-be79-3c6a158d5bde;123-123-1234;SLL;0;99;anyid0125;cash;Monday, Mar 28, 2024

The CVS file's column should be separated by a comma, not semicolon, but your test is definitely meaningful, it's possible for our users doing the same thing, can you tell me what's your steps to deal with the file?

Tarek-Bohdima commented 2 years ago

Hi @dadiorchen

dadiorchen commented 2 years ago

@Tarek-Bohdima I did as you said, but got result like this:

earnings_id,worker_id,phone,currency,amount,captures_count,payment_confirmation_id,payment_method,paid_at
18f869d9-ee0f-4dba-a762-42a96d3282bd,9d582e43-7a7a-44b4-8d40-848b6b490bf0,,SLL,120000,105,2222,visa,2022-02-21

Do you know what cause the semicolon to be chosen as seperator? It's unusual for CSV (comma-seperated file)

Tarek-Bohdima commented 2 years ago

@dadiorchen I repeated the steps; to check the colons: 1- exported CSV again, and open in Numbers , and checked it is indeed in commas 2- after editing and exported as CSV , i found the delimters are semicolon 3- trying to change it back to colon , messed the table :) so i guess i need something other than Numbers program to process the CSV any advice?

Screenshot 2022-03-31 at 09 01 59 Screenshot 2022-03-31 at 09 05 31 Screenshot 2022-03-31 at 09 21 36
dadiorchen commented 2 years ago

I think this is definitely possible for our end-user that they run into this trouble too, so I will leave it a valid issue and try to solve it later. For now, for making you process forward, you can try upload to google drive and open with google sheets, I tried and it works.

neil-gok commented 1 year ago

@dadiorchen I just joined the team and looking for "good first issue" tags for admin api. However, reading through this thread, I don't see this as being a bug. Are we saying we are going to accept commas and semicolon as delimiter?