hellohq-io / hellohq.docs

1 stars 0 forks source link

API Request to Documents fails on specific docs due to date/time conversion error #177

Open salkin-hc opened 2 months ago

salkin-hc commented 2 months ago

Describe the bug When acessing Documents Endpoint the following error occurs: 400 - {"message": "Conversion failed when converting date and/or time from character string."}

All affected documents have been posted to the API (Documents & Document Position) previously. After which the status was changed to paid including the payment date. All documents where the document was changed and a payment date was set produce this error message. Before the payment was set, all documents where getable. This suggests that the date of the payment is the issue.

In the front end, every Payment Date is correct (its viewable & sortable suggesting correct interpretation as date in the backend)

I've tried both the date format: 2019-07-29T00:00:00.000Z and 2019-09-20T00:00:00Z. The first format is suggested in the swagger documentation, the second is the actual value which is returned, when quering for the payment date of an record that is created in the front end.

monderino commented 2 months ago

Hey,

how to you set the documents to paid? Via the API or via the UI?

Best Sven

salkin-hc commented 2 months ago

I set the Status through the API endpoint.

monderino commented 2 months ago

Thank you. The fix will be online tomorrow.

Best Sven

salkin-hc commented 2 months ago

Alright thank you. Will i have to set the Status through the API again or can i leave it as it is now and the error Message will Not appear again tomorrow?

If i have to set the Status tomorrow again, the only way known to me is that i have to delete the invoices and post them again + doc positions and then reset the Status through the API. I already tried Setting the Status to "Entwurf" and then back to Paid, but that didnt work as well if i recall correctly.

monderino commented 2 months ago

No there is nothing you need todo.

Only one thing, please do not set any document to paid today. ;)

I will run a fix for your current data, then you can fetch them again from the api. But when you set afterwards a different document to paid. Then it's broken again.

salkin-hc commented 2 months ago

Oh ok thank you very much. Should i have done anything differently regarding the Change Status Request?

If there is something i can do differently then i can also do the changes on my end and implement them in the Future.

monderino commented 2 months ago

No, all should be fine now.

If it happen again, please send me an example of your request. But it should be fixed now.

Best Sven

salkin-hc commented 2 months ago

I have not tried it out again with invoices, but the api to get the documents works again, so thank you. I just now tried to set the status of some incoming invoices to paid or rather approved while also giving the payment data in the request. The new approved status for invoices works, but the payment is not recorded in the frontend. How can i fix this?

Schaukelking commented 2 months ago

Hey @salkin-hc

sorry for the late response. As far as i understood, you try to set an incoming invoice to paid and expect payments?

Usually, Incoming Invoices have no "Paid" status. They only can be accepted. Additionally, Incomin Invoices do not have the payment logic. This only works for Invoices, Final Invoices and Advanced Invoices.

We don't see a need to register payments on incoming invoices. Also in the UI you should not see Payments for incoming invoices.

Please verify your process and let me know, if you have different informations about it.

Kind regards, Patrick

salkin-hc commented 2 months ago

Well that is news to me :)

While the status can only be set to approved, we can enter payments for the incoming Invoice. We can also see the paymount amount and payment date of the incoming invoice in the front end as well as the backend (though the API).

Schaukelking commented 2 months ago

Sorry for the confusion, I talked to our product team and you are right, in the overview of incoming invoices you can set them to paid.

Can you send me an example Id of an IncomingInvoice where you tried to set the payment? So I can check if there is an display issue or an issue putting payments into incoming invoices via API.

I will create an internal ticket as soon as I got the information, so we will fix it very soon :)

salkin-hc commented 2 months ago

Example ID: 1912

The Data i tried to post was: "documentStatusId": 18, "paymentDtos": [ { "paymentDate": "2024-06-12T00:00:00Z", "amount": 825.38, "typeOfPayment": 1 } ]

The request is succesful and i get a response from the API, but it is not recorded in the front end.